Skip to main content

Webhooks

Partners who want to integrate with Altibbi can use webhooks to receive notifications about events that occur in the Altibbi system.

Delivery​

  • Every webhook is an HTTP POST with a JSON body (content-type: application/json) and a 10 second timeout.
  • Each request carries your partner authentication header (the header name and value configured for your account).
  • Webhooks are sent on a best-effort basis and are not retried, so your endpoint should respond with a 2xx quickly and process the event asynchronously.
  • Your endpoint should be idempotent: use consultation_id, type and datetime to detect duplicates.
  • Status updates and consultation notifications are delivered to your status callback URL; recommendation webhooks are delivered to your recommendation callback URL. Both are configured with your account.

Common payload fields​

Every webhook includes these fields:

FieldTypeDescription
typestringThe webhook type, see the sections below
consultation_idintegerThe consultation the event belongs to
user_idintegerThe user who owns the consultation
insurance_idstringThe user's insurance id
policy_numberstringThe user's policy number
datetimestringWhen the event was sent (ISO 8601, UTC)

Webhook types​

typeDelivered toDescription
status_updatestatus callback URLThe consultation status changed or its outcome was determined
accept_consultationstatus callback URLA doctor accepted the consultation
doctor_no_answerstatus callback URLThe doctor tried to reach the patient and got no answer
doctor_waiting_the_patientstatus callback URLThe doctor is waiting for the patient
voip_notificationstatus callback URLVoIP call credentials are ready
convert_voip_to_gsm_notificationstatus callback URLThe VoIP call was converted to a GSM (phone) call
video_notificationstatus callback URLVideo call credentials are ready
chat_notificationstatus callback URLChat credentials are ready
chat_history_notificationstatus callback URLThe chat history of a chat consultation
recommendation_datarecommendation callback URLThe doctor's medical recommendation

1- Status update webhooks​

Sent when the status of a consultation changes, and when the outcome of a consultation is determined.

Sample payload:

{
"type": "status_update",
"consultation_id": 72,
"user_id": 1,
"insurance_id": "1234",
"policy_number": "1981",
"old_status": "new",
"new_status": "checking_medical_profile",
"datetime": "2024-01-30T09:38:50.848860Z"
}

Consultation statuses​

new_status can be one of the following lifecycle statuses:

StatusDescription
scheduledThe consultation was booked for a later time and is waiting for its slot
newThe consultation is open and waiting for a doctor
checking_medical_profileA doctor accepted the consultation and is reviewing the patient's medical profile and attachments
in_progressThe consultation session (chat, VoIP, video or GSM call) started
closedThe consultation ended. A closed consultation never changes status again

A typical flow is new → checking_medical_profile → in_progress → closed. A scheduled consultation becomes new when it is opened for doctors.

Consultation outcomes​

After a consultation is closed, the status update webhook may also be sent with one of the following outcome values in new_status. These do not change the consultation status, so old_status is the current status of the consultation (normally closed):

ValueDescription
successThe consultation was completed and rated successfully by the doctor
failedThe consultation was not completed, due to a technical issue or because the doctor did not get all the information from the patient

Sample payload:

{
"type": "status_update",
"consultation_id": 72,
"user_id": 1,
"insurance_id": "1234",
"policy_number": "1981",
"old_status": "closed",
"new_status": "failed",
"datetime": "2023-06-15T10:12:03.120331Z"
}

Notes​

  • Duplicate or no-op transitions are not sent (for example new → new, or closed → closed).
  • Once a consultation is closed, later lifecycle status changes are ignored and no webhook is sent for them.
  • A consultation cancelled by the patient through the API is closed immediately and does not trigger a closed status webhook.
  • When a failed consultation is re-created, the new consultation is linked to the old one. No webhook is sent for the re-creation itself.

2- Consultation notification webhooks​

These webhooks notify the partner about events that happen during the consultation. The event specific information is in the data field.

Common payload shape:

{
"type": "accept_consultation",
"consultation_id": 72,
"user_id": 1,
"insurance_id": "1234",
"policy_number": "1981",
"data": {},
"datetime": "2023-06-15T09:40:12.331205Z"
}

accept_consultation​

A doctor accepted the consultation.

