Grab push tokens and map them with Routee contacts

Overview

The proposed solution to efficiently manage the delivery of multiple push notifications to various devices involves the implementation of a robust database system to store device tokens. These tokens, which are unique identifiers for each device, will be securely saved into the database, creating a reliable repository that facilitates the rapid retrieval of required tokens when a notification needs to be sent. This process ensures that each push notification reaches the correct device, enhancing the effectiveness and precision of the communication strategy.

To further streamline this process, a significant enhancement has been made to the Push Notifications Manager service by introducing a new endpoint: {managerUrl}/messages/{deviceType}. This endpoint is specifically designed for mapping devices to their corresponding Routee IDs based on the type of device. The inclusion of {deviceType} in the endpoint allows for differentiated handling of device tokens based on operating systems or device categories, ensuring that notifications are not only sent accurately but are also compatible with the device specifications.

This structured approach to managing push notifications via a centralized database and a dedicated endpoint allows for high scalability and manageability, accommodating an increasing volume of devices and notifications efficiently. It ensures that as the system grows, the ability to send targeted notifications remains both viable and effective, keeping users engaged and informed across different platforms and devices.

Note: For adding the ImplementationID, here is the complete user guide which can aid you to add the ImplementationID and how it will be visible in the grid. See the reference document.

Flow Diagram

Flow Diagram


Payloads

1. For Android device

curl --location --request POST 'https://{managerUrl}/messages/android' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer b25c5dd4-8ebd-4e42-b987-6f3142f9fa02' \
--data '{
    "routeeContactId": "test1",
    "token": "AndroidToken",
    "implementationId":"66447faae76e4b00011d9cef"
}'
MethodPOST
Pathhttps://{managerUrl}/messages/android
Header - Content Typeapplication/json
Header - AuthorizationBearer <access_token

Request:

--data '{
  "routeeContactId": "64be7af142fe590001a22923",
  "token": “12345678”,
  "implementationId":"66447faae76e4b00011d9cef"
  }'

Response:

200 OK
{
    "routeeContactId": "64be7af142fe590001a22923"
}

Where:

NameRequiredTypeNotes & Validation Checks
routeeContactIdYesStringphone number, email id, unique id.
tokenYesStringDevice token. It is used to identify a specific device
implementationIdYesStringThere should be an implementation with the particular id that belongs to the accountId.
Not blank.


2. For Web device

curl --location --request POST 'https://{managerUrl}/messages/web' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer b25c5dd4-8ebd-4e42-b987-6f3142f9fa02' \
--data '{
    "routeeContactId": "test1",
    "token": "WebToken",
    "implementationId":"66447faae76e4b00011d9cef"
}'
MethodPOST
Pathhttps://{managerUrl}/messages/web
Header - Content Typeapplication/json
Header - AuthorizationBearer <access_token

Request:

--data '{
  "routeeContactId": "64be7af142fe590001a22923",
  "token": “12345678”,
  "implementationId":"66447faae76e4b00011d9cef"
  }'

Response:

200 OK
{
    "routeeContactId": "64be7af142fe590001a22923"
}

Where:

NameRequiredTypeNotes & Validation Checks
routeeContactIdYesStringphone number, email id, unique id.
tokenYesStringDevice token. It is used to identify a specific device
implementationIdYesStringThere should be an implementation with the particular id that belongs to the accountId.
Not blank.


3. For IOS device

curl --location --request POST 'https://{managerUrl}/messages/ios' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer b25c5dd4-8ebd-4e42-b987-6f3142f9fa02' \
--data '{
    "routeeContactId": "test1",
    "token": "IosToken",
    "implementationId":"66447faae76e4b00011d9cef"
}'
MethodPOST
Pathhttps://{managerUrl}/messages/ios
Header - Content Typeapplication/json
Header - AuthorizationBearer <access_token

Request:

--data '{
  "routeeContactId": "64be7af142fe590001a22923",
  "token": “12345678”,
  "implementationId":"66447faae76e4b00011d9cef"
  }'

Response:

200 OK
{
    "routeeContactId": "64be7af142fe590001a22923"
}

Where:

NameRequiredTypeNotes & Validation Checks
routeeContactIdYesStringphone number, email id, unique id.
tokenYesStringDevice token. It is used to identify a specific device
implementationIdYesStringThere should be an implementation with the particular id that belongs to the accountId.
Not blank.

Expected Errors

In case when error occurred, below message will be displayed.


ErrorError CodeTypeNotes & Validation Checks
400-error occuredrouteeContactId: Routee Details not Found, Device Config not found, Error in getting routee Contact