Post Flash Call – Webhook
The Flash Call Webhook endpoint allows you to receive and process status updates for previously initiated flash calls. This endpoint enables your system to be notified when a flash call has been completed successfully or has failed.
Configure the API Endpoint
https://api.betatel.com/api/v1/connect-hub/call/flash/webhook
- Method:
POST
Set Up the Headers
Param | Value | Description |
---|---|---|
Content-type | application/json | Specifies 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 flash call UUID and the status of the verification process.
Example of body
{
"uuid": "01JV5V54KPYK9GB29265EQRZ2P",
"status": "Success"
}
Field | Type | Required | Description |
---|---|---|---|
uuid | string | Yes | The unique identifier of the flash call received in the initial response. |
status | string | Yes | The status of the flash call ("Success" or "Failed"). |
Code Snippets
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
Example - cURL
curl --location 'https://api.betatel.com/api/v1/connect-hub/call/flash/webhook' \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-user-id: YOUR_USER_ID' \
--data '{
"uuid":"01JV5V54KPYK9GB29265EQRZ2P",
"status":"Success"
}'
Example - Python
import http.client
import json
conn = http.client.HTTPSConnection("api.betatel.com")
payload = json.dumps({
"uuid": "01JV5V54KPYK9GB29265EQRZ2P",
"status": "Success"
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY',
'x-user-id': 'YOUR_USER_ID'
}
conn.request("POST", "/api/v1/connect-hub/call/flash/webhook", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Example - Node.js
const axios = require('axios');
let data = JSON.stringify({
"uuid": "01JV5V54KPYK9GB29265EQRZ2P",
"status": "Success"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.betatel.com/api/v1/connect-hub/call/flash/webhook',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY',
'x-user-id': 'YOUR_USER_ID'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Example - PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.betatel.com/api/v1/connect-hub/call/flash/webhook',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{"uuid":"01JV5V54KPYK9GB29265EQRZ2P", "status":"Success"}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'x-api-key: YOUR_API_KEY',
'x-user-id: YOUR_USER_ID'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example - Java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.betatel.com/api/v1/connect-hub/call/flash/webhook")
.header("Content-Type", "application/json")
.header("x-api-key", "YOUR_API_KEY")
.header("x-user-id", "YOUR_USER_ID")
.body("{\"uuid\":\"01JV5V54KPYK9GB29265EQRZ2P\", \"status\":\"Success\"}")
.asString();
Example - C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.betatel.com/api/v1/connect-hub/call/flash/webhook");
request.Headers.Add("x-api-key", "YOUR_API_KEY");
request.Headers.Add("x-user-id", "YOUR_USER_ID");
var content = new StringContent("{\"uuid\":\"01JV5V54KPYK9GB29265EQRZ2P\", \"status\":\"Success\"}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
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:
{
"uuid": "01JV5V54KPYK9GB29265EQRZ2P",
"status": "Success",
"message": "OK"
}
uuid
: The unique identifier for the flash call.status
: The status of the flash call ("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 flash call UUID does not exist
- 500 - Internal Server Error: An unexpected error occurred on the server