Webhooks for 3PL

Hey Guys!
So I have setup my first webhook to be used with SH and tested it internally with good success. I was about to register it but going through the docs, I came across:

If you are using a 3PL account, webhooks need to be registered on the Customer account and not the 3PL account to trigger correctly.

Really? We are a 3PL, and lets say I wanted to set up all 12 kinds of webhooks SH supports, and have 70+ clients - will I seriously have to create and maintain 840+ webhooks?! Surely that can’t be true… right?? I mean isn’t it super simpler to just “webhook_type” and “client_id” (or name) in the data sent to us with a single webhook?
Or at the very least have a single registered webhook per update type, and it contains the client id/name of whichever client the update belongs to?

Thank you!

Hey @Raj,

Thanks for reaching out! Going to look into this and get back to you.
Let me know if there’s anyway I can assist in the meantime.

Best,
RayanP

1 Like

Hey @Rayanp, Don’t mean to pressure you - just wondering if you got a chance to look into it and found something?

Hey @Raj,

Thanks for hanging in there and sorry for the delay.

It turns out that the only webhook that works strictly in the child account is the Return Update webhook. All of the rest can be registered through your 3PL account and should work just fine.

I’ll go ahead and update that section of our webhooks documentation.

Let me know if there’s anything I can do to assist!

Best,
RayanP

1 Like

Hey @Rayanp, Thank you for the update, that’s really helpful to know!
But bummer, seriously - ‘Return Update’ is the first webhook my boss asked me to create - not kidding!!

So… what’s so special about the Return Update webhook - is it possible to remove this exception maybe? It’ll be a big help - Thank you again!

Hey @Raj,

Thanks for hanging in there!

Unfortunately, I don’t think there is a workaround for this. I’m not 100% sure on the logic of it but the Returns Webhook just doesn’t work in the 3PL.

Let me know if there’s anything I can do to assist.

Best,
RayanP

1 Like

Hey @Rayanp, Sorry about the delayed reply - could you pls walk me through how would I go about setting those Returns webhooks?
I started by creating a Developer account under the Client account, but get this error when I use my existing account’s email:
image

I surely can’t be using a different email per client account.

Hey @Raj,

You should be able to register the return webhooks without having to create dev users in each child account. A mutation like this should work:

mutation {
  webhook_create(data: { name: "Return Update", url: "string", customer_account_id:"string" }) {
    request_id
    complexity
    webhook {
      id
      legacy_id
      account_id
      shop_name
      name
      url
      source
      shared_signature_secret
    }
  }
}

Let me know if this works for you!

Best,
RayanP

1 Like

Thank you @Rayanp , but I keep getting {"message": "Token is expired"} error each time I try.
Earlier I was trying it without the customer_account_id value, and after reading your reply here (saying Returns webhook is per client) so thought maybe that was the problem - but even after putting it there, I’m getting the same result.
I even just used my refresh token to retrieve another bearer token and got the same error using that.

These are my headers:

And here’s the body:

Do you see something glaringly wrong that I may be missing?

Hey @Raj,

That’s a bit peculiar, thanks for the extra details.
Looking into this now, I’ll update you as soon as I can.

Best,
RayanP

1 Like

Hey @Rayanp … any updates?
Thank you!

Hey @Raj,

Sorry for the delay.
Would you mind sending me your token privately? I’d like to impersonate your account. If I’m able to reproduce the issue, this might have to be escalated to our Engineering Team.

Let me know if there’s anything I can do to assist.

Best,
RayanP

1 Like

Yes sure, sending right now

Sent - Let me know if you meant to get the refresh token

1 Like

Hey @Rayanp, I figured it out, and while I’d like to blame Postman, I can’t help admitting it’s my fault for not figuring it out sooner - but your affirmation that the webhook registration worked using my token confirmed something was wrong on my end.
And here it is - hovering mouse on the auth header field showed me this tooltip:
image
(facepalm)
I disabled it, put the same token in the Authorization tab and it worked - I’m really sorry I wasted more of your time here than was warranted.
Thank you (once again) for all the help!

Hey @Raj,

No worries at all!
This was helpful for me too, in the future I can suggest checking that out if someone runs into a similar issue.

Glad everything is working now, let me know if there’s anything I can do to assist at all.

Best,
RayanP

1 Like