Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Discussing syncing external data with Sanity and adding new fields to the schema.

7 replies
Last updated: Mar 2, 2022
Hello! I have a high-level, architectural approach question for folks who have tied Sanity pretty closely to existing / external systems.
Imagine a platform that has several existing pieces of data in a database. For example, let's say that they're `tags`: they have a
and a
These tags are in use, and already managed through a few admin forms. The intent is to keep them managed through these forms.

I'd love to keep these tags in sync, one-way, in Sanity, with the addition of an
to their schema.
A few questions:

1. Is this possible?
◦ It seems straight-forward enough to add or update a tag in Sanity from the existing system. The main unknown for me is the slight mutation of schema with the additional
. Are there traps there?2. Is this advisable?
◦ I know it introduces complexity to the system, but allows editorial additions to a schema that the external system doesn't care about. Different roles are managing tags and content, and editorial shouldn't be in control of these particular tags.
Any additional info that'd help? Are there variables I'm not considering? Thanks for any insight you can provide!
Feb 25, 2022, 3:37 PM
This is pretty similar to how a lot of people handle ecommerce integrations. The ecommerce platform handles the base product but sanity adds extra fields to the product's schema. I'd say just make sure the data from upstream (eg. label and slug) is read-only in the Sanity Studio.That's to say: it's pretty common and you shouldn't have any big issues.
Feb 25, 2022, 3:43 PM
That's great news! I thought as much, but it's nice to confirm before dedicating some time to it. Thank you!
Feb 25, 2022, 3:53 PM
user E
It does not currently, though in our case I think this is okay: we want the source of truth for part of the schema to be outbound from our system to Sanity, instead of a two-way sync or the reverse.
Feb 25, 2022, 4:33 PM
It does not currently, though in our case I think this is okay: we want the source of truth to be outbound from our system to Sanity, instead of a two-way sync.
Feb 25, 2022, 4:33 PM
(I might be misunderstanding your point!)
Feb 25, 2022, 4:43 PM
I took a second to digest it and I think I understand, a webhook implementation would be a little more resilient than having to identify all the places we need to set up a sanity client in code.
Feb 25, 2022, 5:14 PM
You can create Sanity documents to augment external data with or without syncing. But if you don't have syncing from the external service, you'll need to manually set an identifier for the external data source on your Sanity documents.
Syncing would essentially allow you to have content from the external source "pushed" into Sanity automatically. From there, it's probably a little easier to maintain documents that augment your external data
🙂. It also has the advantage of pushing the content itself directly into Sanity, allowing you to query it with GROQ and stitch it together with other content in interesting ways!
Mar 2, 2022, 9:48 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?