Consume ntm-message-service

NTM Message Service can be used to:

  1. Publish a message to one's own channel
  2. Send a message to one's own application users
  3. Send a message to a specific user
  4. Retrieve messages of a specific user
  5. Retrieve messages of a specific application
  6. Retrieve scheduled messages which are active

For detailed information on each parameter in the request body, refer NTM Message Definition

Sample Requests:

POST: /message

A Message ID will be generated after making a POST request. The following sample cURL is a message cURL destined to two users "abc@slb.com" and "def@slb.com"

Sample cUrlSample Output
curl -X POST \
   'https://api.delfi.slb.com/ntm/v1/message' \
   -H 'Authorization: Bearer <your-ccg-token>' \
   -H 'AppKey: <your-appkey>'\
   -H 'Cache-Control: no-cache' \
   -H 'Content-Type: application/json' \
   -d '{
     "sourceUserId": "",
     "sourceAppTag": "",
     "messageMediaType": "",
     "messageTitle": "New Contract",
     "messageText": "NTM created a new contract",
     "messageSendAt": "",
     "messageExpiresAt": "",
     "destinationUserId": [
         "abc@slb.com",
         "def@slb.com"
     ],
     "context": {
         "account": "Account A",
         "contract": "Contract C",
         "department": "Department D"
       }
     }'
{
   "Message": "493dad1c-6082-4bb5-8e3a-2611cd847754"
}

GET: /message/application

Sample cUrlSample Output
curl -X GET \
   'https://api.delfi.slb.com/ntm/v2/message/application' \
   -H 'Authorization: Bearer <your-ccg-token>' \
   -H 'AppKey: <your-appkey>'\
   -H 'Cache-Control: no-cache' \
[
   {
     "contextAccount": "Account A",
     "contextContract": "Contract C",
     "contextDepartment": "Department D",
     "destinationUserId": "",
     "destinationAppId": "ntm-master-svc-ntm.slbservice.com",
     "messageId": "15601d8d-74f2-4750-b998-56cf6108c75c",
     "messageText": "",
     "messageTimestamp": "2018-08-13 17:08:30.417052351 +0000 UTC",
     "messageTitle": "New Contract",
     "sourceAppId": "ntm-master-svc-ntm.slbservice.com"
   }
]

GET: /message/user

The following sample cURL is a message cURL destined to a single user "def@slb.com"

Sample cUrlSample Output
curl -X GET \
   'https://api.delfi.slb.com/ntm/v2/message/user' \
   -H 'Authorization: Bearer <your-user-exchange-token>' \
   -H 'AppKey: <your-appkey>' \
   -H 'Cache-Control: no-cache' \
   -H 'Postman-Token: 645076e9-2132-49e0-ac4f-71138ba219e6'
[
   {
     "contextAccount": "Account A",
     "contextContract": "Contract C",
     "contextDepartment": "Department D",
     "destinationUserId": "def@slb.com",
     "destinationAppId": "ntm-master-svc-ntm.slbservice.com",
     "messageId": "15601d8d-74f2-4750-b998-56cf6108c75c",
     "messageText": "",
     "messageTimestamp": "2018-08-13 17:08:30.417052351 +0000 UTC",
     "messageTitle": "New Contract",
     "sourceAppId": "ntm-master-svc-ntm.slbservice.com"
   }
]

GET: /message/schedule

The following sample cURL is used to retrieve scheduled messages by active status.

Sample cUrlSample Output
curl -X GET \
   'https://api.delfi.slb.com/ntm/v1/message/schedule' \
   -H 'Authorization: Bearer <your-CCG-token>' \
   -H 'AppKey: <your-appkey>' \
   -H 'Cache-Control: no-cache' \
   -H 'Postman-Token: 645076e9-2132-49e0-ac4f-71138ba219e6'
{"pageCursor": "eyJMaW1pdCI6NTAsIlBhZ2UiOjIsIk9yZGVyQnkiOiItQ3JlYXRlZEF0In0",
"scheduledMessages" : "[
{
“contextAccount”: “Account A”,
“contextContract”: “Contract C”,
“contextDepartment”: “Department D”,
“originMessageId”: “2ebc852b-dca3-4910-9374-a2ee83a1c670”,
“messageText”: “”,
“messageTimestamp”: “2018-08-13 17:08:30.417052351 +0000 UTC”,
“messageTitle”: “New Contract”,
“messageSendAt”: "2024-04-09 00:00:00 +0000 UTC"
}
]"}