Task-Worker Pairing Configs

Task-Worker Pairing Configs are used to configure the behavior of tasks in the CRM. A TWPC is used to define the rules for how tasks are assigned to agents (i.e., workers).

In order to configure a TWPC you need to understand the contents of task and worker objects. See the List Unterminated Task endpoint and the List Workers endpoint for more details.

List task-worker pairing configs

List the task-worker pairing configs for a company.

Securityoauth2 or bearerAuth or apiKeyHeader
Request
path Parameters
companyId
required
string

The unique company identifier.

query Parameters
sortBy
Array of strings

Which fields to sort by

Items Enum: "id" "+id" "-id" "priority" "-priority" "+priority" "createdAt" "+createdAt" "-createdAt"
limit
integer [ 1 .. 100 ]
Default: 25

The maximum count of results to retrieve.

startingAfter
string

Return results starting after the provided object identifier.

endingBefore
string

Return results ending before the provided object identifier.

Responses
200

Success

get/companies/{companyId}/task-worker-pairing-configs
Response samples
application/json
{
  • "status": 0,
  • "count": 0,
  • "data": [
    ]
}

Create task-worker pairing config

Create a new task-worker pairing config.

Changes here will not take effect until synchronization is run. See: Sync task-worker pairing configs to Twilio

Securityoauth2 or bearerAuth or apiKeyHeader
Request
path Parameters
companyId
required
string

The unique company identifier.

Request Body schema: application/json
required
externalId
string or null
priority
integer or null

The order in which this pairing config should be evaluated. Higher numbers are evaluated first.

