Skip to main content

Post SMS – Webhook

The SMS Webhook endpoint allows you to receive and process status updates for previously initiated verification via SMS message. This endpoint enables your system to be notified when a verification process has been completed successfully or has failed.

Configure the API Endpoint

https://api.betatel.com/api/v1/connect-hub/sms/webhook
  • Method: POST

Set Up the Headers

ParamValueDescription
Content-typeapplication/jsonSpecifies the payload format.
x-api-key{{x-api-key}}API key for authorization.
x-user-id{{x-user-id}}User identifier for added security and tracking.

Craft the Request Body

Design the JSON payload to include the message ID and the status of the verification process.

Example of body
{
"id": "4a33face-9f15-56f0-122f-d66d6729679c0",
"status": "Success"
}
FieldTypeRequiredDescription
idstringYesThe unique identifier of the SMS message received in the initial response.
statusstringYesThe status of the SMS verification process ("Success" or "Failed").

Code Snippets

Example - cURL
curl --location 'https://api.betatel.com/api/v1/connect-hub/sms/webhook' \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-user-id: YOUR_USER_ID' \
--data '{
"id":"4a33face-9f15-56f0-122f-d66d6729679c0",
"status":"Success"
}'

Understanding the Response

Once the API processes your request, it returns a response containing the unique identifier, status, and a message indicating the result of the webhook processing.

JSON Schema:

{
"id": "0a62face-6d15-11f0-962f-d89d6729654c",
"status": "Success",
"message": "OK"
}
  • id: The unique identifier for the message.
  • status: The status of the SMS verification process ("Success" or "Failed").
  • message: Indicates the result of the webhook processing.

Error Handling

  • 400 - Bad Request: Invalid parameters or malformed request
  • 401 - Unauthorized: Authentication failed
  • 404 - Not Found: The specified message id does not exist
  • 500 - Internal Server Error: An unexpected error occurred on the server