Client applications subscribe for webhook notifications and listen for the various events pertaining to their data in Beetexting, including; create or update contact, delete contact, and message outbound events. This API helps create or update subscription using "SubscriptionRequest" object in the request body.
https://connect.beetexting/prod/webhooksubscription
(While sending the request please make sure to append https://connect.beetexting.com/prod if the url in the cUrl command starts with /message ...)
**Note : To add the OAuth2.0 Auth Token please see the section 'OAuth2.0 For Phone.com' and 'Postman How-to for Phone.com section'
Users can subscribe to the inbound message by sending below request to Beetexting.
{
"uri": "https://callbackurl.com/",
"eventFilters": [
"/orgId//department//message?direction=inbound"
],
"expiresDateInMillies":
}
Then, Beetexting will validate by sending a GET call to the callback URL, e.g. https://callbackurl.com/ with a validation-token in the request header.
The caller should then send a response with the same validation-token in the response header with https 200 status. If the response header validation-token matches with the request-header validation-token that we sent, we will then send below response for the create subscription call as below:
{
"id": "",
"uri": "https://callbackurl.com",
"eventFilters": [
"/orgId//department//message?direction=inbound"
],
"disabledFilters": [
{
"filter": "string",
"reason": "string",
"message": "string",
"orgId": "string",
"id": "string"
}
],
"expirationTime": "2024-03-10T18:07:52.534Z",
"expiresIn": ,
"status": "ACTIVE",
"createdDateTime": "2023-06-10T18:07:52.534Z",
"lastUpdateDateTime": "2023-06-10T20:07:52.534Z",
"orgId": ""
}
With this, now the user has subscribed to get notification for any inbound/oubound messages.
Once an Inbound message comes Beetexting will send the following payload to the above mentioned uri.
See below the sample payload for the inbound message
{
"uuid": "",
"timestamp": 1704067200000,
"event": " "/orgId//department//message?direction=inbound",
"subscriptionId": "",
"messageInfo": {
"organizationId": "",
"departmentId": "",
"lastUpdated": 1704067200000,
"messageId": "",
"carrierMessageId": "",
"status": ""
}
}
Using the messageId part of the above payload, user can call the below end point to get the message details.
{
"id": "",
"owner": "user@example.com",
"time": "2024-01-01T12:00:00Z",
"direction": "in",
"to": [
"",
""
],
"from": "",
"text": "",
"media": [
""
],
"attachments": [
""
]
}
{
"id": "67070af782b96f464c18bc7b",
"owner": null,
"time": null,
"direction": "in",
"to": [
"+112353623623"
],
"from": "",
"text": "Hi ",
"media": [],
"attachments": []
}
curl --location --request POST '/webhooksubscription' \
--header 'x-api-key: HvG7OZaxgz3raDMzX9CYp9105hV9VwDa6zrCS234' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"uri": "https://beetexting.com",
"eventFilters": [
"/orgId/<organizationId>/department/<departmentId>/contact",
"/orgId/<organizationId>/department/<departmentId>/message?direction=outbound"
],
"expiresDateInMillies": 0
}'{
"id": "string",
"uri": "string",
"eventFilters": [
"string"
],
"disabledFilters": [
{
"filter": "string",
"reason": "string",
"message": "string",
"orgId": "string",
"id": "string"
}
],
"expirationTime": "2024-03-10T18:07:52.534Z",
"expiresIn": 0,
"status": "ACTIVE",
"createdDateTime": "2023-06-10T18:07:52.534Z",
"lastUpdateDateTime": "2023-06-10T20:07:52.534Z",
"orgId": "string"
}