CUSTOMERS_CREATE Webhook to include Metafields

CUSTOMERS_CREATE Webhook to include Metafields

beertopia
Shopify Partner
1 0 0

I'm trying to configure the Shopify node.js app template to include customer meta fields from the "user_engagement" namespace in the CUSTOMER_CREATE webhook.

 

CUSTOMERS_CREATE: {
    includeFields: ["id", "metafields"],
    metafieldNamespaces: ["user_engagement"],
    privateMetafieldNamespaces: ["user_engagement"],
    deliveryMethod: DeliveryMethod.Http,
    callbackUrl: "/api/webhooks",
    callback: async (topic, shop, body, webhookId) => {
      if (receivedWebhooks[webhookId]) return;
      receivedWebhooks[webhookId] = true;

      const customer = JSON.parse(body);

      
      customerCEISetterQueue.push({ shop, customer });
    }
  },

And this is what I get

 

 

 

{
  id: 7078195462453,
  accepts_marketing: false,
  created_at: '2023-06-28T13:26:54-04:00',
  updated_at: '2023-06-28T13:26:54-04:00',
  orders_count: 0,
  state: 'disabled',
  total_spent: '0.00',
  last_order_id: null,
  note: '',
  verified_email: true,
  multipass_identifier: null,
  tax_exempt: false,
  tags: '',
  last_order_name: null,
  currency: 'EUR',
  addresses: [
    {
      id: 9299134939xxx,
      customer_id: 7078195462453,
      company: '',
      city: '',
      province: '',
      country: 'Germany',
      province_code: null,
      country_code: 'DE',
      country_name: 'Germany',
      default: true
    }
  ],
  accepts_marketing_updated_at: '2023-06-28T13:26:54-04:00',
  marketing_opt_in_level: null,
  tax_exemptions: [],
  email_marketing_consent: null,
  sms_marketing_consent: null,
  admin_graphql_api_id: 'gid://shopify/Customer/7078195462453',
  default_address: {
    id: 9299134939445,
    customer_id: 7078195462453,
    company: '',
    city: '',
    province: '',
    country: 'Germany',
    province_code: null,
    country_code: 'DE',
    country_name: 'Germany',
    default: true
  }
}

 

 

 

 

the only article I found regarding this topic

https://community.shopify.com/c/metafields-and-custom-data/how-to-configure-orders-update-webhook-to...

 

Replies 0 (0)