Webhook
The gateway sends a webhook to the address passed in the hook parameter of a send request. One webhook is sent per message, on every change of its status.
A message that the gateway refused to accept is reported by the same webhook with status: REJECTED and the reason in error. There is no separate payload for errors.
URI: https://api.interconnect.solutions/api/json.php
All requests to API are sent in JSON format using the POST method.
Header parameters
Requests must contain header Content-Type: application/json and X-Signature, otherwise, the request will be considered invalid even if it has valid JSON.
X-Signature
The X-Signature header is passed by concatenating a JSON string and an API-key.
Example: X-Signature: sha256(json_body + api_key)
Delivery
The webhook is sent once, without retries. Connection timeout — 5 seconds, total timeout — 5 seconds. Your server is expected to answer with code 200; the response body is ignored.
Request parameters
Request example
- Default
- Viber 2 Way
- Voice
- Async
- Rejected
- Rejected (no id)
{
"id": "100500",
"msg_id": "123456789",
"type": "viber",
"status": "READ",
"success": true,
"updated": "2024-01-31T12:34:00+02:00"
}
{
"id": "100500",
"msg_id": "123456789",
"type": "viber",
"status": "READ",
"success": true,
"updated": "2024-01-31T12:34:00+02:00",
"replies": [
{
"datetime": "2024-01-31T12:34:00+02:00",
"message": "Please wait"
},
{
"datetime": "2024-01-31T12:34:01+02:00",
"media": {
"url": "https://url.com/home/vibermedia/",
"filename": "invoice.pdf",
"filesize": 67983
}
},
{
"datetime": "2024-01-31T12:34:02+02:00",
"message": "Correct invoice",
"media": {
"url": "https://url.com/home/vibermedia/",
"filename": "invoice.pdf",
"filesize": 68934
}
}
]
}
{
"id": "100500",
"msg_id": "123456789",
"type": "voice",
"status": "DELIVERED",
"success": true,
"updated": "2024-01-31T12:34:00+02:00",
"reply": "7",
"duration": 23
}
{
"id": "100500",
"msg_id": "123456789",
"request_id": "cf-ray-1234567890-ABC",
"type": "viber",
"status": "READ",
"success": true,
"updated": "2024-01-31T12:34:00+02:00"
}
The message was rejected on acceptance, so it has no msg_id. The reason is in error.
{
"id": "100500",
"type": "sms",
"status": "REJECTED",
"success": false,
"error": "Not enough money",
"updated": "2024-01-31T12:34:00+02:00",
"request_id": "a1436d496bf11a59"
}
None of the messages in the async packet had an id. One webhook is sent with request_id.
{
"request_id": "a1436d496bf11a59",
"status": "REJECTED",
"success": false,
"error": "Access denied",
"updated": "2024-01-31T12:34:00+02:00"
}
Response parameters
You will receive code 200 in response.
Response example
- Successful
HTTP Status Code: 200
Content Type: JSON application/json
If the whole request is rejected — for example with Access denied — one webhook is sent per unique id. If no message in the packet has an id, a single webhook with request_id is sent to the first hook.