Skip to content

Proactive Notifications API

Proactive Notifications allow enterprises to engage with their end users (customers or employees) by providing relevant and timely updates.

Proactive notification includes:

  • Nudge the employees to reset their password before it expires in certain days
  • Remind users to submit expense reports.
  • Inform customers about their order status.
  • Other reminders which are defined.
Method POST
Endpoint https://{{host}}/api/public/bot/{{BotID}}/notify
Content Type application/json
Authorization auth: {{JWT}}

See How to generate the JWT Token.

API Scope
  • Bot Builder: Proactive Messages
  • Admin Console: Channel Management > Proactive Messages

Path Parameters

PARAMETER DESCRIPTION MANDATE
host The environment URL. For example, https://bots.kore.ai Required
BotId Bot ID or Stream ID can be accessed under General Settings on the Bot Builder.

Note: This is required only for Bot Builder API scope of Proactive Messages.

Required

Sample Request

curl --location 'https://{{host}}/api/public/bot/{{BotId}}/notify' \
--header 'Content-Type: application/json' \
--header 'auth: {{jwt-token}}' \
--data-raw '{
"channel": "msteams",
"userIdentityType": "resolve",
"message": {
"type": "text",
"val": "Please reset your password."
},
"identities": [
"pxxxxxxn@koredxtai.onmicrosoft.com"
]
}'

Body Parameters

PARAMETER DESCRIPTION MANDATE
channel Name of the channel for which notifications to be sent

Accepted channel types are:“msteams” and “slack“.

Required
userIdentityType Define whether to resolve the user identities provided in the API call to get the channel identities, or to directly use the user identities for delivering the messages

The values is resolve.

Required
message It is an object and accepts two fields
  • type → Indicates the type of message. “text” for sending plain text and “script” for sending JavaScript templates as messages.
  • val → value of the message to be sent to user. Example 1:Text: { "type": "text", "val": "Hi User" } Example 2: Script:
    {
       "type": "script",
       "val": "var envMsg = 'John'; var channel = context.session.BotUserSession.lastMessage.channel; print(JSON.stringify({text: 'Hi ' + envMsg + ' message is from ' + channel + ' channel'}));" 
    }
Required
identities It accepts the list of user identities for whom notifications need to be sent. A maximum of 1000 identities are supported. Required

Sample Response

{
    "status": "IN_PROGRESS",
    "percentageComplete": 0,
    "streamId": "st-xxxxx-xxx-xxx-xxx-xxxxx",
    "createdBy": "u-xxxxx-xxx-xxx-xxx-xxxxx",
    "jobType": "PROACTIVE_NOTIFICATIONS_API",
    "action": "PROACTIVE_NOTIFICATIONS",
    "statusLogs": [],
    "_id": "ds-xxxxx-xxx-xxx-xxx-xxxxx",
    "lMod": "2022-01-25T06:56:48.000Z",
    "createdOn": "2022-01-25T06:56:48.891Z",
    "requestedTime": "2022-01-25T06:56:48.891Z",
    "__v": 0
}