6. Alerts Interactions
Once an alert is created, your application should be able to perform the following API Requests to interact with the alert.
6.1 Update Alert Status
This request updates the status of alerts. The following table describes different statuses available to the Central Station.
| Status | Description |
|---|---|
| DISPATCH_REQUESTED | Request Dispatch should always be called immediately prior to when the 10-digit dial to the ECC(PSAP) would occur in existing CS procedures (per existing action plans). The CS will utilize the PATCH Update Status API to set the alert status to “dispatch requested”. \ \This requires that the alert is first created, but can be done at the same time for a CS-initiated integration. RapidSOS can set the POST Create Alert API to request dispatch automatically from a single API call, or it can be integrated as two separate API calls. \ The dispatch request is the trigger that sends the alert to the applicable ECC based on the alarm type and jurisdiction where the event occurred.\A Dispatch Request cannot be called on an alert if the corresponding ECC is not supporting either alerts or Supplemental Alerts |
| IGNORED | Ignore is a status that can be set in the PATCH Update Status API or in the RapidSOS Portal for Central Stations (CSP). \ Ignoring an alert is utilized for removing visibility in the CSP alert queue, indicating that the alert is no longer required. Alerts set to ignored status are also filtered out in the GET Get Alerts API enabling a similar ‘remove’ experience in automation integrations. |
| CANCELED | After a dispatch request has been made on an alert (it has been delivered to an ECC), the CS can cancel dispatch utilizing the PATCH Update Status API. Canceling is required for both Alerts and Supplemental Alerts. \ For Supplemental Alerts, this is due to some ECCs having procedures to proactively call when RapidSOS is able to display an event but the call does not arrive. In a scenario where an alarm is canceled after the alert was sent to the ECC but before the 10-digit call was made, flagging these as cancelled is a courtesy that will ensure we do not introduce pain points at ECCs, helping the overall adoption of Alerts. \ Setting a Supplemental Alert as canceled does not officially cancel an alarm call, as there is no protocol or way to guarantee the consumption of this information at the ECC. Existing CS procedures for calling back to the ECC must still be used (call the ECC to cancel a Supplemental Alert). Cancels made with full Alerts (non-10-digit flow) do not require a follow-up cancelation call. |
Sample request
PATCH /v1/alerts/alert-6e58d630-d28f-4623-ba01-3207b497a9ba HTTP/1.1
Host: api-sandbox.rapidsos.com
Authorization: Bearer YOUR-ACCESS-TOKEN
{
"status": "DISPATCH_REQUESTED",
}A sample response looks as follows:
{
"status": {
"name": "ACCEPTED",
"display_name": "Accepted"
},
"last_updated_time": 1671736239735
}6.2 Chat/Comments
Chatting/Comments can be made manually in the RapidSOS Portal for central stations (CSP) or
via the Log Messages POST API, which enables chat messages to be created within automation software and posted to the alert. When paired with the GET Get Alert API or Webhooks, a
complete 2-way read/write capability is available via automation integrations.
A sample request looks as follows:
POST /v1/alerts/alert-6e58d630-d28f-4623-ba01-3207b497a9ba/log_messages HTTP/1.1
Host: api-sandbox.rapidsos.com
Authorization: Bearer YOUR-ACCESS-TOKEN
{
"message": "Hello world!",
"message_type": "CHAT_MESSAGE",
"sender": "John Doe",
"sender_id": "RapidSOS-41"
}A sample response looks as follows:
{
"alert_id": "alert-6e58d630-d28f-4623-ba01-3207b497a9ba",
"message": "Hello world!",
"message_type": "CHAT_MESSAGE",
"sender": "John Doe",
"sender_id": "RapidSOS-41",
"entity_display_name": "Acme Alerts Inc.",
"created_at": 1671736239735
}6.3 Logging Milestones
Utilizing the Log Messages POST API specific milestones can be logged to an alert record such as calls and messages made to customers. The chat log in the CSP can also be utilized to post milestone information to the alert record.
The log messages API has 3 message types that can be set by CS partner integrations, MILESTONE, CHAT_MESSAGE, and MULTI_TRIP_SIGNAL.
The Log Messages POST API also has the ability to set the message_time. This enables back-dating
milestones that occurred between the initial incident time and when the alert was created (such as logging calls attempted to contacts).
Sample Request
POST /v1/alerts/alert-6e58d630-d28f-4623-ba01-3207b497a9ba/log_messages HTTP/1.1
Host: api-sandbox.rapidsos.com
Authorization: Bearer YOUR-ACCESS-TOKEN
{
"message": "Hello world!",
"message_type": "MILESTONE",
"sender": "John Doe",
"sender_id": "RapidSOS-41"
}A sample response looks as follows:
{
"alert_id": "alert-6e58d630-d28f-4623-ba01-3207b497a9ba",
"message": "Hello world!",
"message_type": "MILESTONE",
"sender": "John Doe",
"sender_id": "RapidSOS-41",
"entity_display_name": "Acme Alerts Inc.",
"created_at": 1671736239735
}6.4 Multi-trip Alarms
Multi-trips can be logged as a log message within an existing alert or can be created as a new alert using the Log Messages POST API. For guidance, if your CS would typically call the ECC, it should be a new alert. If there are several multi-trips prior to making the call (such as in quick succession), those can be logged to the same alert.
6.5 Getting Alert Data
Each full alert record is broken into 3 pieces, the core data (returned by the Get Alert APIs), the static data (returned by the RAD-E API) and the log data (optionally returned by the Get Alert API).
The GET Alerts API returns high-level data on all alerts within a set filter. Pagination (number and offset of alerts returned) and UNIX timestamp ranges (set the start and end of the time period) can be set.
Sample Request
GET /v1/alerts?limit=10&start=0&end=1671736239735 HTTP/1.1
Host: api-sandbox.rapidsos.com
Authorization: Bearer YOUR-ACCESS-TOKENA sample response looks as follows:
{
"alerts_until": 1581110270622,
"alerts": [
{
"source_id": "abc123",
"incident_time": 1581110270622,
"location": {
"geodetic": {
"latitude": 45.123,
"longitude": -71.321,
"uncertainty_radius": 7.5
},
"civic": {
"name": "RapidSOS HQ",
"street_1": "123 Main Street",
"street_2": "Apt. 626",
"city": "Los Angeles",
"state": "California",
"country": "USA",
"zip_code": 11375
}
},
"status": {
"name": "RECEIVED",
"display_name": "Received"
},
"disposition": {
"name": "DISPATCHED",
"display_name": "Dispatched"
},
"disposition_message": "Declined due to insufficient details",
"last_updated_time": 1581110270622,
"id": "6e58d630-d28f-4623-ba01-3207b497a9ba",
"emergency_type": {
"name": "BURGLARY",
"display_name": "Burglary"
},
"site_type": {
"name": "RESIDENTIAL",
"display_name": "Residential"
},
"covering_psap": {
"id": "NY_123",
"name": "New York Police Department",
"phone": 15555555555
},
"authorized_entity": {
"id": "CS_123",
"name": "Central Station ABC",
"phone": 15555555555
},
"followers": [
"string"
]
}
]
}The GET Alert API returns a specific alert and requires the RapidSOS-generated alert_id. It provides an option to include logs in the return payload (all chat, status/disposition updates, etc. as would be posted to the CSP chat log). Once an alert has been identified, all changes to it can be returned in this single API when utilizing the optional log flag.
Sample request for a specific alert.
GET /v1/alerts/alert-83f0cf36-3f0a-4312-9e0e-f2703b34958b HTTP/1.1
Host: api-sandbox.rapidsos.com
Authorization: Bearer YOUR-ACCESS-TOKENRetrieve Static Data
The POST RAD-E API is used to retrieve the static data content of an alert (the data card containing various alarm, account, or contacts information). This data does not change after alert creation and will only need to be called to fetch data once per alert. RAD-E utilizes a flexible schema, enabling alerts to cater to a wide range of applications and custom datasets.
Sample Request
GET /v2/emergency-data/session HTTP/1.1
Host: api-sandbox.rapidsos.com
Authorization: Bearer YOUR-ACCESS-TOKEN
{
"query": "alert://alert-e6581196-cbbc-42d1-9fc2-48773b02df57",
"meta": false
}Sample Response
{
"org": {
"data": {
"suffix": {
"zone_sensor": "Zone 401",
"patient_name": "Helmer Wunsch",
"gender": "Female",
"date_of_birth": "Mon Dec 12 2022 14:22:56 GMT-0800 (Pacific Standard Time)",
"medical_conditions": "Future-proofed client-driven approach",
"medications": "Grass-roots eco-centric service-desk",
"allergies": "Optimized eco-centric analyzer",
"instructions": "You can't back up the hard drive without compressing the redundant AGP array!",
"site_phone": "688-471-1199",
"emergency_contacts": [
{
"name": "Erika Schumm",
"phone": "+15555555555",
"relationship": "Mother",
"language": "Mandarin"
}
]
}
}
}
}