fulfillments Webhook

ahosanu
New Member
1 0 0

I want to create two webhook "products/update" and "fulfillments/update". "products/update" is created and "fulfillments/update" creation failed.. 
I am using Nodejs "shopify-api-node".. 

 

 

 

      await shopify.webhook.create(
        {
          topic: "products/update",
          address: "https://eztextpro.com/event_notification",
          format: "json"
        }
      ).then(
        (res) => {
          console.log(res)
          connection.query("UPDATE shop_setting SET fulfilled_create_id=? where shop_url=?", [res.id, shop],function (error, results, fields) {
            if(!error)
              console.log("Created Create Fulfilled")
          });
        },
        (err) => console.error(err)
      );

      shopify.fulfillmentEvent.create
      await shopify.webhook.create(
        {
          topic: "fulfillments/update",
          address: "https://eztextpro.com/event_notification",
          format: "json"
        }
      ).then(
        (res) => {
          console.log(res)
          connection.query("UPDATE shop_setting SET fulfilled_update_id=? where shop_url=?", [res.id, shop],function (error, results, fields) {
            if(!error)
              console.log("Created Update Fulfilled")
          });
        },
        (err) => console.error(err)
      ).catch((err) => console.error(err));

 

 

 

This is the out put 

 

 

 

{
  id: 1018839760944,
  address: 'https://eztextpro.com/event_notification',
  topic: 'products/update',
  created_at: '2021-04-14T04:45:26-04:00',
  updated_at: '2021-04-14T04:45:26-04:00',
  format: 'json',
  fields: [],
  metafield_namespaces: [],
  api_version: '2021-01',
  private_metafield_namespaces: []
}
Created Create Fulfilled
HTTPError: Response code 422 (Unprocessable Entity)
    at Request.<anonymous> (D:\Fiver\Aqeel\courier_application\node_modules\shopify-api-node\node_modules\got\dist\source\as-promise\index.js:117:42)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: undefined,
  timings: {
    start: 1618389925319,
    socket: 1618389925319,
    lookup: 1618389925320,
    connect: 1618389925378,
    secureConnect: 1618389925440,
    upload: 1618389925440,
    response: 1618389925994,
    end: 1618389925994,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 0,
      dns: 1,
      tcp: 58,
      tls: 62,
      request: 0,
      firstByte: 554,
      download: 0,
      total: 675
    }
  }
}
undefined

 

 

 

Please help me .. How can I fix this?  

0 Likes