RainMaker push notification payloads
Follow these steps to configure and enable push notifications.
Notification schemas
Android
Amazon SNS supports Firebase Cloud Messaging (FCM) to send notifications to Android application users. Google Cloud Messaging (GCM) is a depreciated version of it. Amazon SNS uses FCM under the hood for both FCM and GCM platforms.
The payload that RainMaker sends is of format:
{
"GCM": "Escaped JSON event details with FCM supported attributes"
}
The Escaped JSON event details received by the phone apps are of format:
{
"data": {
"title": "ESP RainMaker",
"body": "",
"event_data_payload": {
"event_version": "v1",
"id": "1",
"event_type": "rmaker.event.<event_type>",
"timestamp": 1648563678737,
"description": "",
"event_data": {}
}
}
}
You can modify the payload of notifications if required.
iOS
Amazon SNS supports Apple Push Notification service to send notifications to iOS application users. You can use the APNs sandbox channel to send push notification messages to the sandbox environment of the Apple Push Notification service (APNs) for pre-production testing.
The payload that RainMaker sends is of format:
{
"APNS/APNS_SANDBOX": "Escaped JSON event details with iOS supported attributes"
}
The Escaped JSON event details received by the phone apps are of format:
{
"aps": {
"alert": {
"title": "ESP RainMaker",
"body": "",
"event_data_payload": {
"event_version": "v1",
"id": "1",
"event_type": "rmaker.event.<event_type>",
"timestamp": 1648563678737,
"description": "",
"event_data": {}
}
},
"mutable-content": 1
}
}
You can mutate the payload of notifications if required. Reference
Notification payloads
Refer the below payload examples for event-specific notification payloads:
1. Node Connected
Android | iOS |
---|---|
{ "GCM": "{\"data\":{\"title\":\"ESP RainMaker\",\"body\":\"Node(s) connected to cloud\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.node_connected\",\"timestamp\":1648563678737,\"description\":\"Node(s) connected to cloud\",\"event_data\":{\"user_id\":\"1fd342a3-7531-48a0-9d97-4242a8502ed4\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"connectivity\":{\"connected\":true,\"timestamp\":1648563678517}}}}}" } | { "APNS": "{\"aps\":{\"alert\":{\"title\":\"ESP RainMaker\",\"body\":\"Node(s) connected to cloud\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.node_connected\",\"timestamp\":1648563678737,\"description\":\"Node(s) connected to cloud\",\"event_data\":{\"user_id\":\"1fd342a3-7531-48a0-9d97-4242a8502ed4\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"connectivity\":{\"connected\":true,\"timestamp\":1648563678517}}}},\"mutable-content\":1}}" } |
2. Node Disconnected
Android | iOS |
---|---|
{ "GCM": "{\"data\":{\"title\":\"ESP RainMaker\",\"body\":\"Node(s) disconnected from cloud\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.node_disconnected\",\"timestamp\":1648563564021,\"description\":\"Node(s) disconnected from cloud\",\"event_data\":{\"user_id\":\"1fd342a3-7531-48a0-9d97-4242a8502ed4\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"connectivity\":{\"connected\":false,\"timestamp\":1648563558181}}}}}" } | { "APNS": "{\"aps\":{\"alert\":{\"title\":\"ESP RainMaker\",\"body\":\"Node(s) disconnected from cloud\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.node_disconnected\",\"timestamp\":1648563564021,\"description\":\"Node(s) disconnected from cloud\",\"event_data\":{\"user_id\":\"1fd342a3-7531-48a0-9d97-4242a8502ed4\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"connectivity\":{\"connected\":false,\"timestamp\":1648563558181}}}},\"mutable-content\":1}}" } |
3. Node Params change
Android | iOS |
---|---|
{ "GCM": "{\"data\":{\"title\":\"ESP RainMaker\",\"body\":\"Node parameters updated\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.node_params_changed\",\"timestamp\":1648563339270,\"description\":\"Node parameters updated\",\"event_data\":{\"user_id\":\"1fd342a3-7531-48a0-9d97-4242a8502ed4\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"payload\":\"{\\\"Lightbulb\\\":{\\\"brightness\\\":75}}\"}}}}" } | { "APNS": "{\"aps\":{\"content-available\":1},\"data\":{\"title\":\"ESP RainMaker\",\"body\":\"Node parameters updated\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.node_params_changed\",\"timestamp\":1648563339270,\"description\":\"Node parameters updated\",\"event_data\":{\"user_id\":\"1fd342a3-7531-48a0-9d97-4242a8502ed4\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"payload\":\"{\\\"Lightbulb\\\":{\\\"brightness\\\":75}}\"}}}}" } |
4. User Node Added
Android | iOS |
---|---|
{ "GCM": "{\"data\":{\"title\":\"ESP RainMaker\",\"body\":\"New Node(s) added\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.user_node_added\",\"timestamp\":1648562696803,\"description\":\"New Node(s) added\",\"event_data\":{\"user_id\":\"69304cb1-7572-4981-87d8-eb06681ca699\",\"user_role\":\"primary\",\"nodes\":[\"WXXuKyL4HBTFbBQvxfCa6j\"]}}}}" } | { "APNS": "{\"aps\":{\"alert\":{\"title\":\"ESP RainMaker\",\"body\":\"New Node(s) added\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.user_node_added\",\"timestamp\":1648562696803,\"description\":\"New Node(s) added\",\"event_data\":{\"user_id\":\"69304cb1-7572-4981-87d8-eb06681ca699\",\"user_role\":\"primary\",\"nodes\":[\"WXXuKyL4HBTFbBQvxfCa6j\"]}}},\"mutable-content\":1}}" } |
5. User Node Removed
Android | iOS |
---|---|
{ "GCM": "{\"data\":{\"title\":\"ESP RainMaker\",\"body\":\"Node(s) removed\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.user_node_removed\",\"timestamp\":1648563123598,\"description\":\"Node(s) removed by primary user\",\"event_data\":{\"user_id\":\"69304cb1-7572-4981-87d8-eb06681ca699\",\"user_role\":\"\",\"nodes\":[\"WXXuKyL4HBTFbBQvxfCa6j\"]}}}}" } | { "APNS": "{\"aps\":{\"alert\":{\"title\":\"ESP RainMaker\",\"body\":\"Node(s) removed\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.user_node_removed\",\"timestamp\":1648563123598,\"description\":\"Node(s) removed by primary user\",\"event_data\":{\"user_id\":\"69304cb1-7572-4981-87d8-eb06681ca699\",\"user_role\":\"\",\"nodes\":[\"WXXuKyL4HBTFbBQvxfCa6j\"]}}},\"mutable-content\":1}}" } |
6. Node Alerts
Android | iOS |
---|---|
{ "GCM": "{\"data\":{\"title\":\"ESP RainMaker\",\"body\":\"Alert received from a node\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.alert\",\"timestamp\":1648706009358,\"description\":\"Alert received from a node\",\"event_data\":{\"message_body\":\"{\\\"Alert\\\":\\\"Sample alert\\\"}\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\"}}}}" } | { "APNS": "{\"aps\":{\"alert\":{\"title\":\"ESP RainMaker\",\"body\":\"Alert received from a node\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.alert\",\"timestamp\":1648706009358,\"description\":\"Alert received from a node\",\"event_data\":{\"message_body\":\"{\\\"Alert\\\":\\\"Sample alert\\\"}\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\"}}},\"mutable-content\":1}}" } |
7. Node Automation Triggered
Android | iOS |
---|---|
{ "GCM": "{\"data\":{\"title\":\"ESP RainMaker\",\"body\":\"Successfully triggered automation for some device(s)\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.node_automation_trigger\",\"timestamp\":1648560446262,\"description\":\"Automation Triggered\",\"event_data\":{\"user_id\":\"1fd342a3-7531-48a0-9d97-4242a8502ed4\",\"automation_id\":\"a5rYFynf6XNjsNRJmarkbZ\",\"automation_name\":\"TurnOffWhen100\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"events\":[{\"params\":{\"Lightbulb\":{\"brightness\":100}},\"check\":\"==\"}],\"actions\":[{\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"params\":{\"Lightbulb\":{\"power\":false}}}],\"status\":[{\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"status\":\"success\",\"description\":\"Node automation triggered\"}]}}}}" } | { "APNS": "{\"aps\":{\"alert\":{\"title\":\"ESP RainMaker\",\"body\":\"Successfully triggered automation for some device(s)\",\"event_data_payload\":{\"event_version\":\"v1\",\"id\":\"1\",\"event_type\":\"rmaker.event.node_automation_trigger\",\"timestamp\":1648560446262,\"description\":\"Automation Triggered\",\"event_data\":{\"user_id\":\"1fd342a3-7531-48a0-9d97-4242a8502ed4\",\"automation_id\":\"a5rYFynf6XNjsNRJmarkbZ\",\"automation_name\":\"TurnOffWhen100\",\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"events\":[{\"params\":{\"Lightbulb\":{\"brightness\":100}},\"check\":\"==\"}],\"actions\":[{\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"params\":{\"Lightbulb\":{\"power\":false}}}],\"status\":[{\"node_id\":\"EPRoUZemZPDiHjKrHoD74f\",\"status\":\"success\",\"description\":\"Node automation triggered\"}]}}},\"mutable-content\":1}}" } |
8. Node Shared with User
Android | iOS | ||
---|---|---|---|
user1 | user2 | user1 | user2 |
Scenario: user1 sends a node sharing request to user2
|
|||
Scenario: user2 accepts the node sharing request
|
|||
Scenario: user2 denies the node sharing request
|
|||
Scenario: user1 removes the node sharing
|
|||
9. Node Group Shared with User
Android | iOS | ||
---|---|---|---|
user1 | user2 | user1 | user2 |
Scenario: user1 sends a group sharing request to user2
|
|||
Scenario: user2 accepts the group sharing request
|
|||
Scenario: user2 denies the group sharing request
|
|||
Scenario: user1 removes the group sharing
|
|||
Scenario: user2 removes the group sharing
|
|||