Re: Sending data back to front after a Webhook has been processed

Sending data back to front after a Webhook has been processed

w1am
Shopify Partner
9 0 3

I have a webhook handler in my server.js file:

 

const operation = await Shopify.Webhooks.Registry.register({
  shop,
  accessToken,
  path: "/bulk-operation",
  topic: "BULK_OPERATIONS_FINISH",
  webhookHandler: async (topic, shop, body) => {
    // codes to handle webhook
   
    const response = {
      message: "hello world!"
    }

    return (ctx.res.statusCode = 200)
  },
});

if (!operation.success) {
  `Failed to register BULK_OPERATIONS_FINISH webhook: ${response.result}`;
}

 

I'd like to return a Javascript object to my Shopify React app and use it for other things. I'm guessing I'll have to utilize subscription with graphql, but I'm not familiar with the syntax. Do you have any recommendations?

Replies 2 (2)

awwdam
Shopify Staff
249 42 38

@w1am if you just getting started with GraphQL and want to leverage our API, I'd suggest our GraphQL API Learning Kit as your first stop, and then consider exploring some of our related Developer blog posts!

From there, you can take a look at our extensive GraphQL Admin API docs,  Node.js Client Library, as well as some of the more specific and in-depth examples here (many of which allow toggling between REST and GraphQL). 

Hope that offers a good head start - Cheers!

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

IvanYul
Shopify Partner
5 0 2

reply removed