> Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Webhooks provide a mechanism for you to be notified of events in our systems. You can learn more about the type of event notifications we publish as well as general development guidelines in our [webhook integration guide](./webhooks/webhooks-integration-guide.html).
__NOTE:__ Notifications are not enabled by default. Please work with your [support team](mailto:support@flexengage.com)
to enable notifications for the events you are interested in.
Base URLs:
* https://api.flexengage-test.com
* https://api.flexengage.com
Email: FlexEngage Support
# Authentication
- HTTP Authentication, scheme: bearer
Webhooks
## Create a New Webhook
> Code samples
```shell
# You can also use wget
curl -X POST https://api.flexengage-test.com/v1/{brandId}/webhooks \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
```
```java
URL obj = new URL("https://api.flexengage-test.com/v1/{brandId}/webhooks");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```
```csharp
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
/// <>
/// Example of Http Client
/// <>
public class HttpExample
{
private HttpClient Client { get; set; }
/// <>
/// Setup http client
/// <>
public HttpExample()
{
Client = new HttpClient();
}
/// Make a dummy request
public async Task MakePostRequest()
{
string url = "https://api.flexengage-test.com/v1/{brandId}/webhooks";
string json = @"{
""endpoint"": ""https://example.com/my/webhook/endpoint"",
""events"": [
""NOTIFICATION.SMS.RECEIPT""
],
""enabled"": true
}";
WebhookRequest content = JsonConvert.DeserializeObject(json);
await PostAsync(content, url);
}
/// Performs a POST Request
public async Task PostAsync(WebhookRequest content, string url)
{
//Serialize Object
StringContent jsonContent = SerializeObject(content);
//Execute POST request
HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
}
/// Serialize an object to Json
private StringContent SerializeObject(WebhookRequest content)
{
//Serialize Object
string jsonObject = JsonConvert.SerializeObject(content);
//Create Json UTF8 String Content
return new StringContent(jsonObject, Encoding.UTF8, "application/json");
}
/// Deserialize object from request response
private async Task DeserializeObject(HttpResponseMessage response)
{
//Read body
string responseBody = await response.Content.ReadAsStringAsync();
//Deserialize Body to object
var result = JsonConvert.DeserializeObject(responseBody);
}
}
```
```python
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.flexengage-test.com/v1/{brandId}/webhooks', headers = headers)
print(r.json())
```
`POST /v1/{brandId}/webhooks`
This endpoint is used to create a new Webhook. Webhooks are enabled by default once they are created, but can be disabled using the PATCH API.
A Webhook is essentially a HTTPS endpoint + a list of event types that you'd like to receive for that endpoint. Event types are organized in a heirarchical manner which allows you to subscribe to groups of event types without having to list each one out individually when you create the Webhook.
Please see our [Webhooks Integration Guide](./webhooks/webhooks-integration-guide.html) for a deeper explanation of event types.
> Body parameter
```json
{
"endpoint": "https://example.com/my/webhook/endpoint",
"events": [
"NOTIFICATION.SMS.RECEIPT"
],
"enabled": true
}
```
Parameters
|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[WebhookRequest](#schemawebhookrequest)|true|none|
|brandId|path|string|true|This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.|
#### Detailed descriptions
**brandId**: This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.
> Example responses
> 201 Response
```json
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created": "2019-08-24T14:15:22Z",
"updated": "2019-08-24T14:15:22Z",
"endpoint": "https://example.com/my/webhook/endpoint",
"events": [
"NOTIFICATION.SMS.RECEIPT"
],
"enabled": true
}
```
> 409 Response
```json
{
"message": "CONFLICT",
"description": "A webhook for endpoint: http://example.com and eventTypes: [\"ORDER_EVENTS.OMS.ORDER_CREATED\"] already exists",
"status": 409
}
```
> 422 Response
```json
{
"message": "UNPROCESSABLE ENTITY",
"description": "There are errors in the request",
"status": 422,
"validations": {
"endpoint": "endpoint is required"
}
}
```
> 500 Response
```json
{
"message": "Internal Server Error",
"description": "The server encountered an unexpected error.",
"status": 500
}
```
Responses
|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|The webhook was successfully created|[WebhookResponse](#schemawebhookresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.|None|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.|None|
|409|[Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8)|A Webhook already exists for the same endpoint with the same event types.|[APIErrorResponse](#schemaapierrorresponse)|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|There is an error in the request. See the response body for more details.|[APIErrorResponse](#schemaapierrorresponse)|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|The user has sent too many requests in a given amount of time ("rate limiting").
If you are rate-limited in any way you will receive a 429 status code, at which point your client application should respond with exponential backoff or a similar throttling measure. In general our limits are high enough that non-abusive request patterns will not trigger them.|None|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|A server encountered an unexpected condition that prevented it from fulfilling the request please retry again your request.|[APIErrorResponse](#schemaapierrorresponse)|
### Response Headers
|Status|Header|Type|Format|Description|
|---|---|---|---|---|
|201|Location|string|uri|none|
## Get Webhooks
> Code samples
```shell
# You can also use wget
curl -X GET https://api.flexengage-test.com/v1/{brandId}/webhooks \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
```
```java
URL obj = new URL("https://api.flexengage-test.com/v1/{brandId}/webhooks");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```
```csharp
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
/// <>
/// Example of Http Client
/// <>
public class HttpExample
{
private HttpClient Client { get; set; }
/// <>
/// Setup http client
/// <>
public HttpExample()
{
Client = new HttpClient();
}
/// Make a dummy request
public async Task MakeGetRequest()
{
string url = "https://api.flexengage-test.com/v1/{brandId}/webhooks";
var result = await GetAsync(url);
}
/// Performs a GET Request
public async Task GetAsync(string url)
{
//Start the request
HttpResponseMessage response = await Client.GetAsync(url);
//Validate result
response.EnsureSuccessStatusCode();
}
/// Deserialize object from request response
private async Task DeserializeObject(HttpResponseMessage response)
{
//Read body
string responseBody = await response.Content.ReadAsStringAsync();
//Deserialize Body to object
var result = JsonConvert.DeserializeObject(responseBody);
}
}
```
```python
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.flexengage-test.com/v1/{brandId}/webhooks', headers = headers)
print(r.json())
```
`GET /v1/{brandId}/webhooks`
Returns all webhooks for a Brand ID
Parameters
|Name|In|Type|Required|Description|
|---|---|---|---|---|
|brandId|path|string|true|This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.|
#### Detailed descriptions
**brandId**: This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.
> Example responses
> 200 Response
```json
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created": "2019-08-24T14:15:22Z",
"updated": "2019-08-24T14:15:22Z",
"endpoint": "https://example.com/my/webhook/endpoint",
"events": [
"NOTIFICATION.SMS.RECEIPT"
],
"enabled": true
}
]
```
> 404 Response
```json
{
"message": "NOT FOUND",
"description": "No webhooks with that brand ID were found",
"status": 404
}
```
> 500 Response
```json
{
"message": "Internal Server Error",
"description": "The server encountered an unexpected error.",
"status": 500
}
```
Responses
|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|A list of webhooks, if any, affiliated with the Brand ID.|Inline|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.|None|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.|None|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|No brand or webhooks were found|[APIErrorResponse](#schemaapierrorresponse)|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|The user has sent too many requests in a given amount of time ("rate limiting").
If you are rate-limited in any way you will receive a 429 status code, at which point your client application should respond with exponential backoff or a similar throttling measure. In general our limits are high enough that non-abusive request patterns will not trigger them.|None|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|A server encountered an unexpected condition that prevented it from fulfilling the request please retry again your request.|[APIErrorResponse](#schemaapierrorresponse)|
Response Schema
Status Code **200**
|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|*anonymous*|[[WebhookResponse](#schemawebhookresponse)]|false|none|none|
|» id|string(uuid)|false|none|none|
|» created|string(date-time)|false|none|none|
|» updated|string(date-time)|false|none|none|
|» endpoint|string(uri)|false|none|none|
|» events|[[Events](#schemaevents)]|false|none|none|
|» enabled|boolean|false|none|none|
## Get a webhook by ID
> Code samples
```shell
# You can also use wget
curl -X GET https://api.flexengage-test.com/v1/{brandId}/webhooks/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
```
```java
URL obj = new URL("https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```
```csharp
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
/// <>
/// Example of Http Client
/// <>
public class HttpExample
{
private HttpClient Client { get; set; }
/// <>
/// Setup http client
/// <>
public HttpExample()
{
Client = new HttpClient();
}
/// Make a dummy request
public async Task MakeGetRequest()
{
string url = "https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}";
var result = await GetAsync(url);
}
/// Performs a GET Request
public async Task GetAsync(string url)
{
//Start the request
HttpResponseMessage response = await Client.GetAsync(url);
//Validate result
response.EnsureSuccessStatusCode();
}
/// Deserialize object from request response
private async Task DeserializeObject(HttpResponseMessage response)
{
//Read body
string responseBody = await response.Content.ReadAsStringAsync();
//Deserialize Body to object
var result = JsonConvert.DeserializeObject(responseBody);
}
}
```
```python
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}', headers = headers)
print(r.json())
```
`GET /v1/{brandId}/webhooks/{id}`
Returns a Webhook with the corresponding ID if it exists
Parameters
|Name|In|Type|Required|Description|
|---|---|---|---|---|
|brandId|path|string|true|This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.|
|id|path|string(uuid)|true|The webhook ID|
#### Detailed descriptions
**brandId**: This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.
> Example responses
> 200 Response
```json
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created": "2019-08-24T14:15:22Z",
"updated": "2019-08-24T14:15:22Z",
"endpoint": "https://example.com/my/webhook/endpoint",
"events": [
"NOTIFICATION.SMS.RECEIPT"
],
"enabled": true
}
```
> 404 Response
```json
{
"message": "NOT FOUND",
"description": "A webhook with ID: 123 for brandId: ABC was not found",
"status": 404
}
```
> 500 Response
```json
{
"message": "Internal Server Error",
"description": "The server encountered an unexpected error.",
"status": 500
}
```
Responses
|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|An object representing the webhook with corresponding ID|[WebhookResponse](#schemawebhookresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.|None|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.|None|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|The brand or webhook could not be found|[APIErrorResponse](#schemaapierrorresponse)|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|The user has sent too many requests in a given amount of time ("rate limiting").
If you are rate-limited in any way you will receive a 429 status code, at which point your client application should respond with exponential backoff or a similar throttling measure. In general our limits are high enough that non-abusive request patterns will not trigger them.|None|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|A server encountered an unexpected condition that prevented it from fulfilling the request please retry again your request.|[APIErrorResponse](#schemaapierrorresponse)|
## Toggle a Webhook On or Off
> Code samples
```shell
# You can also use wget
curl -X PATCH https://api.flexengage-test.com/v1/{brandId}/webhooks/{id} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
```
```java
URL obj = new URL("https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```
```csharp
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
/// <>
/// Example of Http Client
/// <>
public class HttpExample
{
private HttpClient Client { get; set; }
/// <>
/// Setup http client
/// <>
public HttpExample()
{
Client = new HttpClient();
}
/// Deserialize object from request response
private async Task DeserializeObject(HttpResponseMessage response)
{
//Read body
string responseBody = await response.Content.ReadAsStringAsync();
//Deserialize Body to object
var result = JsonConvert.DeserializeObject(responseBody);
}
}
```
```python
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.patch('https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}', headers = headers)
print(r.json())
```
`PATCH /v1/{brandId}/webhooks/{id}`
This request allows you to turn a Webhook off without deleting it, or turn it back on if it was turned off.
> Body parameter
```json
{
"enabled": true
}
```
Parameters
|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[WebhookPatchRequest](#schemawebhookpatchrequest)|true|none|
|brandId|path|string|true|This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.|
|id|path|string(uuid)|true|The webhook ID|
#### Detailed descriptions
**brandId**: This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.
> Example responses
> 204 Response
```json
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"created": "2019-08-24T14:15:22Z",
"updated": "2019-08-24T14:15:22Z",
"endpoint": "https://example.com/my/webhook/endpoint",
"events": [
"NOTIFICATION.SMS.RECEIPT"
],
"enabled": true
}
```
> 404 Response
```json
{
"message": "NOT FOUND",
"description": "No webhook with that brand ID was found",
"status": 404
}
```
> 500 Response
```json
{
"message": "Internal Server Error",
"description": "The server encountered an unexpected error.",
"status": 500
}
```
Responses
|Status|Meaning|Description|Schema|
|---|---|---|---|
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|An object representing the Webhook that was successfully modified.|[WebhookResponse](#schemawebhookresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.|None|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.|None|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|No brand or webhook was found|[APIErrorResponse](#schemaapierrorresponse)|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|The user has sent too many requests in a given amount of time ("rate limiting").
If you are rate-limited in any way you will receive a 429 status code, at which point your client application should respond with exponential backoff or a similar throttling measure. In general our limits are high enough that non-abusive request patterns will not trigger them.|None|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|A server encountered an unexpected condition that prevented it from fulfilling the request please retry again your request.|[APIErrorResponse](#schemaapierrorresponse)|
## Delete a Webhook
> Code samples
```shell
# You can also use wget
curl -X DELETE https://api.flexengage-test.com/v1/{brandId}/webhooks/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
```
```java
URL obj = new URL("https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```
```csharp
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
/// <>
/// Example of Http Client
/// <>
public class HttpExample
{
private HttpClient Client { get; set; }
/// <>
/// Setup http client
/// <>
public HttpExample()
{
Client = new HttpClient();
}
/// Make a dummy request
public async Task MakeDeleteRequest()
{
int id = 1;
string url = "https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}";
await DeleteAsync(id, url);
}
/// Performs a DELETE Request
public async Task DeleteAsync(int id, string url)
{
//Execute DELETE request
HttpResponseMessage response = await Client.DeleteAsync(url + $"/{id}");
//Return response
await DeserializeObject(response);
}
/// Deserialize object from request response
private async Task DeserializeObject(HttpResponseMessage response)
{
//Read body
string responseBody = await response.Content.ReadAsStringAsync();
//Deserialize Body to object
var result = JsonConvert.DeserializeObject(responseBody);
}
}
```
```python
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}', headers = headers)
print(r.json())
```
`DELETE /v1/{brandId}/webhooks/{id}`
Completely deletes a Webhook if it exists.
Parameters
|Name|In|Type|Required|Description|
|---|---|---|---|---|
|brandId|path|string|true|This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.|
|id|path|string(uuid)|true|The webhook ID|
#### Detailed descriptions
**brandId**: This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.
> Example responses
> 404 Response
```json
{
"message": "NOT FOUND",
"description": "No webhooks with that brand ID were found",
"status": 404
}
```
> 500 Response
```json
{
"message": "Internal Server Error",
"description": "The server encountered an unexpected error.",
"status": 500
}
```
Responses
|Status|Meaning|Description|Schema|
|---|---|---|---|
|204|[No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5)|The webhook was deleted successfully|None|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.|None|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.|None|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|No brand or webhook was found|[APIErrorResponse](#schemaapierrorresponse)|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|The user has sent too many requests in a given amount of time ("rate limiting").
If you are rate-limited in any way you will receive a 429 status code, at which point your client application should respond with exponential backoff or a similar throttling measure. In general our limits are high enough that non-abusive request patterns will not trigger them.|None|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|A server encountered an unexpected condition that prevented it from fulfilling the request please retry again your request.|[APIErrorResponse](#schemaapierrorresponse)|
## Get the Events of a Webhook
> Code samples
```shell
# You can also use wget
curl -X GET https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
```
```java
URL obj = new URL("https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```
```csharp
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
/// <>
/// Example of Http Client
/// <>
public class HttpExample
{
private HttpClient Client { get; set; }
/// <>
/// Setup http client
/// <>
public HttpExample()
{
Client = new HttpClient();
}
/// Make a dummy request
public async Task MakeGetRequest()
{
string url = "https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events";
var result = await GetAsync(url);
}
/// Performs a GET Request
public async Task GetAsync(string url)
{
//Start the request
HttpResponseMessage response = await Client.GetAsync(url);
//Validate result
response.EnsureSuccessStatusCode();
}
/// Deserialize object from request response
private async Task DeserializeObject(HttpResponseMessage response)
{
//Read body
string responseBody = await response.Content.ReadAsStringAsync();
//Deserialize Body to object
var result = JsonConvert.DeserializeObject(responseBody);
}
}
```
```python
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events', headers = headers)
print(r.json())
```
`GET /v1/{brandId}/webhooks/{id}/events`
This API allows you to fetch a paginated list of events that have been sent to a Webhook endpoint.
When the response contains multiple pages, the next page of results can be accessed by passing the attribute `page.lastId` as the query parameter `startId`.
Parameters
|Name|In|Type|Required|Description|
|---|---|---|---|---|
|brandId|path|string|true|This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.|
|id|path|string(uuid)|true|The webhook ID|
|size|query|integer|false|The page size|
|start|query|string(date-time)|false|The query start time|
|end|query|string(date-time)|false|The query end time|
|startId|query|string(uuid)|false|The event ID used to start the page|
#### Detailed descriptions
**brandId**: This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.
> Example responses
> 200 Response
```json
{
"events": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"type": "NOTIFICATION.SMS.RECEIPT",
"created": "2019-08-24T14:15:22Z",
"updated": "2019-08-24T14:15:22Z",
"status": "SUCCESS"
}
],
"page": {
"size": 20,
"startId": "98f9f126-53de-4f4b-b662-04f587841743",
"lastId": "5d237c8b-b229-4873-82bc-27c473efbd3c"
}
}
```
> 404 Response
```json
{
"message": "NOT FOUND",
"description": "No webhook with that brand ID was found",
"status": 404
}
```
> 500 Response
```json
{
"message": "Internal Server Error",
"description": "The server encountered an unexpected error.",
"status": 500
}
```
Responses
|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The events were returned successfully|[WebhookEventsResponsePage](#schemawebhookeventsresponsepage)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.|None|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.|None|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|No brand or webhook was found|[APIErrorResponse](#schemaapierrorresponse)|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|The user has sent too many requests in a given amount of time ("rate limiting").
If you are rate-limited in any way you will receive a 429 status code, at which point your client application should respond with exponential backoff or a similar throttling measure. In general our limits are high enough that non-abusive request patterns will not trigger them.|None|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|A server encountered an unexpected condition that prevented it from fulfilling the request please retry again your request.|[APIErrorResponse](#schemaapierrorresponse)|
## Get a webhook event by ID
> Code samples
```shell
# You can also use wget
curl -X GET https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events/{eventId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
```
```java
URL obj = new URL("https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events/{eventId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```
```csharp
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
/// <>
/// Example of Http Client
/// <>
public class HttpExample
{
private HttpClient Client { get; set; }
/// <>
/// Setup http client
/// <>
public HttpExample()
{
Client = new HttpClient();
}
/// Make a dummy request
public async Task MakeGetRequest()
{
string url = "https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events/{eventId}";
var result = await GetAsync(url);
}
/// Performs a GET Request
public async Task GetAsync(string url)
{
//Start the request
HttpResponseMessage response = await Client.GetAsync(url);
//Validate result
response.EnsureSuccessStatusCode();
}
/// Deserialize object from request response
private async Task DeserializeObject(HttpResponseMessage response)
{
//Read body
string responseBody = await response.Content.ReadAsStringAsync();
//Deserialize Body to object
var result = JsonConvert.DeserializeObject(responseBody);
}
}
```
```python
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events/{eventId}', headers = headers)
print(r.json())
```
`GET /v1/{brandId}/webhooks/{id}/events/{eventId}`
This request returns a specific webhook event.
Each event will contain a list of attempts which in turn contain the response returned by the respective webhook's endpoint (if there was one).
Parameters
|Name|In|Type|Required|Description|
|---|---|---|---|---|
|brandId|path|string|true|This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.|
|id|path|string(uuid)|true|The webhook ID|
|eventId|path|string(uuid)|true|The event ID|
#### Detailed descriptions
**brandId**: This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.
> Example responses
> 200 Response
```json
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"type": "NOTIFICATION.SMS.RECEIPT",
"created": "2019-08-24T14:15:22Z",
"updated": "2019-08-24T14:15:22Z",
"status": "SUCCESS",
"attempts": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"created": "2019-08-24T14:15:22Z",
"status": "SUCCESS",
"request": {
"endpoint": "https://example.com/my/webhook/endpoint",
"headers": {
"User-Agent": "FlexEngage Webhook",
"Content-Type": "application/json"
}
},
"response": {
"statusCode": 200,
"headers": {
"Content-Type": "application/json"
},
"body": "{\"example\": \"response json\"}",
"time": 231
}
}
]
}
```
> 404 Response
```json
{
"message": "NOT FOUND",
"description": "No event with that ID was found",
"status": 404
}
```
> 500 Response
```json
{
"message": "Internal Server Error",
"description": "The server encountered an unexpected error.",
"status": 500
}
```
Responses
|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|The event was returned successfully|[WebhookEventResponse](#schemawebhookeventresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.|None|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.|None|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|The brand, webhook, or event was not found|[APIErrorResponse](#schemaapierrorresponse)|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|The user has sent too many requests in a given amount of time ("rate limiting").
If you are rate-limited in any way you will receive a 429 status code, at which point your client application should respond with exponential backoff or a similar throttling measure. In general our limits are high enough that non-abusive request patterns will not trigger them.|None|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|A server encountered an unexpected condition that prevented it from fulfilling the request please retry again your request.|[APIErrorResponse](#schemaapierrorresponse)|
## Asynchronously Retry a Webhook Event
> Code samples
```shell
# You can also use wget
curl -X POST https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events/{eventId}/retry \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
```
```java
URL obj = new URL("https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events/{eventId}/retry");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```
```csharp
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
/// <>
/// Example of Http Client
/// <>
public class HttpExample
{
private HttpClient Client { get; set; }
/// <>
/// Setup http client
/// <>
public HttpExample()
{
Client = new HttpClient();
}
/// Make a dummy request
public async Task MakePostRequest()
{
string url = "https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events/{eventId}/retry";
await PostAsync(null, url);
}
/// Performs a POST Request
public async Task PostAsync(undefined content, string url)
{
//Serialize Object
StringContent jsonContent = SerializeObject(content);
//Execute POST request
HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
}
/// Serialize an object to Json
private StringContent SerializeObject(undefined content)
{
//Serialize Object
string jsonObject = JsonConvert.SerializeObject(content);
//Create Json UTF8 String Content
return new StringContent(jsonObject, Encoding.UTF8, "application/json");
}
/// Deserialize object from request response
private async Task DeserializeObject(HttpResponseMessage response)
{
//Read body
string responseBody = await response.Content.ReadAsStringAsync();
//Deserialize Body to object
var result = JsonConvert.DeserializeObject(responseBody);
}
}
```
```python
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://api.flexengage-test.com/v1/{brandId}/webhooks/{id}/events/{eventId}/retry', headers = headers)
print(r.json())
```
`POST /v1/{brandId}/webhooks/{id}/events/{eventId}/retry`
This request will queue a Webhook event to be resent to an endpoint. Each retry will count as a new attempt.
Parameters
|Name|In|Type|Required|Description|
|---|---|---|---|---|
|brandId|path|string|true|This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.|
|id|path|string(uuid)|true|The webhook ID|
|eventId|path|string(uuid)|true|The event ID|
#### Detailed descriptions
**brandId**: This is your account identifier; we will provide this to you during the onboarding process. Please reach out to your flexEngage Customer Support Contact (support@flexengage.com) if you have not received one.
> Example responses
> 404 Response
```json
{
"message": "NOT FOUND",
"description": "No event with that ID was found",
"status": 404
}
```
> 500 Response
```json
{
"message": "Internal Server Error",
"description": "The server encountered an unexpected error.",
"status": 500
}
```
Responses
|Status|Meaning|Description|Schema|
|---|---|---|---|
|202|[Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3)|The retry request was accepted successfully.|None|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response.|None|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client's identity is known to the server.|None|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|The brand, webhook, or event was not found|[APIErrorResponse](#schemaapierrorresponse)|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|The user has sent too many requests in a given amount of time ("rate limiting").
If you are rate-limited in any way you will receive a 429 status code, at which point your client application should respond with exponential backoff or a similar throttling measure. In general our limits are high enough that non-abusive request patterns will not trigger them.|None|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|A server encountered an unexpected condition that prevented it from fulfilling the request please retry again your request.|[APIErrorResponse](#schemaapierrorresponse)|
# Schemas
APIErrorResponse
```json
{
"message": "string",
"description": "string",
"status": 0,
"validations": {}
}
```
API Error response
### Properties
|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|message|string|false|none|The error message|
|description|string|false|none|A more detailed description of the error|
|status|number|false|none|This code matches the HTTP status code.|
|validations|object|false|none|If the error is based on validation constraints, those constraints will be expressed in this map.|