Getting custom payloads for a specific topic

Hi everyone,

I’m currently subscribing to the CUSTOMERS_MARKETING_CONSENT_UPDATE webhook topic and I would like to include extra fields in the payload — specifically the customer’s email.

According to the documentation, the default event payload looks like this:

{
  "id": 706405506930370084,
  "phone": null,
  "sms_marketing_consent": {
    "state": null,
    "opt_in_level": null,
    "consent_updated_at": null,
    "consent_collected_from": "other"
  }
}

From what I understand, it seems that this topic only returns these fields and nothing else.
However, I tried to use the includeFields parameter in my GraphQL mutation to request additional fields, like this (C# example):

mutation SubscribeToCustomersMarketingConsentUpdate {
  webhookSubscriptionCreate(
    topic: CUSTOMERS_MARKETING_CONSENT_UPDATE,
    webhookSubscription: {
      uri: "{webhookEndpoint}",
      format: JSON,
      includeFields: ["id", "email", "phone", "sms_marketing_consent"]
    }
  ) {
    webhookSubscription {
      id
      topic
      includeFields
    }
    userErrors {
      field
      message
    }
  }
}

The subscription works, but the resulting payload still doesn’t include the email field.

:backhand_index_pointing_right: My question:
Is it actually possible to include extra fields (like email) in a webhook for this topic, or are we limited to the default payload defined by Shopify for CUSTOMERS_MARKETING_CONSENT_UPDATE?

Thanks in advance!

(This question has been translated and formatted by ChatGPT)

Hi @Jeffrey_Fournier

You cannot include extra fields such as email in the CUSTOMERS_MARKETING_CONSENT_UPDATE webhook payload. You are limited to the fields Shopify provides for this topic. If you need the customer’s email, you will need to fetch it separately using the customer ID from the webhook payload and a GraphQL query to the Admin API.

Hope this helps :slight_smile: