Webhooks allow you to receive automatic notifications when the order status changes. It enables loosely coupled system-to-system integration via standard HTTP POST requests.
Webhooks are user-defined HTTP callbacks that are triggered when an order status change event occurs. Whenever an order status change event occurs in Gooten, the webhook receives the event, collects the order data, and sends it to the URL you specified via an HTTP POST request.
This is important because it allows you to receive the latest information about your order whenever its status changes in our system, so that you can pass it back to your system.
- Webhook setup and ensuring the webhooks communicate properly
- Sample webhook content
- Limitations and troubleshooting scenarios
Webhook setup and ensuring the webhooks communicate properly
To get started with Webhook, you’ll need to build a webhook handler that receives webhook requests from Gooten. The webhook handler will need to accept POST requests and perform the action based on the request contents.
To sign up for webhooks, enter the address of your webhook handler on your notifications page on the Gooten site. An example of a webhook handler address is:
https://www.example-partner.com/events/gooten-webhooks/?orderid=Our backend will send POST requests that look like
Let's get started!
In our scenario, we’ll be using Zapier, but feel free to use any other client for handling webhooks.
- https://zapier.com/You’ll first need to create a webhook handler to accept the POST requests from Gooten. In Zapier, click on the Create Zap button. You’ll then need to create a trigger. Add the Webhooks by Zapier app by searching for and selecting it.
3. In the Trigger Event section, select the Catch Raw Hook event. By choosing this option, the webhook you’re building will wait to accept any new POST, PUT, or GET requests sent to the Zapier URL, then return the request body.
Afterward, you can click the Continue button.
4. Heyou'llu’ll receive the Webhook URL that can be used to receive the POST requests from GootYou'llu’ll copy this URL by clicking the Copy button, you'llu’ll need to add this to the Gooten Admin.
5. In your Gooten Admin, navigate to the Webhooks section under the API tab on the Settings page. You’re in this section, click on the enable Webhooks option.
6. Paste in your Webhook handler URL that you copied from Zapier, and be sure to add "& order_id” to the URL, as our Gooten requests will send the order ID when a status change is made. You can find an example webhook handler URL with the order ID attached below.
After entering the webhook handler URL, click the Test button in the field, then click the Save endpoint button.
https://hooks.zapier.com/hooks/catch/10148348/byvuimv/?orderid=7. Once you save the endpoint in the Gooten Admin, go back to Zapier and click on the Continue button.
8. The next section allows you to perform a trigger test to ensure that your handler receives a request from Gooten when there is a status change made. Make a status change to an order in Gooten, and then click on the Test trigger button.
9. Once you test your triggyou’ll be able to see the body of the POST request that Gooten sends to your webhook handler URL. This request is sent when an order status is updated, and it returns the order details, including the order ID, in the body.
Now, the webhook you’ve just built should accept POST requests from Gooten whenever an order status is updated in the system. This ensures that your webhooks are working and communicating correctly.
You can then click the Continue button to choose how to handle the information from the POST request.
10. Zapier allows you to integrate with many different apps for how you want to display the information in the POST request from Gooten. Let’s choose an action to perform whenever a request is accepted from our webhook handler.
In this example, we’ll choose to display the information in a Slack channel. Select the Slack app in the action window.
- Slack is a software application used to communicate with team members via chat rooms or direct messages.
We’ll choose Send Channel Message as the Action Event, then click Continue.
12. He’ll log into our Slack account and then click Continue.
13. In the Set up action section, we’ll choose which channel we want to send the message to and then provide the text for the message.
We’ll have the option to add the raw body information from the Gooten POST request sent to our webhook handler. We’ll do this by clicking the Raw Body option in the Catch Raw Hook event. This will post the raw body text from the Gooten POST request to the Slack channel, and this will occur every time an order status is updated in Gooten.
14. There are many different options that we can change for the Slack message; we’ll keep it generic for this example. Afterward, we’ll click on the Continue button.
15. After this, we can click on the Test & Continue button to test the action after the webhook handler accepts the request from Gooten.
16. Once the test is complete, we’ll receive a notification mentioning that a Slack message was sent. We’ll check the Slack message sent momentarily. Click the Turn on Zap button to enable the webhook handler fully.
17. If we take a moment to view the message in Slack, it should be sent to the channel that we selected, and the message will include the raw body from the Gooten POST request that our webhook handler accepted. This will occur when the order's status is updated.
18. If you go back to the Zapier webhook handler, please make sure that it is enabled. As long as your webhook handler is enabled, it will receive all Gooten POST requests whenever an order status is updated, and it will perform the action you set up. In our case, it will send a Slack message every time an order status is updated in Gooten.
Sample webhook content
Webhooks will fire each time an order item is updated. All webhook content includes details of an order and all of its order items. Most importantly, each order item has a status attribute that tracks it through the status lifecycle f'om 'new’'to ‘delive'ed.'
{
"Id": "7-501853e1-8d78-4e1e-83a0-be9fb432efe1",
"NiceId": "Magic7-501",
"Items": [{
"Sku": "TabletCase-GalaxyNote10.0-Matte",
"ProductId": 58,
"Product": "Tablet Cases",
"Quantity": 1,
"Status": "New",
"TrackingNumber": "9400115901344442556597",
"TrackingUrl": "",
"ShipCarrierName": "USPS",
"Price": {
"Price": 25.5,
"CurrencyCode": "USD",
"FormattedPrice": "$25.50",
"CurrencyFormat": "${1}",
"CurrencyDigits": 2
},
"DiscountAmount": {
"Price": 0,
"CurrencyCode": "USD",
"FormattedPrice": "$0.00",
"CurrencyFormat": "${1}",
"CurrencyDigits": 2
}
}, {
"Sku": "TabletCase-GalaxyNote8.0-Gloss",
"ProductId": 58,
"Product": "Tablet Cases",
"Quantity": 1,
"Status": "New",
"Price": {
"Price": 22.8,
"CurrencyCode": "USD",
"FormattedPrice": "$22.80",
"CurrencyFormat": "${1}",
"CurrencyDigits": 2
},
"DiscountAmount": {
"Price": 0,
"CurrencyCode": "USD",
"FormattedPrice": "$0.00",
"CurrencyFormat": "${1}",
"CurrencyDigits": 2
}
}, {
"Sku": "WovenBlanket_50x60",
"ProductId": 101,
"Product": "Woven Blankets",
"Quantity": 1,
"Status": "New",
"Price": {
"Price": 45,
"CurrencyCode": "USD",
"FormattedPrice": "$45.00",
"CurrencyFormat": "${1}",
"CurrencyDigits": 2
},
"DiscountAmount": {
"Price": 0,
"CurrencyCode": "USD",
"FormattedPrice": "$0.00",
"CurrencyFormat": "${1}",
"CurrencyDigits": 2
}
}],
"Total": {
"Price": 108.91,
"CurrencyCode": "USD",
"FormattedPrice": "$108.91",
"CurrencyFormat": "${1}",
"CurrencyDigits": 2
},
"ShippingTotal": {
"Price": 15.61,
"CurrencyCode": "USD",
"FormattedPrice": "$15.61",
"CurrencyFormat": "${1}",
"CurrencyDigits": 2
},
"ShippingAddress": {
"FirstName": "Alina",
"LastName": "Magicworld",
"Line1": "Bittersweet St. 67, appt.#37",
"City": "Bittersweet",
"State": "AL",
"CountryCode": "US",
"PostalCode": "548912",
"Phone": "80507894586",
"Email": "Bittersweet@gmail.com"
},
"BillingAddress": {
"FirstName": "Alina",
"LastName": "Magicworld",
"Line1": " ",
"City": " ",
"State": " ",
"CountryCode": "US",
"PostalCode": "654812",
"Email": "Bittersweet@gmail.com"
}
}Limitations and troubleshooting scenarios
Just so you know, it's not possible to set up multiple webhook endpoints for one account. Gooten provides a single endpoint, and you are free to send it to other endpoints from there.
Please note that if you have an endpoint for Gooten webhooks, and u’re not receiving any data, the most likely culprit is the missing `?orderid=` parameter in the endpoint URL. By default, the endpoint appends the orderid to the URL, so you need a querystring parameter to capture it.