Skip to main content

Public API for Inbox Integration

Introduction

The Public Integration API enables you to perform certain actions with the Inbox Integration without the need to operate in the platform UI. With the Integration API, you can also control the inbox integration with chatbot logic.

API Endpoint

Please use the following Endpoint URL for the Public Integration API:
https://api.inbox.woztell.sanuker.com/v1.0/

Authentication

To perform authentication for Integration APIs, it is needed to utilize the corresponding Payload and SignedContext which is required by the integration.

  • Payload: {"appIntegration":"appIntegrationId","app":"appId"}
  • SignedContext: (signature).{{base64(JSON.stringify(payload))}}
  1. Obtain the information related to the Inbox Integration by querying the installedIntegrations with Open API.

Request:

query {
apiViewer{
installedIntegrations{
appId
_id
signature
integrationId
}
}
}

Response:

{
"data": {
"apiViewer": {
"installedIntegrations": [
{
"appId": "62062c0b717195320192b18f7",
"_id": "6420fig28e65b466d4607ea2",
"signature": "mKq60mpKn/YzaP5123tWU+AWX65LqT6BHkBIfq9d3os=",
"integrationId": "inbox"
}
]
}
}
}
  1. Create Payload with in the following format:

    {"appIntegration":"appIntegrationId","app":"appId"}

Example Payload:

{"appIntegration":"6420fig28e65b466d4607ea2","app":"62062c0b717195320192b18f7"}
  1. Encode the Payload Base64 format

  2. Combine the encoded Payload and Signature in order to create the SignedContext in the following format:

    (signature).{{base64(JSON.stringify(payload))}}

Example SignedContext

mKq60mpKn/YzaP5123tWU+AWX65LqT6BHkBIfq9d3os.eyJhcHBJbnRlZ3JhdGlvbiI6IjY0MjBmaWcyOGU2NWI0NjZkNDYwN2VhMiIsImFwcCI6IjYyMDYyYzBiNzE3MTk1MzIwMTkyYjE4ZjcifQ==
  1. Add them to the header as the X-Woztell-Payload and X-Woztell-SignedContext.

GET /list-threads

This API is for getting a list of threads.

Authentication

For the authentication, please follow this guide to fill in the X-Woztell-Payload and X-Woztell-SignedContext in the header.

Parameters

NameTypeDescriptionRequired
channelIdstringFilter Threads by ChannelNo
folderIdstringFilter Threads by FolderNo
memberIdstringFilter Threads by MemberNo
externalIdstringFilter Threads by Member using ExternalIdNo
threadIdstringFilter Threads by Thread IDNo
userIdstringFilter Threads by Assignee of the threadNo
limitintegerControls the amount of threads return (Default value : 10)No
afterstringFor getting next batch of threads, can be obtained from paging.cursors in the responseNo
beforestringFor getting next batch of threads, can be obtained from paging.cursors in the responseNo

Request:

curl --location --request GET 'https://api.inbox.woztell.sanuker.com/v1.0/api/list-threads?folderId=main&limit=10'

Response:

{
"ok": 1,
"data": [
{
"channelId": "string",
"memberId": "string",
"externalId": "string",
"userId": "string",
"threadId": "T0000027",
"title": "Test User",
"folder": "main"
}
],
"paging": {
"cursors": {
"after": "NjU5N2I1MDZkOTcyYTMzNzU3ZTM3ZDgz",
"before": "NjRhZTE5Yjg3MzQ0YjA1YzM2ZmMyOWQw"
},
"hasPrevious": true,
"hasNext": true
}
}

GET /list-users

This API is for getting a list of inbox users.

Authentication

For the authentication, please follow this guide to fill in the X-Woztell-Payload and X-Woztell-SignedContext in the header.

Parameters

