Publish Shopify Products to Facebook Channel via API

Shopify dialog to manually publish a product to sales channels.

REST API

The Product resource in the REST API has a property called published_scope with the available values web and global. Unfortunately, this does not give us the option to update the relationship to the Facebook channel.

GraphQL API

I love the Shopify GraphQL API. And it offers the mutation publishablePublish (and publishableUnpublish) to publish resources to a channel. In the GraphQL Explorer app, I tried to update the Facebook channel via the following GraphQL query on a development store:

mutation publishablePublish(
$id: ID!,
$input: [PublicationInput!]!) {
publishablePublish(id: $id, input: $input) {
userErrors {
field
message
}
}
}
{
"id": "gid://shopify/Product/123456",
"input": {
"publicationId": "gid://shopify/Publication/7890123"
}
}

What can I do now?

I found a workaround that is acceptable as an intermediate solution to this problem.

  1. The synchronization interface adds the tag “Facebook” to all products that need to be published on the Facebook channel.
  2. After the synchronization process (2 to 3 times per week), a shop admin has to navigate to the product overview page, select all products with the “Facebook” tag and call the action “Add available channels”.
Steps to “Add available channels” to products

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store