API Docs
Last updated
Last updated
Use the /api/v1/gateway/default/DEVEOPER_ID/SCOPE_ID
endpoint to send a message to the Mind Expression API, where the Mind Expression CAI will receive your message query and respond according to the configurations of your subjects. You can configure the responses with multiple types of templates and formats, presenting you with the flexibility to format messages on your platform.
Endpoint | Authentication |
---|---|
Engine URL - You can get this on the integration page. This is the main URL you will use to access the API’s endpoint.
Auth Key - This is the authorization token on the integration page. This token is used to authorize your access to the Mind Expression API.
All messages are contained with a conversation with a unique ID in the UUID format. On the first message that will start a new conversation, the Mind Expression API will return a 202 along with the conversation ID in which the user must return in the request header in order to continue the conversation. Messages without this header will be considered as a new conversation and might result in unintended behaviors.
Custom Object can be any JSON object.
{
"user-name": "Jane Doe"
}
HTTP Header
Content-Type: application/json
Authorization: Bearer bWluZC1haTpyZWFsam9obmRvZQ
platform: ANDROID
HTTP Body
{
"query": "Hello",
"query-id": "1c4339cd-d53a-489e-85f3-50a14d1da658",
"timestamp": 1697768070001,
"custom": {
"user-name": "Jane Doe"
}
}
Mindscript code Example
The following code can be added to the Program Logic(Before/After)
of the Mind Expression.
"Get HTTPHeader"
platform := self httpHeaders at: 'platform' ifAbsent: 'IOS'.
"Get HTTPBody"
userName := self httpRequestBody at: 'user-name' ifAbsent: 'John Doe'.
The Mind Expression API will return the list of response messages and the status code for the response.
Request Header
“Authorization”: “bWluZC1haTpyZWFsam9obmRvZQ==”
“X-Conversation-Id”: NULL
“UUID”: “cab64bcd-9e97-424e-b786-30b617615e02”
Request Payload
{
"query": null,
"query-id": "1c4339cd-d53a-489e-85f3-50a14d1da658",
"timestamp": 1676943114143
}
{
"description": "Created",
"code": 202,
"data": {
"channel-result": null,
"result": [
"Hello, how may I help you?"
],
"execution-time": 79,
"timestamp": 1676940742565,
"query-id": "ddcd29e6-209e-4896-a0e1-00c16678c331",
"conversation_id": "408b6dca-fc5e-4be7-b5a9-cfa9d6c61a3c"
}
}
Request Header
“Authorization”: “bWluZC1haTpyZWFsam9obmRvZQ==”
“X-Conversation-Id”: NULL
“UUID”: “cab64bcd-9e97-424e-b786-30b617615e02”
Request Payload
{
"query": "Hello",
"query-id": "1c4339cd-d53a-489e-85f3-50a14d1da658",
"timestamp": 1676943114143
}
{
"description": "Created",
"code": 202,
"data": {
"channel-result": [
{
"channel-message": {
"channel-name": "default",
"template-type": "text",
"template": "Hello from Mind Expression",
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
},
"channel-message-alt": {
"channels": [
{
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
}
]
},
"channel-instruction": {
"channel-name": "default",
"template-type": "text",
"template": "Hi there",
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
},
"channel-instruction-alt": {
"channels": [
{
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
}
]
}
}
],
"result": [
""
],
"execution-time": 79,
"timestamp": 1676940742565,
"query-id": "ddcd29e6-209e-4896-a0e1-00c16678c331",
"conversation_id": "408b6dca-fc5e-4be7-b5a9-cfa9d6c61a3c"
}
}
Request Header
“Authorization”: “bWluZC1haTpyZWFsam9obmRvZQ==”
“X-Conversation-Id”: “4355d048-2438-405d-aac5-c04ce7086dcf”
“UUID”: “cab64bcd-9e97-424e-b786-30b617615e02”
Request Payload
{
"query-id": "ddcd29e6-209e-4896-a0e1-00c16678c331",
"query": "Can I upgrade my mobile package?",
"timestamp": 1615862988000
}
{
"description": "Created",
"code": 202,
"data": {
"channel-result": [
{
"channel-message": {
"channel-name": "default",
"template-type": "text",
"template": "Hello from Mind Expression",
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
},
"channel-message-alt": {
"channels": [
{
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
}
]
},
"channel-instruction": {
"channel-name": "default",
"template-type": "text",
"template": "Hi there",
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
},
"channel-instruction-alt": {
"channels": [
{
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
}
]
}
}
],
"result": [
""
],
"execution-time": 79,
"timestamp": 1676940742565,
"query-id": "ddcd29e6-209e-4896-a0e1-00c16678c331",
"conversation_id": "408b6dca-fc5e-4be7-b5a9-cfa9d6c61a3c"
}
}
{
"description": "Created",
"code": 202,
"data": {
"channel-result": [
{
"channel-message": {
"channel-name": "default",
"template-type": "quick_reply",
"template": "How are you today?",
"image-url": "",
"upload-type": "",
"quick-replies": [
{
"label": "Good",
"message": "I'm good, thanks.",
"type": "message",
"image-url": null,
"url": null
},
{
"label": "Not good",
"message": "Not so good, I'm afraid.",
"type": "message",
"image-url": null,
"url": null
}
],
"card-list": []
},
"channel-message-alt": {
"channels": [
{
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
}
]
},
"channel-instruction": {
"channel-name": "default",
"template-type": "text",
"template": "Hello from Mind Expression.",
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
},
"channel-instruction-alt": {
"channels": [
{
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
}
]
}
}
],
"result": [
""
],
"execution-time": 79,
"timestamp": 1676945014202,
"query-id": "ddcd29e6-209e-4896-a0e1-00c16678c331",
"conversation_id": "527998fc-f03c-47fd-9b7a-0624d5f341f0"
}
}
{
"description": "Ok",
"code": 200,
"data": {
"channel-result": [
{
"channel-message": {
"template-type": null,
"template": "",
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": [],
"channels": []
},
"channel-message-alt": {
"channels": []
},
"channel-instruction": {
"channel-name": "default",
"template-type": "card",
"template": "",
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": [
{
"title": "Welcome to Mind Expression",
"sub-title": "This is an example subtitle.",
"image-url": "https://mind-expression.s3.amazonaws.com/builder/dev/QlXUT7-1SpOQQH7IUavSOw_mind_intro_poster_20200101.jpg",
"buttons": [
{
"button-type": "link",
"label": "Go to Website",
"link": "https://mindx.mind.ai",
"message": null
}
]
}
]
},
"channel-instruction-alt": {
"channels": [
{
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
}
]
}
},
{
"channel-message": {
"channel-name": "default",
"template-type": "text",
"template": "Would you like to buy some?",
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
},
"channel-message-alt": {
"channels": [
{
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
}
]
},
"channel-instruction": {
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
},
"channel-instruction-alt": {
"channels": [
{
"channel-name": "default",
"template-type": "text",
"template": null,
"image-url": "",
"upload-type": "",
"quick-replies": [],
"card-list": []
}
]
}
}
],
"result": [
""
],
"execution-time": 38,
"timestamp": 1676945335480,
"query-id": "ddcd29e6-209e-4896-a0e1-00c16678c331",
"conversation_id": "527998fc-f03c-47fd-9b7a-0624d5f341f0"
}
}