The API is currently in beta. Contact us to get access.
Create a service account
In order to call the API, you will first need to create a service account. Go to your Unthread dashboard and find the Service Accounts tab under Settings. Click “Add service account”, give your service account a name, and click “Submit”.
Calling the API
The URL for calls to the API will have the following form, with $ being replaced by the endpoint you are trying to call:API Conventions
The Unthread API follows RESTful conventions when possible, with most operations performed viaGET
, POST
, PATCH
, and DELETE
requests. Request and response bodies are encoded as JSON.
List Endpoints
All list endpoints follow the same conventions. Requests are made in the following format:Create and Update Endpoints
Create and update endpoints can specify aselect
query param that takes a comma-separated list of fields to return in the response. Example below:
Objects
Conversation
Message
Customer
Tag
User
User Team
Slack Channel
Simple Condition
leftValueFrom
and rightValueFrom
fields.
The “context” depends on the object and the operation. For example, for ticket type field conditions, the context has the following shape:
12345678-1234-1234-1234-123456789abc
set to value-1
.
Ticket Type Field
Ticket Type
Autoresponder Options
Support Step
Outbound
Webhook Subscription
Approval Request
Collaborator Type
Account
Endpoints
Accounts
Create Account
Get Account by ID
Update Account
Delete Account
List Accounts
id
name
imageUrl
primarySupportAssigneeId
primarySupportAssigneeType
secondarySupportAssigneeId
secondarySupportAssigneeType
primarySupportAssignee.id
primarySupportAssignee.name
secondarySupportAssignee.id
secondarySupportAssignee.name
emailsAndDomains
slackChannelIds
slackTeamIds
customFields
supportSteps
createdAt
updatedAt
createdBy
updatedBy
slackChannels.id
slackChannels.name
slackChannels.isPrivate
slackChannels.isShared
slackChannels.archivedAt
slackChannels.slackTeamId
slackTeams.id
slackTeams.name
slackTeams.icon
tags.id
tags.name
externalCrmMetadata
Approval Requests
Create Approval Request for Conversation
title
, assignedToUserId
and assignedToGroupId
.
Get Approval Requests for Conversation
Automations
Create Automation
Request Body
The request body should be a JSON object with the following structure:name
(required): The name of the automation.description
(optional): A description of the automation.status
(optional): The status of the automation. Defaults to ‘draft’ if not provided.trigger
(required): The trigger configuration for the automation.steps
(required): An array of steps that define the automation’s actions.conditions
(optional): Conditions that determine when the automation should run.
AutomationTrigger
Thetrigger
field should be an object with a type
property and a data
property. The structure depends on the trigger type:
AutomationStep
Each step in thesteps
array should be an object with a type
property and a data
property:
Response
The response will be a JSON object representing the created automation, including its ID and other details.Notes
- Automations are only available if custom actions are enabled for the tenant.
Conversation Management
Add Follower to Conversation
entityId
of the follower to add and the entityType
which is either “user” or “group”.
Remove Follower from Conversation
entityId
of the follower to remove.
Assign Collaborator to Conversation
entityId
of the collaborator to add and the entityType
which is either “user” or “group”.
List Collaborator Types
Conversations
Create Conversation
type
field:
- For
type == "slack"
, the conversation will be for communication in Slack. You can choose to post the details either into a DM or into a channel. - For
type == "triage"
, the conversation will be for internal discussion only and there will be no way to communicate with the customer. ThetriageChannelId
field is required. - For
type == "email"
, the conversation will be continued via email replies. Replies in the thread with/unthread send
appended will be sent to the customer via email. TheemailInboxId
field is required. TheonBehalfOf
field is used to specify the email address and name of the end user to communicate with.
customerId
is provided, the conversation will be linked to the given customer and that customer’s autoresponder and SLA settings will be applied.
Request schema:
Attachments
Files can be attached to the conversation by making a multipart/form-data request instead of a JSON request. The JSON payload should be included as a form field namedjson
and the files should be included as additional form fields with the name attachments
and the file as the value. Up to 10 files can be attached to a single conversation and the maximum file size is 20MB. See the following Javascript example for clarification:
- Markdown should follow the Slack formatting guide.
- For more info on multipart/form-data requests, see the IETF RFC 7578.
Get Conversation by ID
Update Conversation
status
priority
notes
assignedToUserId
wakeUpAt
snoozedAt
excludeAnalytics
title
lockedAt
customerId
ticketTypeId
ticketTypeFields
submitterUserId
metadata
List Conversations
List Messages for Conversation
Create Message in Conversation
- Either
body
,blocks
ormarkdown
must be provided. - If both
blocks
andbody
ormarkdown
are provided, theblocks
will be appended after themarkdown
content - Only pass in
triageThreadTs
if you want the message to be posted to a triage thread for that conversation rather than being sent to the customer. - For email and in-app chat conversations, set
isPrivateNote
totrue
to mark the message as a private note which will post to the Slack thread for the conversation without sending a response back to the customer. - File attachments can also be included. See the section on adding attachments when creating a conversation for more information.
- If
onBehalfOf
is provided, the message will be sent as the given user. If not provided, the message will be sent as the Unthread bot.
Download File Attachment
:fileId
can be found in the files
array of the conversation object.
Customers
Get Customer by ID
Update Customer
name
, slackChannelId
, autoresponder
, supportSteps
, defaultTriageChannelId
, disableAutomatedTicketing
, primarySupportAssigneeId
, primarySupportAssigneeType
, secondarySupportAssigneeId
, secondarySupportAssigneeType
, replyTimeoutHours
, botHandling
, emailDomains
.
Create Customer
createChannel
flag is set to true
.
Delete Customer
List Customers
Knowledge Base
Query Knowledge Base
Parameters
query
(required): The string query to search for in the knowledge base.customerId
(optional): The ID of the customer associated with this query.userId
(optional): The ID of the user making the query.conversationId
(optional): The ID of the conversation context for this query.
Create Knowledge Base Article
Parameters:
title
(required): The title of the knowledge base article.content
(required): The content of the knowledge base article.url
(optional): The URL associated with this article.userGroupIds
(optional): Array of user group IDs that have access to this article.
Get Knowledge Base Article by ID
Update Knowledge Base Article
Parameters:
title
(optional): The updated title of the knowledge base article.content
(optional): The updated content of the knowledge base article.url
(optional): The updated URL associated with this article.userGroupIds
(optional): Updated array of user group IDs that have access to this article.status
(optional): The status of the article, either “active” or “inactive”.
Delete Knowledge Base Article
List Knowledge Base Articles
Outbound Messages
Create and/or send an outbound message
Update and/or send an outbound message
List outbounds
Get outbound by ID
Reporting
- The
timezone
field is optional and defaults to “UTC”. startDate
andendDate
have the following format: “2022-12-31”. The dates are inclusive.dateDimension
specifies the time period in which the data should be grouped.- All metrics are numbers. Response and resolution times are in seconds.
dimensions
is an array of fields to group the data by in addition to the date.filters
allows you to filter the data to specific dimensions. If an array is passed for a given dimension, then it is treated as anOR
.
- If there is no data for a particular day, then that day will not be included in the
data
object; however, it will be included in thedates
array. - If dimensions are included in the request, then the data will be nested for each dimension included. Dimensions are nested in the order they are included in the request. See the example below for clarification.
dates
is an array of the time periods covered by the query. For grouping by weeks, each value in the array is the first day of the week starting on Monday. For grouping by months, each value in the array is the first day of the month.lookups
contains friendly names for the keys contained indata
. For example, if grouping bycustomerId
, the lookups would contain a mapping from the customer ID to the customer name.
Slack Integration
Update Slack User Group
email
(required): The email address of the user to update.slackHandle
(required): The Slack handle of the user to update.
Tags
Get Tag by ID
Update Tag
name
.
Create Tag
name
Delete Tag
List Tags
Add Tag to Customers
[ '93ba5298-a23f-413b-94fe-73e0ab26a816', '7ab46970-19ec-492e-90fe-47a8abc93fec' ]
Add Tag to Conversations
[ 'ad00e2d0-4ea4-45c4-9b5d-8728f93e51a7', 'e82cde04-0d59-4416-b5da-1f405f6d4ddb' ]
Remove Tag from Customers
Remove Tag from Conversations
Ticket Types
Create Ticket Type
Update Ticket Type
Delete Ticket Type
List Ticket Types
Get Ticket Type
Users
List Users
includeExternalUsers
field with a value of true
.
Get User by ID
Webhooks
Create Webhook Subscription
url
and enabled
.
Update Webhook Subscription
url
and enabled
.