customers/delete webhook only returns customer id?

Shopify Partner
2 0 0

We've found empirically that the payload for `customers/delete` events only contains the customer id, not the full set of customer attributes, despite the api docs seeming to suggest otherwise. Others have noticed this discrepancy too.

For our purposes, the customer ID alone isn't helpful. We have a Shopify app that shop owners use for sending out targeted messaging to their customers. We'd like to keep the customer records that we import from their shop in sync ... deleting customers on our side when they get deleted from their shop,  etc.

However, we persist customer records with our own internal ID and enable fast lookups based on email address.  We were assuming that the `customers/delete` payload would include the customer's email (and the other attributes included in the payloads for `customers/create` and `customers/update`), which would permit us to lookup/delete the customer record from our datastore.

So, the ID alone isn't helpful ... we need their email address too.

We also found that once a customer has been deleted (as opposed to "disabled"), we can no longer retrieve the customer record w/ their email address via `GET / admin/customers/{id}.json`.

We can of course try to work around this limit to the `customers/delete` payload by persisting the shopify customer ID in the customer records we create, but that's an inefficient way for us to lookup a customer record and introduces extra latency that seems unnecessary.

But is their any chance `customers/delete` events could just return the same payload structure returned by the other `customers/*` events? That consistency would seem to make sense, eliminate confusion, and would be super helpful for typical use cases.

0 Likes
Shopify Partner
2 0 0

I had a glimmer of hope yesterday when I noticed that you can register a webhook callback to include specific fields in the returned payload (e.g., `email`).

See the Webhook Properties section of the webhooks endpoint doc, where it indicates that the fields property is an optional "array of fields which should be included in webhooks", e.g.:

"fields": ["id","updated_at"]


However, even when I registered a `customers/delete` callback with specified fields, only the customer id attribute is returned.

Confirmed that the webhook callback is getting registered properly with `curl -H "X-Shopify-Access-Token: $SHOPIFY_ACCESS_TOKEN" https://autopints.myshopify.com/admin/webhooks.json`, which returns:

{
  "webhooks": [
    {
      "id": 436404619,
      "address": "http://joyrex.localtunnel.me/customers/update",
      "topic": "customers/update",
      "created_at": "2017-03-22T18:20:23-05:00",
      "updated_at": "2017-03-22T18:20:23-05:00",
      "format": "json",
      "fields": [],
      "metafield_namespaces": []
    },
    {
      "id": 436405707,
      "address": "http://joyrex.localtunnel.me/customers/delete",
      "topic": "customers/delete",
      "created_at": "2017-03-22T18:23:34-05:00",
      "updated_at": "2017-03-22T18:23:34-05:00",
      "format": "json",
      "fields": [
        "id",
        "email"
      ],
      "metafield_namespaces": []
    }
  ]
}

 

0 Likes
Shopify Staff (Retired)
Shopify Staff (Retired)
531 0 88

Hey joyrexus,

This is currently the expected behaviour for all webhook subscriptions with the delete topic, with only a resource id being returned in the request to your application. If your application depends on some data contained within this resource, I would recommend storing this information in your application db.

I'll look into refactoring the documentation to make this more clear.

Cheers,

Jamie

0 Likes
Tourist
3 0 1

Hello All,

I am Prabakar working as a Deluge Script Developer. I have set an webhook notification for creating new paid orders. It's working fine but the content of the webhook is empty. How should i will get the content or response from the webhook ?

This is my Callback URL:

https://creator.zoho.com/api/webapps1/json/pilmico/form/Order_Received_From_Shopify/record/add?autht...

Your help would be appreciate. Please anyone assist me to fix this issue ASAP.

 

Thanks,

Prabakar

1 Like
Highlighted
Shopify Expert
12 0 3

The main biggest issue with all of these deleted hooks only returning the ID, is that you can't query the API for more information because the entity no longer exists.   Unless I stored customer information upon creation, I have no idea which customer was deleted.   Does anyone else see a problem with this?

0 Likes