The Sample Push Notification Connector is a Node.js based application that listens for Push Notification requests from Avaya Experience Platform™ and forwards the notifications to the Firebase Cloud Messaging (FCM) service. Apart from hosting the Push Notification Callback URL on which Avaya Experience Platform™ will send the notifications, the application hosts few other APIs that help adding the FCM configuration and registering the device. The key APIs have been described in the below sections
For details on how the Custom Push Notification works, refer the Developer Guide
⚠ WARNING
This application is provided as a sample for the purpose of reference only and shouldn't be used in production.
Manages the Firebase Cloud Messaging (FCM) Config into memory.
PUT http://<hostname>:<port>/custom-notification-connector/{configId}
Content-Type: application/json
Request body:
{
"fcmServiceAccountConfig": {
"type": "service_account",
"project_id": "<fcm-project-id>",
"private_key_id": "<fcm-private-key-id>",
"private_key": "<fcm-preivate-key>",
"client_email": "<fcm-client-email>",
"client_id": "<fcm-client-id>",
"auth_uri": "<google-oauth-uri>",
"token_uri": "<google-token-uri>",
"auth_provider_x509_cert_url": "<google-oauth-cert-uri>",
"client_x509_cert_url": "<client-cert-url>",
"universe_domain": "googleapis.com"
}
}
Response:
{
"configId": "<configId>",
"fcmServiceAccountConfig": {
"type": "service_account",
"project_id": "<fcm-project-id>",
"private_key_id": "<fcm-private-key-id>",
"private_key": "<fcm-preivate-key>",
"client_email": "<fcm-client-email>",
"client_id": "<fcm-client-id>",
"auth_uri": "<google-oauth-uri>",
"token_uri": "<google-token-uri>",
"auth_provider_x509_cert_url": "<google-oauth-cert-uri>",
"client_x509_cert_url": "<client-cert-url>",
"universe_domain": "googleapis.com"
}
}
Registers the device token generated by FCM for the device and FCM project used against the configurationId and Avaya Experience Platform™ sessionId
PUT http://<hostname>:<port>/custom-notification-connector/device-registrations/{deviceToken}
Content-Type: application/json
Request body:
{
"configId": "<configId>",
"sessionId": "<sessionId>"
}
Response:
{
"configId": "<configId>",
"sessionId": "<sessionId>",
"deviceToken": "<device-token-generated-by-fcm>"
}
Push a notification to the registered device
POST http://<hostname>:<port>/custom-notification-connector/notifcations
Content-Type: application/json
Request body:
{
"sessionId": "<sessionId>",
"accountId": "<accountId>",
"message": {
"data": {
"eventId": "<test-event-id>",
"eventDate": "2024-3-13T20:25:39.734Z",
"conversationId": "<test-conversation-id>",
"engagementId": "<test-engagement-id>",
"dialogId": "<test-dialog-id>"
}
}
}
Response:
{
"sessionId": "<sessionId>",
"accountId": "<accountId>",
"message": {
"data": {
"eventId": "<test-event-id>",
"eventDate": "<timestamp in ISO format example: 2024-3-13T20:25:39.734Z>",
"conversationId": "<test-conversation-id>",
"engagementId": "<test-engagement-id>",
"dialogId": "<test-dialog-id>"
}
}
}
The Sample Push Notifcation Connector requires Node JS version v20.9.0 LTS
or above.
- Run
npm install
Once the configuration changes are done, to start server run npm start
.
- Create create a Push notification Configuration in Avaya Experience Platform™ Admin Application and provide the Notification API as the Callback URL.
- Use the Save Config API to save the FCM configuration passing the configuration-id generated in the above step.
- From your Client Application, call the Save Device Registration API passing the device token provided by FCM, configuration-id that was used in the above step, and Avaya Experience Platform sessionId. (Conversation.session.sessionId)
- Once the device is registered, use the Notifcation API to quickly test if the client device is receiving push notifications