NameTypeDescriptionRequired
channelIdstringFilter Users by Channel (Agent Data like agentRole, name, email and icon are based on the Channel's Agent Data)No
folderIdstringFilter Users based on who has access to the FolderNo
userIdstringFilter User by User's Woztell IDNo
memberIdstringFilter User by MemberNo
externalIdstringFilter User by Member using ExternalIdNo
threadIdstringFilter User by ThreadIdNo
limitintegerControls the amount of users return Default value : 10No
afterstringFor getting next batch of users, can be obtained from paging.cursors in the responseNo
beforestringFor getting previous batch of users, can be obtained from paging.cursors in the responseNo

Request:

curl --location --request GET 'https://api.inbox.woztell.sanuker.com/v1.0/api/list-users?folderId=main&userId=632a6743a63fdf590c994a77&channelId=6486be9adfc4ee3ff9d39348'

Response:

{
"ok": 1,
"data": [
{
"userId": "6474449cdfc4ee3646d392bf",
"role": "ADMIN",
"agentRole": "MANAGER",
"channel": "6474449cdfc4ee3646d392bd",
"name": "Test User",
"email": "test_user@email.com",
"icon": "string"
}
],
"paging": {
"cursors": {
"after": "NjU5N2I1MDZkOTcyYTMzNzU3ZTM3ZDgz",
"before": "NjRhZTE5Yjg3MzQ0YjA1YzM2ZmMyOWQw"
},
"hasPrevious": true,
"hasNext": true
}
}

POST /update-thread-folder

This API is for assigning a thread to a specific folder.

Authentication

For the authentication, please follow this guide to fill in the X-Woztell-Payload and X-Woztell-SignedContext in the header.

Parameters:

NameTypeDescriptionRequired
memberIdstringMember IDYes
folderIdstringFolder IDYes

Endpoint:

https://api.inbox.woztell.sanuker.com/v1.0/update-thread-folder

Request:

{
"memberId": "920o80371234550009a01abd",
"folderId": "test-folder"
}

Response:

{
"ok": 1,
"thread": {
"_id": "640a123opp71ee2b943ed283",
"wAppId": "90283b9b71780112208b18f7",
"wChannelId": "621f29ae4e11986de280e29d",
"wMemberId": "630d8962168350009a01acd",
"_version": 2,
"createdAt": 1678377627235,
"etag": "d-bkiiEXyVO8CtQ9cHw/5zjO581rM",
"externalId": "8521234567",
"folder": "test-folder",
"lastChatAt": 1682454661289,
"lastMessage": "[Bot] Hello there!",
"threadId": "T0000999",
"title": "John Lee",
"updatedAt": 1682661372214,
"lastReadAt": 1682487947711,
"unreadCount": 0
}
}

POST /update-thread-agent

This API is for adding or removing an assignee of a thread.

Authentication

For the authentication, please follow this guide to fill in the X-Woztell-Payload and X-Woztell-SignedContext in the header.

Parameters:

NameTypeDescriptionRequired
memberIdstringMember IDYes
userIdstringUser ID of the team memberYes
Notes

The User ID of a team member can be obtained from the teamMembers of Open API.

query {
apiViewer{
app {
_id
teamMembers{
user{
_id
email{
email
}
}
}
}
}
}

Endpoint:

https://api.inbox.woztell.sanuker.com/v1.0/update-thread-agent

Request:

To add an assignee

{
"memberId": "64744e15bdcca70008a4358f",
"userId": "632a6743a63fdf590c994a77"
}

To remove an assignee

{
"memberId": "64744e15bdcca70008a4358f",
"userId": null
}

Response:

{
"ok": 1,
"thread": {
"_id": "66892602f94ff12ece18f325",
"wAppId": "62062b9b71780332208b18f7",
"wChannelId": "636ccf9ff3cfa1164f3e1d1d",
"wMemberId": "636cd3d81daca40008296f08",
"_version": 2,
"createdAt": 1685530114217,
"etag": "d-NHYurKhPB+vkbZKV87SrRXRvl+0",
"externalId": "85254063598",
"folder": "main",
"lastChatAt": 1705381701000,
"lastMessage": "image_test",
"threadId": "T0000035",
"title": "Decco Ip",
"updatedAt": 1705487316616,
"lastReadAt": 1705461548278,
"unreadCount": 0,
"wUserId": "5c0e33c7502129b7ac9e143f"
}
}

POST/ update-thread-title

This API is for updating the title of a thread.

Authentication

For the authentication, please follow this guide to fill in the X-Woztell-Payload and X-Woztell-SignedContext in the header.

Parameters:

NameTypeDescriptionRequired
memberIdstringId of the member belonging to the threadEither memberId or threadId
threadIdstringId of the thread.Either threadId or memberId
titlestringThe new thread titleYes

Endpoint

https://api.inbox.woztell.sanuker.com/v1.0/update-thread-title

Request

{
"memberId": "6475559cdfc4ee3646d392bb",
// or "threadId": "T0000027",
"title": "John (Key Client)"
}

Response

{
"ok": 1,
"thread": {
"_id": "6475559cdfc4ee3646d392bb",
"_version": 2,
"etag": "d-x9crPvAd751WYspgcj0cBtisySE",
"wAppId": "6475559cdfc4ee3646d392bb",
"wChannelId": "6474449cdfc4ee3646d392bd",
"wMemberId": "6474449cdfc4ee3646d392be",
"externalId": "5466281980129353",
"wUserId": "6474449cdfc4ee3646d392bf",
"threadId": "T0000027",
"createdAt": 1686541076488,
"updatedAt": 1686541076488,
"lastReadAt": 1686541076488,
"lastChatAt": 1686541076488,
"unreadCount": 0,
"title": "John (Key Client)",
"folder": "main"
}
}

POST/ internal-message

This API is for sending an internal message in a thread.

Authentication

For the authentication, please follow this guide to fill in the X-Woztell-Payload and X-Woztell-SignedContext in the header.

Parameters:

NameTypeDescriptionRequired
threadIdstringId of the member belonging to the threadEither memberId or threadId
memberIdstringId of the thread.Either threadId or memberId
messagestringThe internal message to be sentYes

Endpoint

https://api.inbox.woztell.sanuker.com/v1.0/internal-message

Request

{
"threadId": "T0000001",
// or "memberId": "6475559cdfc4ee3646d392bb",
"message": "Test Internal Message"
}

Response

{
"ok": 1,
"message": "Test Internal Message",
"memberId": "6475559cdfc4ee3646d392bb",
"threadId": "T0000001"
}