SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How to Access Flex Worker Skills Via the REST API

Objective

This article describes how to access TaskRouter Skills defined in the Flex Configuration resource and how to review individual worker attributes to see assigned skills. If you’re looking to fetch the list of skills shown on the Flex “Users and Access > Skills” page, or want to programmatically check which skills are assigned to your agents, this guide will help you accomplish both tasks.

Keywords: Twilio Flex, TaskRouter Skills, Flex Configuration REST API, Worker Attributes, Users and Access Skills.

 

Product

Twilio Flex, TaskRouter

 

User Account Permission/Role(s) Required 

Owner, Administrator, or Developer role in Console to access REST API credentials in the Twilio Console, or access to

 

Procedure 

1. Accessing TaskRouter Skills via Flex Configuration REST API

To retrieve the full list of Agent Skills configured in your Flex instance (as seen on the Flex Console “Users and Access > Skills” page):

  1. Identify the Flex Configuration API endpoint:
    The endpoint for the Flex Configuration API: https://flex-api.twilio.com/v1/Configuration
  2. Authenticate your request:
    Use your Twilio Account SID and Auth Token for HTTP Basic Authentication.
  3. Make the API request:
    • You can use any HTTP client (such as Postman, curl, or your preferred programming language).

Example curl command:

curl -u 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:your_auth_token' \
https://flex-api.twilio.com/v1/Configuration/
  • Be sure to fill in your Account SID, Auth Token!
  • The response will include all skills defined in your Flex project.
  1. Review the returned skills:
    taskrouter_skills will be returned as a top-level key within the REST API response from the Flex Configuration REST API.

For more details, see the Flex Configuration REST API documentation.

2. Accessing Individual Worker Attributes to Review Skills

To check which skills are assigned to a specific agent (worker):

  1. Fetch the Worker resource:
    Use the TaskRouter API endpoint:
    GET /v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}
  2. Authenticate your request:
    Use your Twilio Account SID and Auth Token.
  3. Review the worker’s attributes
    • The response will include an attributes field (JSON format).
    • Skills are typically listed as part of the worker’s attributes, depending on your Flex configuration.
  4. Make the API request
    • You can use any HTTP client (such as Postman, curl, or your preferred programming language).

Example curl command:

curl -X GET -u 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:your_auth_token' \
"https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  • Be sure to fill in your Account SID, Auth Token, Workspace SID, and Worker SID!
  • The response will include your Worker's attributes, where Skills will be configured
  1. Parse the attributes:
    • Your Worker Skills will be available in their Attributes as a subset of the routing key as skills.
    • An example of the layout of the JSON object can be found below:
{
  "routing": {
    "tier": "1",
    "dept": "support",
    "lang": ["en-us"],
    "skills": ["charisma", "speech"],
    "levels": { "charisma": 10, "speech": 10 }
  },
  "full_name": "Example Worker",
  "image_url": "",
  "roles": ["agent", "wfo.full_access"],
  "contact_uri": "client:worker_40example_2Ecom",
  "email": "worker@example.com",
  "disabled_skills": { "skills": [], "levels": {} },
  "name": "worker@example.com",
  "nickname": "Example"
}

For more information, refer to the TaskRouter Worker API documentation.

 

Additional Information 

  • While the examples above use curl to access the REST API, the Flex Configuration API is available within our helper libraries as well.

 

 

Have more questions? Submit a request
Powered by Zendesk