Issues subscribing to metaobject webhooks

Here is the action code
/** @type { ActionRun } */
export const run = async ({ params, trigger, logger, api, connections }) => {
logger.info({ trigger }, "Syncing Shopify Metaobjects");
return {
success: true,
};
};

export const options = {
triggers: {
shopify: {
webhooks: [
"metaobjects/create",
"metaobjects/delete",
"metaobjects/update",
],
},
},
}
/** @type { ActionRun } */
export const run = async ({ params, trigger, logger, api, connections }) => {
logger.info({ trigger }, "Syncing Shopify Metaobjects");
return {
success: true,
};
};

export const options = {
triggers: {
shopify: {
webhooks: [
"metaobjects/create",
"metaobjects/delete",
"metaobjects/update",
],
},
},
}
I keep getting this error:
{
"message": "Error in field webhookSubscription: The specified filter is invalid, please ensure you specify the field(s) you wish to filter on."
}
{
"message": "Error in field webhookSubscription: The specified filter is invalid, please ensure you specify the field(s) you wish to filter on."
}
5 Replies
Chocci_Milk
Chocci_Milk6mo ago
Hello, Take a look at these docs to see how you'd need to add a filter for the metaobject webhook to work: https://shopify.dev/docs/api/admin-graphql/latest/mutations/webhookSubscriptionCreate
Shopify
webhookSubscriptionCreate - GraphQL Admin
Creates a new webhook subscription. Building an app? If you only use app-specific webhooks, you won't need this. App-specific webhook subscriptions specified in your shopify.app.toml may be easier. They are automatically kept up to date by Shopify & require less maintenance. Please read [About managing webhook subscriptions](https://shopify.d...
Chocci_Milk
Chocci_Milk6mo ago
You can add a filter from the top right:
No description
Jay
JayOP6mo ago
So this looks right?
/** @type { ActionRun } */
export const run = async ({ params, trigger, logger, api, connections }) => {
logger.info({ trigger }, "Syncing Shopify Metaobjects");
return {
success: true,
};
};

export const options = {
triggers: {
shopify: {
webhooks: [
"metaobjects/create",
"metaobjects/delete",
"metaobjects/update",
],
shopifyFilter: "type:sales_rep",
},
},
};
/** @type { ActionRun } */
export const run = async ({ params, trigger, logger, api, connections }) => {
logger.info({ trigger }, "Syncing Shopify Metaobjects");
return {
success: true,
};
};

export const options = {
triggers: {
shopify: {
webhooks: [
"metaobjects/create",
"metaobjects/delete",
"metaobjects/update",
],
shopifyFilter: "type:sales_rep",
},
},
};
Seems like that worked
Chocci_Milk
Chocci_Milk6mo ago
I beleive so. Only one way to know!

Did you find this page helpful?