Interactions

GET /interactions

Path

GET "https://api.botengine.ai/stories/:story/interactions"

Example request

curl -X GET \
  https://api.botengine.ai/stories/58ee11d75fb5580005cb8199/interactions \
  -H 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}'

Example response

[
  {
    "name": "example interaction",
    "action": "",
    "userSays": [
      "hi! {{example:example}}"
    ],
    "triggers": [],
    "parameters": [
      {
        "entity": "example",
        "alias": "example",
        "prompts": []
      }
    ],
    "responses": [
      {
        "type": "text",
        "messages": ["Hello", "Hi"]
      },
      {
        "type": "text",
        "messages": ["What I can do for you?"]
      }
    ],
    "webhook": "",
    "id": "58ee132a5fb5580005cb819d"
  }
]

Returns list of all interactions for the story with the specified id

GET /interactions/:id

Path

GET "https://api.botengine.ai/stories/:story/interactions/:id"

Example request

curl -X GET \
  https://api.botengine.ai/stories/58ee11d75fb5580005cb8199/interactions/58ee132a5fb5580005cb819d \
  -H 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}'

Example response

{
  "name": "example interaction",
  "action": "",
  "userSays": [
    "hi! {{example:example}}"
  ],
  "triggers": [],
  "parameters": [
    {
      "entity": "example",
      "alias": "example",
      "prompts": []
    }
  ],
  "responses": [
     {
       "type": "text",
       "messages": ["Hello", "Hi"]
     },
     {
       "type": "text",
       "messages": ["What I can do for you?"]
     }
  ],
  "webhook": "",
  "id": "58ee132a5fb5580005cb819d"
}

Returns single interaction for the given id for the story with the specified id

POST /interactions

Path

POST "https://api.botengine.ai/stories/:story/interactions"

Example request

curl -X POST \
  https://api.botengine.ai/stories/58ee11d75fb5580005cb8199/interactions \
  -H 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
  -H 'content-type: application/json' \
  -d '{
    "name": "test",
    "action": "",
    "triggers": [],
    "userSays": [
        "{{example:example}}"
    ],
    "parameters": [
        {
            "alias": "example",
            "entity": "example",
            "prompts": []
        }
    ],
    "responses": [
        {
          "type": "text",
          "messages": ["Hello", "Hi"]
        }
    ],
    "webhook": ""
}'

Example response

{
  "id": "58ee25f85fb5580005cb81a1",
  "timestamp": "2017-04-12T13:04:56.413Z",
  "status": {
    "code": 200,
    "errorType": "success"
  }
}

Update entity with the given id.

Required parameters

Property Type Description
name String Interaction name
Max: 1024
action String The name of the action
Max: 1024
triggers Array.<String> Array max size: 1024
String max: 50
userSays Array.<String> Array max size: 99
String max: 2048
parameters Array.<Object> Array max size: 99
parameters.alias String Max: 128
parameters.entity String Max: 128
parameters.prompts Array.<String> Array max size: 99
String max: 1024
responses Array.<Object> Array max size: 11
webhook String url

Response array

Response array should contain objects with structure dependent on type of response.

Text response

parameter type value max required
type string text - yes
messages array - 20 yes

messages

parameter type value max required
message string - 2048 yes

Quick reply

parameter type value max required
type string quickReply - yes
title string - 80 yes
replies array - 11 yes

replies

parameter type value max required
message string - 2048 yes

Image

parameter type value max required
type string image yes
imageUrl string - 2048 yes

Card response

parameter type value max required
type string card - yes
title string - 80 yes
subtitle string - 80 yes
imageUrl string - 2048 yes
buttons array - 11 yes

buttons

parameter type value max required
title string - 20 yes
postback array - 2048 yes

Button template

parameter type value max required
type string buttonTemplate - yes
title string - 80 yes
buttons array - 11 yes

buttons

parameter type value max required
title string - 20 yes
postback array - 2048 yes

POST /interactions/:contextId

Path

POST "https://api.botengine.ai/stories/:story/interactions/:contextId"

Example request

curl -X POST \
  https://api.botengine.ai/stories/58ee11d75fb5580005cb8199/interactions/58ee25f85fb5580005cb81a1 \
  -H 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
  -H 'content-type: application/json' \
  -d '{
    "name": "child interaction",
    "action": "",
    "userSays": [
        "test3"
    ],
    "parameters": [],
    "responses": [
        {
          "type": "text",
          "messages": ["What I can do for you?"]
        }
    ],
    "webhook": "",
    "triggers": []
}'

Example response

