Bot API is built around REST. You can call our APIs through standard HTTP request with your api key placed in the query parameter. In turn, WOZTELL will return JSON-encoded response, with corresponding data that can determine wether related operations are completed.
Before getting started, you can first download the BotAPI Postman Collection and Environment in JSON
format.
The access token should be placed as a query parameter as accessToken
in the request. The access token can be generated following this guide.
Each API may have different scope, picking any one scope is enough for calling the API.
Security Scheme Type | Query parameter name |
---|---|
API Key | accessToken |
Alternatively, the Access Token can also be put in the authorization header as Bearer Token.
To send responses on behalf of your chatbot to a specific member in WOZTELL.
JSON
WOZTELL allows you to create and manage message template in the platform. When you are sending responses with Bot API, there is a convenient way to obtain the content of a template in JSON
.
JSON
.Authorizations: accessToken(bot:sendResponses
, bot:admin
)
Query Parameters:
Query Parameter | Required | Type | Description |
---|---|---|---|
accessToken | Yes | apiKey | The access token should be placed as a query parameter as accessToken in the request. The access token can be generated following this guide. Each API may have different scope, picking any one scope is enough for calling the API |
Request Body Schema: application/json
Field | Required | Type | Description |
---|---|---|---|
channelId | Yes | String | Channel ID in WOZTELL |
memberId | No | String | Either memberId, recipientId Member ID in WOZTELL |
recipientId | No | String | Either memberId, recipientId Recipient ID in integration. E.g. PSID on Facebook, phone number on WhatsApp, etc (Not guaranteed, please consult integration creator if required) |
response | Yes | array | The data you wish to send as a response. You can construct the response object by referencing from integration documentations or copy from Bot builder. |
Sample Request:
https://bot.api.woztell.com/sendResponses
application/json
Status Code | Description |
---|---|
200 | This request will returns HTTPS code 200 if the bot started execution. In the response body, a JSON String containing a "ok" flag with value 1 indicating execute success. |
Response Body Schema: application/json
Object | Type | Description |
---|---|---|
ok | Int | Value: 1 , status that indicate this request is successfully made or not |
member | String | WOZTELL Member ID |
sendResult | Object | Send result object |
sendResult.ok | Int | Integration server succeed receive response |
sendResult.member | String | WOZTELL Member ID |
sendResult.result | Object | Array of send result from integration server, should have ok , messageEvent , error (Optional) fields for displaying result of each response |
Status Code | Description |
---|---|
500 | This request will returns HTTPS code 500 if encounter error before the bot execution. |
Response Body Schema: application/json
Object | Type | Description |
---|---|---|
ok | Int | Always 0, indicate Bot found error before sending out response to integration server |
err_code | String | Error code in WOZTELL |
error | String | Error message |
Sample Response
application/json
application/json
Redirecting a member to a specific node in tree and executing all or partial components of the node. This is useful for performing complex operations on a member and keeping all the bot logic in the tree instead of hard-coding in an api.
If memberId is not provided, the system would search for a member with the provided recipientId.
To use the API passed meta object in transform response or actions of targeted node, use the following code to access your meta.
Example:
POST https://bot.api.woztell.com/redirectMemberToNode
Authorizations: accessToken(bot:redirectMemberToNode
, bot:admin
, api:admin
)
Query Parameters:
Query Parameter | Requried | Type | Description |
---|---|---|---|
accessToken | Yes | apiKey | The access token should be placed as a query parameter as accessToken in the request. The access token can be generated following this guide. Each API may have different scope, picking any one scope is enough for calling the API |
Request Body Schema: application/json
Field | Required | Type | Description |
---|---|---|---|
channelId | Yes | String | Channel ID in WOZTELL |
memberId | No | String | Either memberId, recipientId Member ID in WOZTELL |
recipientId | No | String | Either memberId, recipientId Recipient ID in integration. E.g. PSID on Facebook, phone number on WhatsApp, etc (Not guaranteed, please consult integration creator if required) |
redirect | Yes | Object | The target node you wish to redirect to. |
redirect.tree | Yes | String | Target tree you wish to redirect to. |
redirect.nodeCompositeId | Yes | String | Target node you wish to redirect to. |
redirect.runPreAction | No | Boolean | Redirect execute pre-action; can be set as true or false |
redirect.sendResponse | No | Boolean | Redirect send response; can be set as true or false |
redirect.runPostAction | No | Boolean | Redirect execute post-action; can be set as true or false |
meta | No | Object | Optional Meta object provided to the node. Meta object can be accessed in target node via this.agendaMeta . |
Sample Request
Content type: application/json
Status Code | Description |
---|---|
200 | This request will returns HTTPS code 200 if the bot started execution. |
Response Body Schema: application/json
Object | Type | Description |
---|---|---|
ok | Int | Always 1, indicate Bot executed send response command |
member | String | WOZTELL Member ID |
sendResult | Object | Send result |
sendResult.ok | Int | Integration server succeed receive response |
sendResult.member | String | WOZTELL Member ID |
sendResult.result | [Object] | Array of send result from integration server, should have ok , messageEvent , error (Optional) fields for displaying result of each response |
Status Code | Description |
---|---|
500 | This request will returns HTTPS code 500 if encounter error before the bot execution. |
Object | Type | Description |
---|---|---|
ok | Int | Always 0, indicate Bot found error before sending out response to integration server |
err_code | Int | Error code in WOZTELL |
error | String | Error message |
Sample Response
application/json
application/json
WOZTELL will return corresponding error codes to the request side when there is an error occurred.
Code | Description |
---|---|
100 | Phone Number provided is invalid. Either the number does not exist or does not have a linked WhatsApp account |
104 | Facebook PSID is invalid or the access token resides in the designated channel is invalid |
108 | Parameter(s) is missing |
112 | Channel with the corresponding channelId cannot be found |
113 | WhatsApp server Error |