# Webhooks - Callbacks

Our platform relies on a system of webhooks to handle 2 kinds of scenarios:

1. Respond to requests which can potentially take a long time to process and are thus, handled asynchronously.
2. Notify an external system when a particular *event* occurs.

An example for pointer 1 listed above can be the menu push event. As the menu requests consist of considerable information for a store, such requests are processed asynchronously in our system. As and when the processing is complete in our system, a callback (webhook) is triggered notifying the details of successful processing or the errors in case the request wasn't processed successfully.

![Webhook Callback Processing Flowchart](/files/uauXEVW4TBYpzvDoMKuH)

Every webhook corresponds to a particular event. An event may be something like an order that is placed, a status change received for an order, a rider getting assigned for an order etc. The webhooks get triggered as soon as the event happens and thus by consuming the webhooks you would receive the details associated with an event.

Below are the required end-points for which we would require the URLs from your side. In addition, you can have a static token-based authorization for the end-points. No other mode of authorization is supported for configuration on our side.

* **Store Add/Update Callback** - triggered when store creation/update requests are processed.
* **Store Actions Callback** - triggered when store turn on/off action is processed.
* **Menu Push Callback** - triggered when menu push request is processed.
* **Category Timing Group Callback** - triggered when category timing group creation/update is processed.
* **Item Action Callback** - triggered when the items on/off are processed by the aggregator.
* **Options Action Callback** - triggered when the options on/off are processed by the aggregator.
* **Mark Order Items Stock Out Callback** - triggered when item stock out request is processed generated due to an order having an already stocked out item (specific to Swiggy)
* **Order Relay** - triggered as soon as an order is placed on our system.
* **Order Status Update** - triggered as soon as the status of an order changes on our system.
* **Rider Status Update** - triggered as soon as the status of rider for an order changes on our system.

The usage of all of the above webhooks is respectively available in the touchpoints we have explained in the next pages. You can set up the webhooks through the [end-point described in the API documentation](/downstream/api/endpoints/setting-up-webhooks.md). Alternatively, you may also follow the below steps to add the webhooks manually:

* Log in to Atlas and move to *Settings* --> *Webhooks* on the left-hand side panel.
* Click on the *Add Webhook* button, fill in the details on the slide page and enable retry based on your requirement. If you *enable retry* select whether the retries should be in minutes or seconds.
* Click on *Create* to add the webhook.
* If you have any custom headers for the webhook, you may add the same by moving to the *Headers* section and then clicking *Add Header* button. Fill in the relevant details against the fields there. Ensure you select the right *Event Type* for the webhook.
* You may add more than one header here by clicking on the *Add Another Header* button and add the details.
* Click *Save* once all details are filled in. You can add all your webhooks one by one in this way.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api-docs.urbanpiper.com/downstream/getting-started/webhooks-callbacks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
