Emergency Alerts
Describes how to configure the Senza platform to provide alerts to the web application
If you operate a TV service, you may be required to send emergency alerts to your viewers as part o the Emergency Alert System. This tutorial will show you how to use the Message Manager to send an alert message to your viewers.
For and end-to-end example of these techniques, see the Emergency Alerts tutorial and the π§ββοΈ Zombies sample app.
Group Messages
The Senza platform supports pushing messages to specific devices by using our Message Manager interface. This is done by associating devices to specific groups, which are simply strings that you can define implicitly.
The flow is as follows:
- It's up to you to decide what group names you want to use. For example, you could use countries, states, ZIP codes, etc.
- When your app starts, it should register to join one or more groups.
- When you need to send a message, you can use the API to send it to one or more groups.
- Every device that has registered for one of these groups will receive the message.
Emergency Alert System (EAS) Use Case
Upon receiving an AES alert, the host platform will need to push the message to all devices associated with this AES alert. The following shows how this would be configured.
Registering for Messages
Using the messageManager, you can register the device to a list of groups depending on any specific customer requirements or criteria.
messageManager.registerGroups(["EAS_CODE_1234"])
Sending the Message
When receiving the alert, the host plaform should send a message using the Group Messaging API.
See the page on Making API Requests for details on how to get an access token, which you'll need to authenticate when making the API call.
The payload in the body can be either a string or object.
tenantId = "hyperscale-tenant";
curl --location `https://hyperscale-message-broker-main.ingress.active.streaming.synamedia.com/message-broker/1.0/messages/tenant/${tenantId}/groups/app` \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IklueVBSVzBoNzJhLTNNYmpDOHdZUCJ9.eyJpc3MiOiJodHRwczovL2F1dGgubWF0aXNzZS5jb2xkc25vdy5uZXQvIiwic3ViIjoiazhrSGVIUlB3amozYkxCTkVrU0trV0Rxak9WWXNEbkZAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vcHJvamVjdHMuc3luYW1lZGlhLmNvbSIsImlhdCI6MTY4MzYyNDMxOSwiZXhwIjoxNjgzNjQ1OTE5LCJhenAiOiJrOGtIZUhSUHdqajNiTEJORWtTS2tXRHFqT1ZZc0RuRiIsInNjb3BlIjoiaHlwZXJzY2FsZS1hZG1pbjptZXNzYWdlczpzZW5kLWdyb3VwIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.bNKjheEdaty6QXM5vbqgaXn5DR8L6CZSTYLDxpqOg_A5PSiNt7-v81D7TDpcwaMByx82_iBfmlmCAJTOkER79TTX58P_A3kg8hG6C1PuAwoBkn132JDYPbanqpWvJsvsQCVbDiMqIJXD8Th_RJ_zLrY28Hi63oUvOyDa5eo7cvHfc5o49Snvh47ydTObrU81z9WV8_k0K9x4p7kH9SJKq1_JbkOa-Lny2rTpXcsEObNXauPrgAH8GYLOoN7cWgt5Y8uy808OMH84DGUhLMPnQ6qW9J86x7xAAB3X_cAK6jFRl4rvBWhraBflabp8wLGU6i9QjP2IW8yD3t8iW3lOTg' \
--header 'Content-Type: application/json' \
--data '{
"groups": ["EAS_CODE_1234","EAS_CODE_9999"],
"payload": {
"EAS": "This is a test of the emergency broadcast system. This is only a test."
},
"eventName": "EAS"
}'
Receiving the Message
The web application should set up a listener using the Message Manager api.
messageManager.addEventListener("message", (e) => {
console.log("message arrived with data", e.detail);
});
If the message payload was sent as an object, the payload will return here as a JSON string object which requires parsing. The "eventName" should be used to describe what type of message this is so you can parse the payload properly.
Updated 7 months ago