REST example
This example shows how you can use the EngageOne™ Communicate API endpoints to trigger email sending in Communicate. In this example, to email the user a transcript of their conversation with the chatbot.
There are three actions and one message interaction.
Example of action interactions in a chatbot
Note: See API Usage for details of the Communicate API.
Get Chat History action
This action configures the bot to make an HTML transcript of the messages sent between the bot and the user available in the current session (the
context
object):context.chatHistory = system.getChatHistory();
A Set Variable action type is used for this.
EOCM Token action
This action configures the bot to request a machine to machine authentication token from Communicate.
Action type | REST |
Endpoint | https://usersapi.communicate.engageone.co/authenticate |
Method | POST |
Body | Pass the credentials for your Communicate account. You obtain these from the Company Management page in Communicate. For example:
|
Variable Name | Stores the authorization token returned by Communicate in the session. |
EOCM Send Email action
This action configures the bot to trigger Communicate to send an email to the user set in the body of the request.
Action type | REST |
Endpoint | https://api.us-east-1.communicate.engageone.co |
Method | POST |
Authorization | The authorization token acquired from Communicate. For example:
|
Headers | Your Communicate customer ID:
|
Body | The data required by the communication in Communicate. The data must conform to the schema of the data source selected for the communication. For example:
|