Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to know the Shopify username who triggered a webhook?

How to know the Shopify username who triggered a webhook?

Hari
Tourist
12 0 4

I have a product/update Shopify webhook. When the webhook event comes, I see the JSON payload but I don't get any clue about who updated the product. I need the username or email or whatever to identify the user who triggered the webhook. Is that even possible ? If yes, how ?

Replies 5 (5)

StriveDen
Shopify Partner
2 0 0

Hey Hari,

You can accomplish this by adding the parameter that identify the user to the Webhook Address. For example, it can look like this:

 https://myapp.com/webhooks/ProductUpdate?userId=[USER_ID]

Also, remember to authenticate the Webhook 🙂

Hari
Tourist
12 0 4

What is a webhook address ? Did you mean the url which is used to create the webhook ? Also, I shouldn't append that USER_ID to the url, I expect to come to me through the webhook event automatically.

Gavinator
Shopify Partner
1318 15 124

Hi Hari,

It isn't possible to know who triggered a product update webhook notification.

You can accomplish this by adding the parameter that identify the user to the Webhook Address.

Ummm... no. Since Shopify is making the POST, how would you do that?

Please see https://help.shopify.com/en/api/reference/events/webhook for more info.

Gavin.

www.bookthatapp.com

Hari
Tourist
12 0 4

Thanks for letting me know about that. Is there anyway we can request this to shopify. Because that is a highily essential and obvious requirement.

StriveDen
Shopify Partner
2 0 0

Sorry, I think I misunderstood the question. I thought you were asking about the app user, not the shop user.

As Gavin wrote, it’s not possible to identify who triggered a webhook.

 

Just to add to my first post, it’s also possible to get the shop url from “X-Shopify-Shop-Domain” header, which is sent with every webhook.