
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGreat question! Let me help you with both parts of your CircleCI integration.
For the GraphQL playground prompt, you can use the --playground or --no-playground flags to avoid the interactive question. In your CircleCI config, use:
sanity graphql deploy --dataset=staging --playground
sanity graphql deploy --dataset=prod --playgroundOr if you don't want the playground enabled:
sanity graphql deploy --dataset=staging --no-playground
sanity graphql deploy --dataset=prod --no-playgroundAccording to the CLI documentation, the command supports these flags:
--playground - Deploy with the GraphQL playground interface--no-playground - Deploy without the playground--dataset <name> - Specify which dataset to deploy for--force - Deploy without confirming breaking changes (useful for CI)For authentication in your CI environment, you'll need to set up a Sanity auth token as an environment variable. Create a token in your Sanity project settings and add it as SANITY_AUTH_TOKEN in your CircleCI environment variables. The CLI will automatically pick this up and won't prompt for login.
For comparing datasets between staging and prod and sending Slack notifications, I'd strongly recommend using Sanity Functions rather than traditional webhooks. Functions are serverless compute that run directly on Sanity's infrastructure - no external hosting needed!
Here's why Functions are better for this:
You could set up a Function that:
Here's a basic example structure:
// In your sanity.blueprint.ts
export default defineBlueprint({
functions: [
defineFunction({
name: 'notify-on-publish',
trigger: 'document.publish',
handler: async (event, context) => {
// Compare datasets and send to Slack
const slackWebhook = process.env.SLACK_WEBHOOK_URL;
// Your comparison logic here
await fetch(slackWebhook, {
method: 'POST',
body: JSON.stringify({
text: `Changes detected: ${event.documentId}`
})
});
}
})
]
});If you need to stick with webhooks for some reason (like if you already have external infrastructure), you can configure those in your Sanity project settings, but Functions are the modern, recommended approach for most automation tasks like this.
For your CircleCI workflow, you'd deploy both the GraphQL API and Functions as part of your pipeline:
- run: sanity graphql deploy --dataset=staging --playground --force - run: sanity graphql deploy --dataset=prod --playground --force - run: sanity blueprint deploy # Deploy your Functions
Hope this helps! Let me know if you need clarification on any part.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store