Messages¶
The messages
endpoint is used to send text or event. The query messages
return structured data in JSON format with responses from the Virtual Agent for dfferent medium.
URL : api.prisme.ai/v1/Messages
Method : POST
Request example¶
With natural langage¶
curl -X POST \
https://api.prisme.ai/v1/Messages \
-H 'Authorization: Bearer Prisme_Client_Token' \
-H 'Content-Type: application/json' \
-d '{
"text":"I want to drink a coffee and a tea",
"userId":"userId",
"platform":"web"
}'
With event¶
curl -X POST \
https://api.prisme.ai/v1/Messages \
-H 'Authorization: Bearer Prisme_Client_Token' \
-H 'Content-Type: application/json' \
-d '{
"event":"TV_WAIKUP",
"userId":"userId",
"platform":"speaker"
}'
Headers¶
In the request URL, provide the following headers with values.
Key | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer Prisme_Client_Token |
Request body¶
The following parameters are used as JSON keys in the POST body.
Parameter | Type | Description | Required |
---|---|---|---|
userId | String | ID of the user talking with the Virtual Agent | Required |
text | String | Message the user want to send to the Virtual Agent | Required unless you are using event |
event | String | Name of the event that is supposed to trigger an intent, will fallback if doesn't exist | Required unless you are using text |
payload | Object | Object of media (image, audio...) | Optional |
platform | String | Name of the platform used by the user | Required |
Success Response¶
Condition : No required parameter missing and Prisme_Client_Token
is known by the platform.
Code : 200
Content example
{
"id": "ndaCWVgGHCkS9dK9ulmdXhXh5UA",
"timestamp": "2019-08-09T14:25:21+00:00",
"sessionId": "CKxym0sXQX",
"conversationId": "5a4GXmFP8C",
"query": "I want to drink a coffee and a tea",
"fulfillment": [
{
"source": "TestOfBug",
"items": [
{
"text": "Here it is",
"web": "How do you want to pay",
"speaker": "Can you hear me ? I hope you will enjoy your beverage",
"telephony": "Allo ? This will be a great beverage"
},
{
"text": "How do you want to pay ?",
"web": "<ul><li>Credit Card</li><li>Cash</li></ul>"
},
{
"events": [
{
"text": "Hey you!",
"event": "WELCOME"
}
]
}
]
}
],
"intents": [
{
"source": "TestOfBug",
"name": "Order",
"confidence": 1,
"isFallback": false,
"endConversation": false,
"slots": {
"firstBeverage": "coffee",
"secondBeverage": "tea"
}
}
],
"status": {
"code": 200,
"errorType": "success"
}
}
Response body¶
The following parameters are send in the response body.
Parameter | Type | Description |
---|---|---|
query | String | Message the Virtual Agent received from the user if there was a text parameter in the request body |
fulfillment | Array | List of different Virtual Agent fulfillment |
intents | Array | List of intents that are returned Virtual Agents |
actions | Deprecated | |
text | Deprecated | |
textToSpeech | Deprecated |
Fulfillment¶
Parameter | Type | Description |
---|---|---|
items | Array | Sorted list of items from one Virtual Agent to display in that order |
Item¶
Parameter | Type | Description |
---|---|---|
text | String | Default response, simple string |
web | String | Response for web purpose, can contain HTML |
speaker | String | Response for speaker purpose, can contain SSML |
telephony | String | Response for telephony purpose |
links | Object | Object that redirect to a web page. It has parameters : text Text display to the user, and value Website to redirect to |
button | Object | Object that send a text request to the Virtual Agent after a button click. It has parameters : text Text display to the user, and value Query sent to the Virtual Agent |
event | Object | Object that trigger an intent with an event name. It has parameters : text Text display to the user, and value Name of the event to send to the Virtual Agent |
cards | Array | List of cards to display to the user. It can contain parameters : title , text , image , links , buttons and event |
Intent¶
Parameter | Type | Description |
---|---|---|
source | String | Name of the Virtual Agent that found this intent |
name | String | Name of the Intent |
confidence | String | Confidence score for the intent. Goes from 0 to 1 with 1 as the maximum confidence |
isFallback | Boolean | True if the intent is a fallback intent |
endConversation | Boolean | True if the conversation with the user just finished |
slots | Object | Object with entities names as keys and entity values as value |