Pushing Metrics Events Logs to SNS for Analytics - WideChat/Rocket.Chat GitHub Wiki
Goal
To push metrics and event data from the Livechat widget and RC Apps to SNS Topic(Ciao Analytics Service).
Links
Frontend Analytics Wiki: https://wiki.viasat.com/pages/viewpage.action?spaceKey=ACC&title=Frontend+Analytics
Analytics, Monitoring, and Alerting Wiki: https://wiki.viasat.com/display/ACC/Analytics%2C+Monitoring%2C+and+Alerting
Diagram
Design
The Livechat widget and RC Apps will communicate with the Rocket.Chat server and the server will push logging/metric/event data to SNS Topic
RC Server
- Amazon SNS SDK will be used to push data to SNS Topic(Ciao Analytics Service) https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/sns-examples-publishing-messages.html
- Administration will have settings to configure SNS Sdk i.e. SNS Topic ARN, Region, Application, Bussiness, or any other data required in using Amazon SNS SDK
- AnalyticsLogger will be created using SNS SDK which will push data to SNS Topic
LiveChat Widget
- Livechat widget communicates to Rocket.Server using Websocket/REST APIs(using Rocket.chat.js.sdk). For this use case, we will use REST API.
- Server uses AnalyticsLogger to push data.
RC App
- RC Apps communicates to Rocket.Server using AppBridges(i.e. Settings Bridge / APIs Bridge etc https://github.com/WideChat/Rocket.Chat/blob/develop_pwa/app/apps/server/bridges/bridges.js)
- We will need to create AppBridge in the Rocket.Chat.Apps-engine for our use case.
- App will use this bridge to pass data to the server
- Server uses AnalyticsLogger to push data.
Example Payload
{
"application": "WhatsApp",
"business": "BR",
"ciao_deployment": "brazil-prod",
"dialogflow_agent_id": "b5983b72-cac6-4f85-b9d0-be61e543dfe6",
"event": "outage_info_requested",
"event_detail_1": "none",
"event_detail_2": "none",
"event_detail_3": null,
"event_detail_4": null,
"event_type": "customer_action",
"party_id": "3a5bf619-6353-4412-a21b-bf2b1eab94db",
"session_id": "dfcx:b5983b72-cac6-4f85-b9d0-be61e543dfe6:wqbFXoeX2kdSZhSyi",
"source_component": "Ciao",
"timestamp": 1651688848191
}
Open Questions
- What's the latest minimal required payload?
- If the payload requires
dialogflow_agent_id
/ciao_deployment
, from where to get that? One option is to make it configurable in DF App settings