"data": {
"drName": "Dr. Sample Name",
"drRating": 4.8
}

doctor_no_answer​

The doctor tried to reach the patient and did not get an answer. Use it to prompt the patient to be available. data is informational and may be empty.

doctor_waiting_the_patient​

The doctor is ready and waiting for the patient. Use it to prompt the patient to open the consultation. data is informational and may be empty.

voip_notification​

The VoIP call is ready. Use these credentials to join the call.

"data": {
"api_key": "47123456",
"call_id": "2_MX40NzEyMzQ1Nn5-...",
"token": "T1==cGFydG5lcl9pZD00NzEyMzQ1NiZzaWc9..."
}

convert_voip_to_gsm_notification​

The VoIP call was converted to a GSM call. From this point the consultation medium is gsm.

video_notification​

The video call is ready. Use these credentials to join the call.

"data": {
"api_key": "47123456",
"call_id": "2_MX40NzEyMzQ1Nn5-...",
"token": "T1==cGFydG5lcl9pZD00NzEyMzQ1NiZzaWc9..."
}

chat_notification​

The chat is ready. Use these credentials to join the chat group.

"data": {
"appId": "1234567890abcdef",
"groupId": "consultation_72",
"chatUserId": "user_1",
"chatUserToken": "a1b2c3d4e5f6..."
}

chat_history_notification​

Sent once for a chat consultation with the chat history of the session in data.

caution

The voip_notification, video_notification and chat_notification payloads contain session credentials. Treat them as secrets: do not log them and do not expose them to anyone other than the patient who owns the consultation.

3- Recommendation webhooks​

Sent to the recommendation callback URL once the doctor has prepared the medical recommendation, in json format. The recommendation is sent once per consultation. Sample payload:

{
"type": "recommendation_data",
"consultation_id": 72,
"user_id": 1,
"insurance_id": "1",
"policy_number": "1",
"data": {
"icd10": {
"symptom": [
{
"name": "Freckles",
"code": "L81.2"
}
],
"diagnosis": [
{
"name": "Fascioliasis",
"code": "B66.3"
}
]
},
"drug": {
"fdaDrug": [
{
"name": "PIMOZIDE",
"tradeName": "ORAP FORTE TAB 4 MG",
"strengthValue": "4",
"packageType": "Blister",
"packageSize": "20",
"dosage": "2",
"dosageUnit": "capsule",
"routeOfAdministration": "oral",
"dosageForm": "tablet",
"frequency": "Four times daily",
"duration": 5,
"specialInstructions": null,
"relationWithFood": "",
"howToUse": null
},
{
"name": "KETOPROFEN",
"tradeName": "ORUVAIL S-R CAPS 100 MG",
"strengthValue": "100",
"packageType": "Blister",
"packageSize": "28",
"dosage": "2",
"dosageUnit": "tablespoon (10ml)",
"routeOfAdministration": "oral",
"dosageForm": "Prolonged-release capsule, hard",
"frequency": "Four times daily",
"duration": 6,
"specialInstructions": null,
"relationWithFood": "",
"howToUse": null
}
]
},
"lab": {
"lab": [
{
"name": "FIT Test"
}
]
},
"doctorReferral": {
"name": "Gastroenterologist/ Stomach & Bowel Specialist"
},
"followUp": [
{
"name": "Do Lab Test"
},
{
"name": "Do the required radiation"
},
{
"name": "No Follow-up - Policy Expired"
}
],
"postCallAnswer": [
{
"question": "doctor_notes",
"answer": "additional note "
},
{
"question": "symptoms",
"answer": "symptoms note"
},
{
"question": "diagnosis",
"answer": "Diagnosis note"
},
{
"question": "fda_drug",
"answer": "medications note"
},
{
"question": "lab_codes",
"answer": "Lab note"
}
],
"dispense": {
"url": "https://web.altibb.com/prescription/9EK1IhvLIwMC8rw5066cMVZXqs3",
"pass_code": 5528,
"qr_code": "https://services.altibbi.com/qr/https%3A%2F%2Fweb.altibb.com%2Fprescription%2F9EK1IhvLIwMC8rw50jEaHIp3cEVRXqs3"
}
},
"datetime": "2023-06-15T09:46:01.764869Z"
}