Class: TiledeskClient

TiledeskClient(options)

This class is a NodeJS stub for Tiledesk's REST APIs

Constructor

new TiledeskClient(options)

Constructor for TiledeskClient object
Parameters:
Name Type Description
options Object JSON configuration.
Properties
Name Type Description
APIKEY string Mandatory. Tiledesk APIKEY
APIURL string Optional. Tiledesk server API endpoint
projectId string Optional. Tiledesk projectId. Will be used in each call on project's APIs.
token string Optional. Tiledesk authentication token. Will be used in each call on project's APIs.
log boolean Optional. If true HTTP requests are logged
Source:
Example
const { TiledeskClient } = require('tiledesk-client');
const tdclient = new TiledeskClient({APIKEY: 'THE_API_KEY'});
const tdclient = new TiledeskClient({APIKEY: 'THE_API_KEY', APIURL: 'SELF_HOSTED_INSTANCE_ENDPOINT'});

Methods

(static) newRequestId(projectId)

Returns a new request ID for the specified Project.
A request's ID has the format:

support-group-PROJECT_ID-UNIQUE_ID

UNIQUE_ID MUST be UNIQUE in your Project. This method always returns an UUID for the UNIQUE_ID component.
Parameters:
Name Type Description
projectId string The project ID for the new request.
Source:

getAllRequests(queryParams, callback, options)

Query project's requests.
Parameters:
Name Type Description
queryParams queryParams The query parameters.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

getProjectSettings(callback, options)

Returns the project's JSON configuration
REST API
Parameters:
Name Type Description
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

getProjectUser(user_id, callback, options)

Returns a project's User (aka Teammate, is a User invited on a project, with additional properties and a spcific project-userId)
Parameters:
Name Type Description
user_id string The Teammate ID. Is the specific ID for this user on this project
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

getRequestById(requestId, callback, options)

Gets a reuqest by ID.
Parameters:
Name Type Description
requestId string The request's ID.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

sendChatMessage(message, callback, options)

Sends a message to a direct/group conversation.
REST API
Parameters:
Name Type Description
message chatMessage The chat21's message JSON object.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

sendSupportMessage(requestId, message, callback, options)

Sends a message to a support conversation.
REST API
Parameters:
Name Type Description
requestId string The request's ID.
message chatMessage The chat21's message JSON object.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

updateProjectUser(projectUserId, properties, callback, options)

Updates the Teammate's (projectUser) by ProjectUser's ID. It requires admin role.
Parameters:
Name Type Description
projectUserId string The teammate ID.
properties Object The properties to update. Only the provided properties will be updated, the other properties will stay unchanged.
role {string} - The teammate role. Permitted values: 'admin', 'agent'.
user_available {boolean} - The teammate availability. 'true' for available, 'false' for unavailable.
max_served_chat {number} - The number of concurrent chats the teammate can take at once.
attributes {Object} - The teammate custom attributes.
settings {Object} - The teammate settings.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

updateProjectUserAttributes(projectUserId, attributes, callback, options)

Only updates the attributes for the specified Teammate. It requires admin role.
Parameters:
Name Type Description
projectUserId string The teammate ID.
attributes Object The teammate custom attributes.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

updateProjectUserAvailable(projectUserId, userAvailable, callback, options)

Only updates the available status for the specified Teammate. It requires admin role.
Parameters:
Name Type Description
projectUserId string The teammate ID.
userAvailable boolean The teammate availability. 'true' for available, 'false' for unavailable.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

updateProjectUserCurrentlyLoggedIn(properties, callback, options)

Updates the authenticated Teammate's (projectUser). The teammate must be invited to the specified project for the update operation taking success.
REST API
Parameters:
Name Type Description
properties Object The properties to update. Only the provided properties will be updated, the other properties will stay unchanged.
Properties
Name Type Description
role string The teammate role. Permitted values: 'admin', 'agent'.
user_available boolean The teammate availability. 'true' for available, 'false' for unavailable.
max_served_chat number The number of concurrent chats the teammate can take at once.
attributes Object The teammate custom attributes.
settings Object The teammate settings.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

updateRequestAttributes(requestId, attributes, callback, options)

Updates the request's attributes.
REST API
Parameters:
Name Type Description
requestId string The request ID
attributes Object The request attributes to update.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

updateRequestDepartment(requestId, depId, callback, options)

Updates the Request department
Parameters:
Name Type Description
requestId string The request ID
depId string The new department ID
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
nobot string Optional. Defaults to false. If true ignores (if set) the bot in the Department.
Source:

updateRequestParticipants(requestId, participants, callback, options)

Updates the request's partecipants.
REST API
Parameters:
Name Type Description
requestId queryParams The request's ID.
participants array The participants (agent or bot) identifiers array
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source:

updateRequestProperties(requestId, properties, callback, options)

Updates the request's properties.
REST API
Parameters:
Name Type Description
requestId string The request ID
properties Object The request properties to update.
callback resultCallback The callback that handles the response.
options Object Optional configuration.
Properties
Name Type Description
token string The token for this request. Overrides instance token (if) provided in constructor.
projectId string The token for this request. Overrides instance token (if) provided in constructor.
Source: