-
Notifications
You must be signed in to change notification settings - Fork 5
Event Notification
We have added an Event Notification feature. When a user event occurs, we do a callback on the provided client callback url.
- PatientQueuePatientWaitingroomEnter
- PatientQueueConsultationStart
- PatientQueueConsultationEnd
- PatientQueuePatientRemovedByProvider
- PatientQueuePatientDismissed
- PatientQueueConsultationDropped
- Appointment.Created
- Appointment.Updated
- Appointment.Cancelled
- PatientProfile.Created
- PatientProfile.Completed
- PatientProfile.Updated
Provide secret and callback url in the Help Desk

Secret is mandatory field. When we do a callback we provide a hash value of {secret}{requestbody}{timestamp} so you can validate the callback
We add the following two headers in request
/// <summary>
/// String sha256 hash.
/// </summary>
/// <param name="value">The value to hashed.</param>
/// <returns>base64 string</returns>
public static string SHA256Hash(this string value)
{
using (SHA256 hash = SHA256.Create())
{
byte[] result = hash.ComputeHash(Encoding.UTF8.GetBytes(value));
return Convert.ToBase64String(result);
}
}
var hash = $"{subscriber.Secret}{body}{currentTime}".SHA256Hash();`
content.Headers.Add("client-hash", hash);`
content.Headers.Add("timestamp", currentTime.ToString());`
Once you receive the callback you can validate the request like the following
// req: full payload content
var req = Request.Content.ReadAsStringAsync().Result;
// ...
var hash1 = Request.Headers.GetValues("client-hash").FirstOrDefault();
var timeStamp = Request.Headers.GetValues("timestamp").FirstOrDefault();
var hash2 = $"{_secret}{req}{timeStamp}".SHA256Hash();
if (!string.Equals(hash1, hash2))
return Unauthorized();
Request body of the received callback as HTTPPOST Patient Queue callback content
{
"ConsultationId" : 41005,
"HospitalId": 174,
"UserEventTypeCode": 2,
"EventName" : "PatientQueuePatientWaitingroomEnter",
"EventTime" : "2019-05-14T12:31:42.484058Z",
"ActingUserId": 12345
}
From the request body you get the consultationId. Now you can make a call to HTTPGET - {ApiBaseUrl}/api/v2/patients/consultations/{consultationId}/all to get the consultation details.
request header
Authorization: Bearer {{admin_access_token}}
Time-Zone: US Mountain Standard Time
X-Developer-Id:{{devId200}}
X-Api-Key:{{apiKey200}}
sample response
{
"data": [
{
"consultationInfo": {
"assignedDoctor": {
"id": 5930,
"description": "Ekaterina Testing Admin",
"shortName": "Testing Admin"
},
"conferenceKey": "1_MX40NTE5MTE5Mn5-MTU0MDc5Njc0NjA5OX5wMGk1bHEzbXdJVW9abzRzOVVSSHFCSmF-fg",
"consultationStatus": 72,
"hospitalId": 126,
"id": 57692,
"patient": {
"id": 5504
},
"responsibleUser": {
"id": 4314
},
"time": "2018-10-29T00:00:00Z",
"consultationAmount": 6,
"encounterTypeCode": 3
},
"dependentInformation": [],
"intakeForm": {
"concerns": [
{
"customCode": {
"code": 2305,
"description": "Fever (100+)"
},
"isPrimary": true
}
],
"patientRecord": {
"height": "3|0",
"weight": "3",
"heightUnit": "ft/in",
"weightUnit": "lbs",
"address": "476 5th Ave, New York, NY 10018, US",
"homePhone": "7778899",
"mobilePhone": "+213443423400",
"dob": "1990-06-01T00:00:00Z",
"gender": "F",
"firstName": "Kate",
"lastName": "Patient",
"profileImagePath": "https://emerald.qa1.snapvcm.com/api/v2.1/images/cc37d6b4-a99b-4291-8d69-1fe96820dab4"
},
"doctorRecord": {
"firstName": "Ekaterina",
"lastName": "Testing Admin",
"medicalSpeciality": "Roops Pqwo Vrwu Wewb Laon Tfcuneehcvk"
},
"hospitalRecord": {
"address": "",
"hospitalImage": "https://emerald.qa1.snapvcm.com/api/v2.1/images/a872f5d9-30b1-4a18-955c-2b8f4cccedb8",
"contactNumber": "(858) 876-1234",
"brandName": "EMERALD HEALTHCARE GROUP",
"brandTitle": "Virtual Telemedicine Tagline"
},
"guardiansRecords": [],
"medicationAllergies": [
{
"recordedDate": "2017-06-14T09:03:30.8066667Z",
"code": 1000000056,
"description": "Allergy Medication"
},
{
"recordedDate": "2018-07-13T07:56:27.0633333Z",
"code": 1000000061,
"description": "Aspirin"
},
{
"recordedDate": "2018-07-13T08:01:03.49Z",
"code": 1000000059,
"description": "Antibiotics"
},
{
"recordedDate": "2018-07-13T08:01:03.5366667Z",
"code": 1000000076,
"description": "Insulin"
}
],
"surgeries": [
{
"description": "Brain surgeries",
"month": 6,
"year": 1990
}
],
"medicalConditions": [
{
"code": 2217,
"description": "Shakes and Seizures"
},
{
"code": 2211,
"description": "Allergies"
},
{
"code": 2212,
"description": "Asthma"
},
{
"code": 2218,
"description": "Sickle Cell Anemia"
}
],
"medications": [
{
"code": 2225,
"description": "Antibiotics"
},
{
"code": 2226,
"description": "Asthma Medications"
}
],
"infantData": {}
},
"patientInformation": {
"patientId": 5504,
"age": "28y",
"relationId": 0,
"dobInfo": "6/1/1990",
"familyGroup": {
"familyGroupId": 2550,
"createDate": "2016-07-22T15:01:49.767Z",
"members": [
{
"patientId": 5719,
"patientName": "Kate's Dependent",
"relationCode": 2275,
"isAuthorized": true,
"birthdate": "2014-08-02T00:00:00Z",
"addresses": [
"jugiu 6 86 86 68 ",
"ddddwq2e2qdrfqefv drb vdr ",
"jugiu 6 86 86 68 "
],
"patientFirstName": "Kate's",
"patientLastName": "Dependent",
"guardianFirstName": "Kate",
"guardianLastName": "Patient",
"guardianName": "Kate Patient",
"personId": "bc694acb-d58b-4853-b432-3e58c6b35e60",
"gender": "M",
"bloodType": 2192,
"hairColor": 2232,
"height": "3|0",
"weight": "3",
"heightUnit": 4715,
"weightUnit": 4713,
"homePhone": "",
"mobilePhone": "+76476764"
},
{
"patientId": 6147,
"patientName": "Sister OfKate",
"relationCode": 2274,
"isAuthorized": true,
"birthdate": "2000-09-01T00:00:00Z",
"addresses": [
"Calle Alcalde Angel Arroyo 8, Via de Servicio A 42 Salida 10, 28903 Getafe, Spain",
"Calle Alcalde Angel Arroyo 8, Via de Servicio A 42 Salida 10, 28903 Getafe, Spain",
"Calle Alcalde Angel Arroyo 8, Via de Servicio A 42 Salida 10, 28903 Getafe, Spain"
],
"patientFirstName": "Sister",
"patientLastName": "OfKate",
"guardianFirstName": "Kate",
"guardianLastName": "Patient",
"guardianName": "Kate Patient",
"personId": "d44e08c8-c0d0-4a10-bd32-2445da7dfb1f",
"gender": "F",
"bloodType": 2188,
"hairColor": 2234,
"height": "4|0",
"weight": "3",
"heightUnit": 4715,
"weightUnit": 4713,
"homePhone": "",
"mobilePhone": "+76576474"
},
{
"patientId": 6188,
"patientName": "New Little Cat",
"profileImagePath": "https://emerald.qa1.snapvcm.com/api/v2.1/images/20490254-c0b9-4a99-b4cd-c472c5c9b9ce",
"personImageId": "20490254-c0b9-4a99-b4cd-c472c5c9b9ce",
"relationCode": 2274,
"isAuthorized": true,
"birthdate": "2016-09-05T00:00:00Z",
"addresses": [
"10 Mattar Rd, Singapore 387719",
"10 Mattar Rd, Singapore 387719",
"10 Mattar Rd, Singapore 387719"
],
"patientFirstName": "New Little",
"patientLastName": "Cat",
"guardianFirstName": "Kate",
"guardianLastName": "Patient",
"guardianName": "Kate Patient",
"personId": "25807d71-f46b-44d9-823e-ed7afa50b98f",
"gender": "F",
"bloodType": 2191,
"hairColor": 2237,
"height": "2|0",
"weight": "2",
"heightUnit": 4715,
"weightUnit": 4713,
"homePhone": "",
"mobilePhone": "+7345634"
},
{
"patientId": 6195,
"patientName": "Kate Patient Dept",
"profileImagePath": "https://emerald.qa1.snapvcm.com/api/v2.1/images/54532006-8e58-4d66-8475-b66a6bd37c7b",
"personImageId": "54532006-8e58-4d66-8475-b66a6bd37c7b",
"relationCode": 2274,
"isAuthorized": true,
"birthdate": "2000-09-05T00:00:00Z",
"addresses": [
"330 Royal Hawaiian Ave, Honolulu, HI 96815, USA",
"330 Royal Hawaiian Ave, Honolulu, HI 96815, USA",
"330 Royal Hawaiian Ave, Honolulu, HI 96815, USA",
"330 Royal Hawaiian Ave, Honolulu, HI 96815, USA",
"330 Royal Hawaiian Ave, Honolulu, HI 96815, USA",
"Colorado Springs, CO, USA"
],
"patientFirstName": "Kate Patient",
"patientLastName": "Dept",
"guardianFirstName": "Kate",
"guardianLastName": "Patient",
"guardianName": "Kate Patient",
"personId": "72603735-574f-4ed0-acbf-fcdc45f9b0b2",
"emailId": "katepatientdept@gmail.com",
"gender": "F",
"bloodType": 2190,
"hairColor": 2232,
"eyeColor": 2198,
"height": "3|0",
"weight": "3",
"heightUnit": 4715,
"weightUnit": 4713,
"homePhone": "",
"mobilePhone": "+734534"
},
{
"patientId": 6214,
"patientName": "Maska Patient",
"relationCode": 2274,
"isAuthorized": false,
"birthdate": "2016-07-06T00:00:00Z",
"addresses": [
"330 Royal Hawaiian Ave, Honolulu, HI 96815, USA",
"330 Royal Hawaiian Ave, Honolulu, HI 96815, USA",
"330 Royal Hawaiian Ave, Honolulu, HI 96815, USA"
],
"patientFirstName": "Maska",
"patientLastName": "Patient",
"guardianFirstName": "Kate",
"guardianLastName": "Patient",
"guardianName": "Kate Patient",
"personId": "bfe2cdd2-cd78-4b19-9380-e275cf424d42",
"gender": "F",
"bloodType": 2194,
"hairColor": 2233,
"height": "2|0",
"weight": "2",
"heightUnit": 4715,
"weightUnit": 4713,
"homePhone": "",
"mobilePhone": "+7543534"
},
{
"patientId": 23550,
"patientName": "Kate 17 April Dept",
"relationCode": 2274,
"isAuthorized": true,
"birthdate": "2017-04-17T00:00:00Z",
"addresses": [
"New York, NY, USA"
],
"patientFirstName": "Kate",
"patientLastName": "17 April Dept",
"guardianFirstName": "Kate",
"guardianLastName": "Patient",
"guardianName": "Kate Patient",
"personId": "9e02366e-1828-4442-892d-6290ee4a9d68",
"gender": "F",
"height": "1|0",
"weight": "1",
"heightUnit": 4715,
"weightUnit": 4713,
"homePhone": "",
"mobilePhone": "+73252424"
}
]
},
"fullName": " Patient",
"dob": "1990-06-01T00:00:00Z",
"ethnicity": "African American (non-Hispanic)",
"bloodType": "B-",
"hairColor": "Brown",
"eyeColor": "Brown",
"gender": "F",
"schoolName": "",
"schoolContact": "",
"isDependent": "N",
"isChild": "N",
"isActive": "A",
"profileImageId": "cc37d6b4-a99b-4291-8d69-1fe96820dab4",
"profileImagePath": "https://emerald.qa1.snapvcm.com/api/v2.1/images/cc37d6b4-a99b-4291-8d69-1fe96820dab4",
"homePhone": "7778899",
"mobilePhone": "+213443423400",
"primaryPhysician": "None Reported",
"primaryPhysicianContact": "None Reported",
"physicianSpecialist": "None Reported",
"physicianSpecialistContact": "None Reported",
"preferredPharmacy": "None Reported",
"pharmacyContact": "None Reported",
"address": "476 5th Ave, New York, NY 10018, US",
"lastName": "Patient",
"rxNtPatientId": 0,
"hospitalId": 126,
"height": "3\" 0'",
"weight": "3",
"country": "",
"heightUnit": "ft/in",
"weightUnit": "lbs",
"guardianName": "Kate Patient",
"guardians": []
}
}
],
"total": 1
}
Note : When patient enters to waiting room from onDemand consultation, doctor information is unknown during that time. Hence doctor related properties will be missing or null from above json
Sample code for client (reference - IdentityServer)

In identityserver we have added HTTPGET method https://snapmd-sso.azurewebsites.net/api/inbound to verify the callback details. In this method we do an additional call to get consultation details

Client can make additional call to get profile details
Appointment Created callback content
[
{
"AppointmentId": "7377a8f2-92dc-4bc2-ad24-45414de6a640",
"AppointmentStatusCode": 1,
"AppointmentTypeCode": 1,
"PatientId": 29523,
"ProviderId": 10662,
"EventName": "Appointment.Created",
"EventTime": "2019-06-11T06:02:15.4818331Z",
"HospitalId": 277,
"ActingUserId": 10662
}
]
Appointment Updated callback content
[
{
"AppointmentId": "7377a8f2-92dc-4bc2-ad24-45414de6a640",
"AppointmentStatusCode": 1,
"AppointmentTypeCode": 1,
"PatientId": 29523,
"ProviderId": 10662,
"EventName": "Appointment.Updated",
"EventTime": "2019-06-11T06:04:51.2851616Z",
"HospitalId": 277,
"ActingUserId": 10662
}
]
Appointment Cancelled callback content
[
{
"AppointmentId": "7377a8f2-92dc-4bc2-ad24-45414de6a640",
"AppointmentStatusCode": null,
"AppointmentTypeCode": null,
"PatientId": null,
"ProviderId": null,
"EventName": "Appointment.Cancelled",
"EventTime": "2019-06-11T06:07:21.532198Z",
"HospitalId": 277,
"ActingUserId": 10662
}
]
PatientProfile Created callback content
[
{
"PatientId": 30860,
"PatientUserId": 12869,
"PatientPersonId": "faa480f5-c029-493a-ba1c-64904958d25c",
"PatientProfileStatus": 1,
"EventName": "PatientProfile.Created",
"EventTime": "2019-06-11T06:11:31.4075966Z",
"HospitalId": 277,
"ActingUserId": 10662
}
]
PatientProfile Completed callback content
[
{
"PatientId": 30860,
"PatientUserId": 12869,
"PatientPersonId": "faa480f5-c029-493a-ba1c-64904958d25c",
"PatientProfileStatus": 1,
"EventName": "PatientProfile.Completed",
"EventTime": "2019-06-11T06:11:31.8635773Z",
"HospitalId": 277,
"ActingUserId": 10662
}
]