{
  "id": "58ee28dc5d033800059a3f79",
  "timestamp": "2017-04-12T13:17:16.749Z",
  "status": {
    "code": 200,
    "errorType": "success"
  }
}

Create new child interaction for interaction with specified id

Required parameters

Property Type Description
name String Interaction name
Max: 1024
action String The name of the action
Max: 1024
triggers Array.<String> Array max size: 1024
String max: 50
userSays Array.<String> Array max size: 99
String max: 2048
parameters Array.<Object> Array max size: 99
parameters.alias String Max: 128
parameters.entity String Max: 128
parameters.prompts Array.<String> Array max size: 99
String max: 1024
responses Array.<Object> Array max size: 11
webhook String url

Body

{
    "name": "child interaction",
    "action": "",
    "triggers": [],
    "userSays": [
        "test3"
    ],
    "parameters": [],
    "responses": [
        {
          "type": "text",
          "messages": ["What I can do for you?"]
        }
    ],
    "webhook": ""
}

PUT /interactions/:id

Path

PUT "https://api.botengine.ai/stories/:story/interactions/:id"

Example request

curl -X PUT \
  https://api.botengine.ai/stories/58ee11d75fb5580005cb8199/interactions/58ee25f85fb5580005cb81a1 \
  -H 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
  -H 'content-type: application/json' \
  -d '{
    "name": "book a hotel",
    "action": "book.hotel",
    "userSays": [
        "book a hotel in {{city:city}}"
    ],
    "parameters": [
        {
            "alias": "city",
            "entity": "city",
            "prompts": [
                "where?"
            ]
        }
    ],
    "responses": [
        {
          "type": "text",
          "messages": ["room in {{city}} has been reserved"]
        }
    ],
    "triggers": []
}'

Example response

{
  "timestamp": "2017-04-12T13:20:23.635Z",
  "status": {
    "code": 200,
    "errorType": "success"
  }
}

Update interaction with the given id.

Required parameters

Property Type Description
name String Interaction name
Max: 1024
action String The name of the action
Max: 1024
triggers Array.<String> Array max size: 1024
String max: 50
userSays Array.<String> Array max size: 99
String max: 2048
parameters Array.<Object> Array max size: 99
parameters.alias String Max: 128
parameters.entity String Max: 128
parameters.prompts Array.<String> Array max size: 99
String max: 1024
responses Array.<Object> Array max size: 11
webhook String url

Body

{
    "name": "book a hotel",
    "action": "book.hotel",
    "userSays": [
        "book a hotel in {{city:city}}"
    ],
    "parameters": [
        {
            "alias": "city",
            "entity": "city",
            "prompts": [
                "where?"
            ]
        }
    ],
    "responses": [
        {
          "type": "text",
          "messages": ["room in {{city}} has been reserved"]
        }
    ],
    "triggers": []
}

PUT /contexts

Path

PUT "https://api.botengine.ai/stories/:id/contexts"

Example request

curl -X PUT \
  https://api.botengine.ai/stories/58ee11d75fb5580005cb8199/contexts \
  -H 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
  -H 'content-type: application/json' \
  -d '[
  {
    "id": "58ee25f85fb5580005cb81a1",
    "root": true,
    "references": [],
    "contextOut": ["58ee132a5fb5580005cb819d"]
  }
]'

Example response

{
  "timestamp": "2017-04-12T13:27:10.907Z",
  "status": {
    "code": 200,
    "errorType": "success"
  }
}

Update contexts of interaction with the given id.

Required parameters

Property Type Description
id String Interaction name
Max: 1024
root Boolean Is root interaction
references Array.<String> Array max size: 50
contextOut Array.<String> Array max size: 50

Body

[
  {
    "id": "58ee25f85fb5580005cb81a1",
    "root": true,
    "references": [],
    "contextOut": ["58ee132a5fb5580005cb819d"]
  }
]

DEL /interactions

Path

DELETE "https://api.botengine.ai/stories/:story/interactions"

Example request

curl -X DELETE \
  https://api.botengine.ai/stories/58ee11d75fb5580005cb8199/interactions \
  -H 'authorization: Bearer ${DEVELOPER_ACCESS_TOKEN}' \
  -H 'content-type: application/json' \
  -d '[
    "585bbaf5ecea28f52a899f3b",
    "585bbafaecea28f52a899f3c"
]'

Example response

{
  "timestamp": "2017-04-12T13:30:07.445Z",
  "status": {
    "code": 200,
    "errorType": "success"
  }
}

Remove interactions with the given id's.

Body

[
    "585bbaf5ecea28f52a899f3b",
    "585bbafaecea28f52a899f3c"
]