How to respond to Fulfillment requests as a fulfillment service with Eventbridge

jjrise
Shopify Partner
10 0 0

We are an app / fulfillment service and recently started using Eventbridge. However, it is not possible as mentioned in THIS thread to change the callback_url to an Eventbridge ARN. That being the case, we added another webhook for managing fulfillment requests by adding our ARN to the "fulfillment_orders/fulfillment_request_submitted" webhook. 

 

This generally works, but now we have two requests that are sent to us whenever a new fulfillment request occurs. What is the best practice here? It seems bizarre that Shopify doesn't allow the callback_url to be a Eventbridge url even though Shopify seemingly recommends Eventbridge for this? We have been just auto responding with a 200 to our callback_url events and then processing everything through Eventbridge. I would love to hear more about this and the best practices that the Shopify team recommends.

 

Thanks!

Replies 2 (2)

Liam
Shopify Staff
2731 299 769

 

Hi Jjrise

An alternative method to handle this might involve using a Lambda function on AWS to receive the webhook and then pass the data to EventBridge. This way, you will only have one request coming into your system for each event.

 

For the redundant webhooks that are being sent to your callback_url, you might want to look into unsubscribing from those specific webhooks if they're not needed. You can do this through the Shopify admin API.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

jjrise
Shopify Partner
10 0 0

Hi @Liam, thanks for the quick response! We might be on slightly different pages though... These are the two events that I am referring to below. 

 

  1. When users install my non-embedded app, they are adding our app as a fulfillment service. This requires a HTTP callback_url, which has historically been our main way to receive fulfillment requests from our merchants. I can't remove this because it remove us from being a fulfillment location / service for the merchant, so that event will send to our callbcak_url every time a new order comes in regardless?
  2. We want to use Eventbridge to handle Shopify events instead of handling webhooks directly like #1. In order for us to use Eventbridge, I had to subscribe to this webhook topic: "fulfillment_orders/fulfillment_request_submitted" and point the address to our Eventbridge ARN.

So now every time a new order comes in, we receive events for both #1 and #2. Right now I respond to #1 immediately with a 200 and the process #2 normally via Eventbridge. 

 

Thanks!