Note that the default pairing config is always evaluated LAST (and it's priority is always null.)

name
string

A human-readable name for this pairing config.

object

An object describing the characteristics of the workers to match to the tasks matched in taskMatch.

The settings here are translated into Twilio "expression syntax"[1] and matched against the workers' attributes. You can see the generated expression in the field twilioWorkerQueueExpression.

[1] https://www.twilio.com/docs/taskrouter/expression-syntax

overrideTwilioWorkerQueueExpression
string

If the characteristics of the workers you wish to match cannot be fully described by the workerMatch object, you can override the Twilio "TaskRouter expression" used to match the workers by settings this field. (In which case you will see the value set here in the field twilioWorkerQueueExpression as well.)

This field's syntax must conform to the Twilio "TaskRouter Expression" syntax[1].

Since this syntax is not validated here, it may be difficult to debug invalid expressions; as such, it is recommended you use the workerMatch object when possible.

[1] https://www.twilio.com/docs/taskrouter/expression-syntax

object
overrideTwilioTaskWorkflowExpression
string

If the characteristics of the tasks you wish to match cannot be fully described by the taskMatch object, you can override the Twilio "TaskRouter expression" used to match the workers by settings this field. (In which case you will see the value set here in the field twilioTaskWorkflowExpression as well.)

This field's syntax must conform to the Twilio "TaskRouter Expression" syntax[1].

Since this syntax is not validated here, it may be difficult to debug invalid expressions; as such, it is recommended you use the taskMatch object when possible.

Some useful expression examples for TaskRouter task attributes:

  • Matching a task with an email interaction which was sent to the email address support@loans.acme.com. interaction.channel = "email" AND "support@loans.acme.com" IN interactionMeta.recipients.emails
  • Matching an inbound phone call to a particular support phone number +15555555555: interaction.channel = "voice" AND interactionMeta.to.phone = "+15555555555"

[1] https://www.twilio.com/docs/taskrouter/expression-syntax

Responses
200

Success

post/companies/{companyId}/task-worker-pairing-configs
Request samples
application/json
{
  • "externalId": "string",
  • "priority": 0,
  • "name": "string",
  • "workerMatch": {
    },
  • "overrideTwilioWorkerQueueExpression": "string",
  • "taskMatch": {
    },
  • "overrideTwilioTaskWorkflowExpression": "string"
}
Response samples
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Sync task-worker pairing configs to Twilio

Perform synchronization of task-worker pairing config to Twilio.

API changes to task-worker pairing configs will have no effect until this synchronization is run.

Securityoauth2 or bearerAuth or apiKeyHeader
Request
path Parameters
companyId
required
string

The unique company identifier.

Responses
200

Success

post/companies/{companyId}/task-worker-pairing-configs/sync

Get task-worker pairing config

Securityoauth2 or bearerAuth or apiKeyHeader
Request
path Parameters
taskWorkerPairingConfigId
required
string (AnyId) ^ext-|^[A-Z][A-Z0-9]-[A-Z0-9]+-[A-Z0-9]+|^\d+...

Peach's unique or lender's external identifier.

companyId
required
string

The unique company identifier.

Responses
200

Success

get/companies/{companyId}/task-worker-pairing-configs/{taskWorkerPairingConfigId}
Response samples
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Update task-worker pairing config

Update a task-worker pairing config.

Changes here will not take effect until synchronization is run. See: Sync task-worker pairing configs to Twilio

Securityoauth2 or bearerAuth or apiKeyHeader
Request
path Parameters
taskWorkerPairingConfigId
required
string (AnyId) ^ext-|^[A-Z][A-Z0-9]-[A-Z0-9]+-[A-Z0-9]+|^\d+...

Peach's unique or lender's external identifier.

companyId
required
string

The unique company identifier.

Request Body schema: application/json
required
externalId
string or null
priority
integer or null

The order in which this pairing config should be evaluated. Higher numbers are evaluated first.

Note that the default pairing config is always evaluated LAST (and it's priority is always null.)

name
string

A human-readable name for this pairing config.

object

An object describing the characteristics of the workers to match to the tasks matched in taskMatch.

The settings here are translated into Twilio "expression syntax"[1] and matched against the workers' attributes. You can see the generated expression in the field twilioWorkerQueueExpression.

[1] https://www.twilio.com/docs/taskrouter/expression-syntax

overrideTwilioWorkerQueueExpression
string

If the characteristics of the workers you wish to match cannot be fully described by the workerMatch object, you can override the Twilio "TaskRouter expression" used to match the workers by settings this field. (In which case you will see the value set here in the field twilioWorkerQueueExpression as well.)

This field's syntax must conform to the Twilio "TaskRouter Expression" syntax[1].

Since this syntax is not validated here, it may be difficult to debug invalid expressions; as such, it is recommended you use the workerMatch object when possible.

[1] https://www.twilio.com/docs/taskrouter/expression-syntax

object
overrideTwilioTaskWorkflowExpression
string

If the characteristics of the tasks you wish to match cannot be fully described by the taskMatch object, you can override the Twilio "TaskRouter expression" used to match the workers by settings this field. (In which case you will see the value set here in the field twilioTaskWorkflowExpression as well.)

This field's syntax must conform to the Twilio "TaskRouter Expression" syntax[1].

Since this syntax is not validated here, it may be difficult to debug invalid expressions; as such, it is recommended you use the taskMatch object when possible.

Some useful expression examples for TaskRouter task attributes:

  • Matching a task with an email interaction which was sent to the email address support@loans.acme.com. interaction.channel = "email" AND "support@loans.acme.com" IN interactionMeta.recipients.emails
  • Matching an inbound phone call to a particular support phone number +15555555555: interaction.channel = "voice" AND interactionMeta.to.phone = "+15555555555"

[1] https://www.twilio.com/docs/taskrouter/expression-syntax

Responses
200

Success

put/companies/{companyId}/task-worker-pairing-configs/{taskWorkerPairingConfigId}
Request samples
application/json
{
  • "externalId": "string",
  • "priority": 0,
  • "name": "string",
  • "workerMatch": {
    },
  • "overrideTwilioWorkerQueueExpression": "string",
  • "taskMatch": {
    },
  • "overrideTwilioTaskWorkflowExpression": "string"
}
Response samples
application/json
{
  • "status": 0,
  • "message": "string",
  • "data": {
    }
}

Delete task-worker pairing config

Delete a task-worker pairing config.

Changes here will not take effect until synchronization is run. See: Sync task-worker pairing configs to Twilio

Securityoauth2 or bearerAuth or apiKeyHeader
Request
path Parameters
taskWorkerPairingConfigId
required
string (AnyId) ^ext-|^[A-Z][A-Z0-9]-[A-Z0-9]+-[A-Z0-9]+|^\d+...

Peach's unique or lender's external identifier.

companyId
required
string

The unique company identifier.

Responses
204

Delete ok

delete/companies/{companyId}/task-worker-pairing-configs/{taskWorkerPairingConfigId}