Webhooks

Use the webhooks resource to manage the webhooks configured in your stores.

The following table describes the different contents of the Webhooks resource:

API ResourceEndpointEndpoint Description
GET webhook/{event}Returns the webhooks configured for all the stores of the authenticated client
PUT webhook/{event}/add-storesAdd stores to a specific webhook event
PUT webhook/{event}/change-urlChange url from stores
POST webhookCreates a new webhook for a list of stores for the authenticated client
DELETE webhook/{event}/remove-storesDeletes stores from your webhook
PUT webhook/{event}/reset-secretRestarts the secret and generates a new one for the authenticated client
PUT webhook/{event}/change-statusEnables or disables the webhooks for a list of stores

GET webhook

Use this endpoint to retrieve the webhooks configured for your stores.

Endpoint URL

Use this URL to make a request with this endpoint:

https://{COUNTRY_DOMAIN}/api/v2/restaurants-integrations-public-api/webhook/{EVENT}

Sample Request

This is an example of an API request using this endpoint:

GET https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook

This is an example of the request:

URL url = new URL("https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("x-authorization", "Bearer YOUR_TOKEN"); try (BufferedReader br = new BufferedReader( new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { StringBuilder response = new StringBuilder(); String responseLine; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } System.out.println("Response body: " + response.toString()); } System.out.println("Response Code : " + connection.getResponseCode());



Endpoint Properties

This resource has the following properties:

Response formatsJSON
Authentication requirementsToken

Parameters

ParameterRequirementDescription
event
string
optionalReturns only the details from a specific event

Status Codes

These are the possible status codes of the response for this endpoint:

Sample Response

This is an example of the response:

[ { "event": "event_1", "stores": [ { "store_id": "1000", "url": "http://testUrl/one", "state": "ENABLE" }, { "store_id": "10001", "url": "http://testUrl/one", "state": "ENABLE" } ] }, { "event": "event_2", "stores": [ { "store_id": "1000", "url": "http://testUrl/one", "state": "ENABLE" } ] } ]

This table describes the objects contained in the response example:

Response ObjectObject Description
event
string
Name of the event that triggers the webhook.
stores
array of Stores
List of the stores where the event triggers.
store_id
string
Store id where the event triggers
url
string
URL to which the webhook communicates.
state
string
Status of the webhook. Options available: ENABLE or DISABLE

PUT webhook Add Stores

Use this endpoint to add stores to the webhook event specified.

Endpoint URL

Use this URL to make a request with this endpoint:

https://{COUNTRY_DOMAIN}/api/v2/restaurants-integrations-public-api/webhook/{event}/add-stores

Endpoint Properties

This resource has the following properties:

Response formatsJSON
Request body requirementsJSON
Authentication requirementsToken

Parameters

ParameterRequirementDescription
event
string
requiredThe event name to update

Status Codes

These are the possible status codes of the response for this endpoint:

Sample Request

This is an example of an API request using this endpoint:

PUT https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/add-stores

This is an example of the request:

[ { "url": "http://testDomain/webhook/data", "stores": ["1000", "1001"] } ]
URL url = new URL("https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/add-stores"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("PUT"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("x-authorization", "Bearer YOUR_TOKEN"); connection.setDoOutput(true); String jsonInputString = "[{\n" + " \"url\":\"http://testDomain/webhook/data\",\n" + " \"stores\":[\n" + " \"1000\",\n" + " \"1001\"\n" + " ]\n" + "}]"; try (OutputStream os = connection.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); } try (BufferedReader br = new BufferedReader( new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { StringBuilder response = new StringBuilder(); String responseLine; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } System.out.println("Response body: " + response.toString()); } System.out.println("Response Code : " + connection.getResponseCode());



This table describes the attributes that the JSON of your request requires:

AttributesRequirementDescription
url
string
requiredURL to which the webhook communicates.
stores
array of strings
requiredList of the stores where the event triggers.

Sample Response

This is an example of the response:

{ "event": "NEW_ORDER", "stores": [ { "store_id": "1000", "url": "http://testDomain/webhook/data", "state": "ENABLE" } ] }

This table describes the objects contained in the response example:

Response ObjectObject Description
event
string
Name of the event that triggers the webhook.
stores
array of Stores
List of the stores where the event triggers.
store_id
string
Store id where the event triggers
url
string
URL to which the webhook communicates.
state
string
Status of the webhook. Options available: ENABLE or DISABLE

PUT webhook Change Url

Use this endpoint to update the url of the webhook event specified.

Endpoint URL

Use this URL to make a request with this endpoint:

https://{COUNTRY_DOMAIN}/api/v2/restaurants-integrations-public-api/webhook/{event}/change-url

Endpoint Properties

This resource has the following properties:

Response formatsJSON
Request body requirementsJSON
Authentication requirementsToken

Parameters

ParameterRequirementDescription
event
string
requiredThe event name to update

Status Codes

These are the possible status codes of the response for this endpoint:

Sample Request

This is an example of an API request using this endpoint:

PUT https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/change-url

This is an example of the request:

{ "url": "http://testDomain/webhook/data", "stores": ["1000", "1001"] }
URL url = new URL("https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/change-url"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("PUT"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("x-authorization", "Bearer YOUR_TOKEN"); connection.setDoOutput(true); String jsonInputString = "{\n" + " \"url\":\"http://testDomain/webhook/data\",\n" + " \"stores\":[\n" + " \"1000\",\n" + " \"1001\"\n" + " ]\n" + "}"; try (OutputStream os = connection.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); } try (BufferedReader br = new BufferedReader( new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { StringBuilder response = new StringBuilder(); String responseLine; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } System.out.println("Response body: " + response.toString()); } System.out.println("Response Code : " + connection.getResponseCode());



This table describes the attributes that the JSON of your request requires:

AttributesRequirementDescription
url
string
requiredURL to which the webhook communicates.
stores
array of strings
requiredList of the stores where the event triggers.

Sample Response

This is an example of the response:

{ "event": "NEW_ORDER", "stores": [ { "store_id": "1000", "url": "http://testDomain/webhook/data", "state": "ENABLE" } ] }

This table describes the objects contained in the response example:

Response ObjectObject Description
event
string
Name of the event that triggers the webhook.
stores
array of Stores
List of the stores where the event triggers.
store_id
string
Store id where the event triggers
url
string
URL to which the webhook communicates.
state
string
Status of the webhook. Options available: ENABLE or DISABLE

POST webhook

Use this endpoint to create a webhook for your stores.

Endpoint URL

Use this URL to make a request with this endpoint:

https://{COUNTRY_DOMAIN}/api/v2/restaurants-integrations-public-api/webhook

{COUNTRY_DOMAIN}: This is your Rappi country domain. See the list of country domains.

Endpoint Properties

This resource has the following properties:

Response formatsJSON
Request body requirementsJSON
Authentication requirementsToken

Parameters

This endpoint does not permit additional parameters.

Status Codes

These are the possible status codes of the response for this endpoint:

Sample Request

This is an example of an API request using this endpoint:

POST https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook

This is an example of the request:

{ "event": "test_event", "data": [ { "url": "http://testDomain/webhook/data", "stores": ["1000", "1001"] } ] }
URL url = new URL("https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("x-authorization", "Bearer YOUR_TOKEN"); connection.setDoOutput(true); String jsonInputString = "{\n" + " \"event\":\"test_event\",\n" + " \"data\": [ {" + " \"url\":\"http://testDomain/webhook/data\",\n" + " \"stores\":[\n" + " \"1000\",\n" + " \"1001\"\n" + " ]\n" + " } ]" + "}"; try (OutputStream os = connection.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); } try (BufferedReader br = new BufferedReader( new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { StringBuilder response = new StringBuilder(); String responseLine; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } System.out.println("Response body: " + response.toString()); } System.out.println("Response Code : " + connection.getResponseCode());



This table describes the attributes that the JSON of your request requires:

AttributesRequirementDescription
event
string
requiredEvent that triggers the webhook.
url
string
requiredURL to which the webhook communicates.
data
array of Object
requiredContains the attributes to configure
stores
array of strings
optionalList of the stores where the event triggers. If you don't send this attribute, the API takes all the stores of the authenticated user.

Sample Response

This is an example of the response:

{ "event": "test_1", "stores": [ { "url": "https://localhost:8080/test", "store_id": "1000", "state": "ENABLE" }, { "url": "https://localhost:8080/test", "store_id": "1001", "state": "ENABLE" } ], "secret": "TEST_SECRET" }

This table describes the objects contained in the response example:

Response ObjectObject Description
event
string
Name of the event that triggers the webhook.
stores
array of Store
List of the stores where the event triggers
url
string
URL to which the webhook communicates.
store_id
string
Store id where the event triggers
state
string
Status of the webhook. Options available: ENABLE or DISABLE
secret
string
Secret key to create the security signature for every webhook event post.

DELETE webhook

Use this endpoint to delete a store from your webhook.

Endpoint URL

Use this URL to make a request with this endpoint:

https://{COUNTRY_DOMAIN}/api/v2/restaurants-integrations-public-api/webhook/{EVENT}/remove-stores

Endpoint Properties

This resource has the following properties:

Response formatsJSON
Request body requirementsJSON
Authentication requirementsToken

Parameters

ParameterRequirementDescription
event
string
requiredThe event name to update

Status Codes

These are the possible status codes of the response for this endpoint:

Sample Request

This is an example of an API request using this endpoint:

DELETE https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/remove-stores

This is an example of the request:

{ "stores": ["1000"] }
URL url = new URL("https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/remove-stores"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("DELETE"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("x-authorization", "Bearer YOUR_TOKEN"); connection.setDoOutput(true); String jsonInputString = "{\n" + " \"stores\":[\n" + " \"1000\"\n" + " ]\n" + "}"; try (OutputStream os = connection.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); } try (BufferedReader br = new BufferedReader( new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { StringBuilder response = new StringBuilder(); String responseLine; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } System.out.println("Response body: " + response.toString()); } System.out.println("Response Code : " + connection.getResponseCode());



This table describes the attributes that the JSON of your request requires:

AttributesRequirementDescription
stores
array of strings
requiredList of the stores to delete the webhook from

Sample Response

This is an example of the response:

{ "stores": ["1000"], "message": "Store settings removed successfully." }

This table describes the objects contained in the response example:

Response ObjectObject Description
stores
array of strings
List of the stores where the event triggers.
message
string
Output message of the request.

PUT webhook reset secret

Use this endpoint to reset the secret, and create a new one for the authenticated ally.

Endpoint URL

Use this URL to make a request with this endpoint:

https://{COUNTRY_DOMAIN}/api/v2/restaurants-integrations-public-api/webhook/{EVENT}/reset-secret

Endpoint Properties

This resource has the following properties:

Response formatsJSON
Request body requirementsJSON
Authentication requirementsToken

Parameters

ParameterRequirementDescription
event
string
requiredThe webhook event name to update

Status Codes

These are the possible status codes of the response for this endpoint:

Sample Request

This is an example of an API request using this endpoint:

PUT https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/reset-secret

This is an example of the request:

URL url = new URL("https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/reset-secret"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("PUT"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("x-authorization", "Bearer YOUR_TOKEN"); connection.setDoOutput(true); try (BufferedReader br = new BufferedReader( new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { StringBuilder response = new StringBuilder(); String responseLine; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } System.out.println("Response body: " + response.toString()); } System.out.println("Response Code : " + connection.getResponseCode());



Sample Response

This is an example of the response:

{ "event": "NEW_ORDER", "stores": [ { "store_id": "1000", "url": "http://localhost", "state": "ENABLE" } ], "secret": "NEW_SECRET" }

This table describes the objects contained in the response example:

Response ObjectObject Description
event
string
Name of the event that triggers the webhook.
stores
array of Stores
List of the stores where the event triggers.
store_id
string
Store id where the event triggers
url
string
URL to which the webhook communicates.
state
string
Status of the webhook. Options available: ENABLE or DISABLE
secret
string
New secret key to use when creating the security signature for a webhook event post.

PUT webhook change status

Use this endpoint to change the availability state of a configured webhook.

Endpoint URL

Use this URL to make a request with this endpoint:

https://{COUNTRY_DOMAIN}/api/v2/restaurants-integrations-public-api/webhook/{EVENT}/change-status

Endpoint Properties

This resource has the following properties:

Response formatsJSON
Request body requirementsJSON
Authentication requirementsToken

Parameters

This endpoint does not permit additional parameters.

Status Codes

These are the possible status codes of the response for this endpoint:

Sample Request

This is an example of an API request using this endpoint:

PUT https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/change-status

This is an example of the request:

{ "stores": { "enable": ["1001"], "disable": ["1000"] } }
URL url = new URL("https://microservices.dev.rappi.com/api/v2/restaurants-integrations-public-api/webhook/NEW_ORDER/change-status"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("PUT"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("x-authorization", "Bearer YOUR_TOKEN"); connection.setDoOutput(true); String jsonInputString = "{\"stores\": {\"enable\": [\"1001\"],\"disable\": [\"1000\" ] } }"; try (OutputStream os = connection.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); } try (BufferedReader br = new BufferedReader( new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { StringBuilder response = new StringBuilder(); String responseLine; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } System.out.println("Response body: " + response.toString()); } System.out.println("Response Code : " + connection.getResponseCode());



This table describes the attributes that the JSON of your request requires:

AttributesRequirementDescription
stores
Object
requiredObject that contains the list of the stores to enable or disable
enable
array of strings
requiredList of the stores to enable
disable
array of strings
requiredList of the stores to disable

Sample Response

This is an example of the response:

{ "event": "NEW_ORDER", "stores": [ { "store_id": "1001", "url": "http://localhost", "state": "ENABLE" }, { "store_id": "1000", "url": "http://localhost", "state": "ENABLE" } ] }

This table describes the objects contained in the response example:

Response ObjectObject Description
event
string
Name of the event that triggers the webhook.
stores
array of Stores
List of the stores where the event triggers.
store_id
string
Store id where the event triggers
url
string
URL to which the webhook communicates.
state
string
Status of the webhook. Options available: ENABLE or DISABLE