Enable scheduled publishing
This tutorial explains how to integrate your channel app with scheduled product publishing. The use case is simple, but you'll learn how to find resources to build more complex use cases on your own.
Anchor to OutcomesOutcomes
After you've finished this tutorial, you'll know how to do the following:
-
Request access to scheduled publishing
-
Retrieve products that are scheduled to be published to a sales channel
-
Poll the GraphQL Admin API to know what products are about to be made available to the channel
Anchor to RequirementsRequirements
- You've completed the Getting started tutorials.
Anchor to Access scopesAccess scopes
- Your app requires the
read_product_listings
access scope.
Anchor to Step 1: Request access to scheduled publishingStep 1: Request access to scheduled publishing
- From the Partner Dashboard, go to Apps and then select your app from the list.
- From your app's overview screen, click Configuration.
- In the App settings section, on the Product Scheduled Publishing card, click Enable feature.
If your channel doesn't include product validation, then you only need to complete this step.
Anchor to Step 2 (optional): Identify products that are scheduled for publicationStep 2 (optional): Identify products that are scheduled for publication
Request resourcePublicationOnCurrentPublication
on the GraphQL Admin API's Product object. A publishDate
in the future indicates that the product is scheduled to display on the channel at the specified datetime.
For example,
POST /api/{api_version}/graphql.json
{
products(first: 10) {
edges {
node {
title
resourcePublicationOnCurrentPublication {
publication {
name
id
}
publishDate
isPublished
}
}
}
}
}
{
"data":{
"products":{
"edges":[
{
"node":{
"title":"Baseball",
"resourcePublicationOnCurrentPublication":{
"publication":{
"name":"Sales Channel",
"id":"gid://shopify/Publication/2"
},
"publishDate":"2021-09-23T17:30:00Z",
"isPublished":false
}
}
},
{
"node":{
"title":"Soccer ball",
"resourcePublicationOnCurrentPublication":{
"publication":{
"name":"Sales Channel",
"id":"gid://shopify/Publication/2"
},
"publishDate":"2021-09-10T17:30:00Z",
"isPublished":true
}
}
}
]
}
}
}
Anchor to Step 3: Subscribe to webhooksStep 3: Subscribe to webhooks
This step is only required if the channel validates products against requirements before displaying them.
Shopify's SCHEDULED_PRODUCT_LISTINGS
webhooks notify channels when products are scheduled to be published.
The following is an example payload: