Shopify webhooks

pipedream are able to create webhooks to listen for customers update and other hooks, but we are unable to customize them, i need to include metafields

  {
...
            "format": "json",
            "fields": [
               ..
            ],
            "metafield_namespaces": [
                ....
            ],
        }

Hi @job,

To include metafields in your webhook, you can create a custom webhook using Pipedream’s HTTP API. You can set up an HTTP endpoint using Pipedream’s $respond function and customize the webhook payload as needed.

Here’s an example of how to create a custom webhook with metafields:

import { axios } from "@pipedream/platform";

export default defineComponent({
  async run({ $ }) {
    const payload = {
      // Your custom payload data
      format: "json",
      fields: [
        // Your fields here
      ],
      metafield_namespaces: [
        // Your metafield namespaces here
      ],
    };

    // Send the payload to the desired webhook URL
    const webhookUrl = "https://your-webhook-url.com";
    await axios($, {
      method: "POST",
      url: webhookUrl,
      data: payload,
    });

    // Return the payload for logging purposes
    return payload;
  },
});

Replace the webhookUrl variable with your desired webhook URL, and customize the payload object as needed. This component will send the custom payload to the specified webhook URL.

If you need further assistance or have any questions, please visit https://pipedream.com/support for more support options.
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.

Make no sense, when I request to receive customer instance update, i want to be able to customize the fields I want to receive, is it possible? or do I need to manually handle this?

Hi @job,

Sorry for the confusing answer from Mario. It’s still learning and will get better with time.

Regarding your issue, would you mind elaborate the customtization of metafield you’d like to have? .e.g Do you want the source to only emit events only when a specific metafied matched a value?

"From my understanding, you subscribe to different webhooks to receive updates about “update customer (instance)”. When you subscribe to these webhooks, you send a payload. In that payload, you can specify which metafield you are interested in. I want to be able to change that payload before subscribing to the webhook :slight_smile:

I could create http endpoint on pipedream and subscribe to shopify webhooks using pipedream url, then my problem is solved, but i want to use the pipedream ui to handle everything.

Hi @job,

Could you shar Shopify Webhook API doc that allow us to specify the metafields? I think it would be most productive if you can create a ticket here, providing:

  • The app and specific source your want to be updated
  • The details for the updates e.g I want to add a metafields prop into the souce, so that there is oy event emitted when a customer with the specific metafield matched
  • The Shopify API doc that allow us to do implement that

Tell me how do you subscribe to the webhooks?

HTTP/1.1 201 Created
{
  "webhook": {
    "id": 5795632215,
    "address": "pubsub://projectName:topicName",
    "topic": "customers/update",
    "created_at": "2023-05-17T14:45:37-04:00",
    "updated_at": "2023-05-17T14:45:37-04:00",
    "format": "json",
    "fields": [],
    "metafield_namespaces": [],
    "api_version": "unstable",
    "private_metafield_namespaces": []
  }
}