Frontline User Resource
The User resource represents a Twilio Frontline user who can log in to the Frontline application. Any user assigned to the Twilio Frontline application within your Identity Provider will be able to access Frontline.
All URLs in the reference documentation use the following base URL:
https://frontline-api.twilio.com/v1
The unique string that we created to identify the User resource.
^US[0-9a-fA-F]{32}$Min length: 34Max length: 34The application-defined string that uniquely identifies the resource's User. This value is often a username or an email address, and is case-sensitive.
Current state of this user. Can be either active or deactivated and defaults to active
activedeactivatedWhether the User is available for new conversations. Defaults to false for new users.
An absolute API resource URL for this user.
GET https://frontline-api.twilio.com/v1/Users/{Sid}
The SID of the User resource to fetch. This value can be either the sid or the identity of the User resource to fetch.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchUser() {11const user = await client.frontlineApi.v112.users("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.fetch();1415console.log(user.sid);16}1718fetchUser();
Response
1{2"sid": "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"identity": "john@example.com",4"friendly_name": "John Doe",5"avatar": "https://example.com/profile.png",6"state": "active",7"is_available": true,8"url": "https://frontline-api.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9}
POST https://frontline-api.twilio.com/v1/Users/{Sid}
The SID of the User resource to update. This value can be either the sid or the identity of the User resource to update.
application/x-www-form-urlencodedCurrent state of this user. Can be either active or deactivated and defaults to active
activedeactivatedWhether the User is available for new conversations. Set to false to prevent User from receiving new inbound conversations if you are using Pool Routing.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateUser() {11const user = await client.frontlineApi.v112.users("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.update({14avatar: "https://example.com/new-profile.png",15friendlyName: "John Doe",16isAvailable: true,17});1819console.log(user.sid);20}2122updateUser();
Response
1{2"sid": "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"identity": "john@example.com",4"friendly_name": "John Doe",5"avatar": "https://example.com/new-profile.png",6"state": "active",7"is_available": true,8"url": "https://frontline-api.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9}
A user can be deactivated by updating their state to deactivated. When a user is deactivated:
- All active sessions for that user will be invalidated, and the user will be logged out
- The user will be removed from any pools they are a member of
Warning
Deactivating a user by itself does not block a user from logging in to Frontline in the future. Before deactivating a Frontline user, their access to Frontline should be removed from your SSO provider. Once a user no longer has access to Frontline through your SSO provider, deactivating that user will invalidate any existing Frontline sessions from that user.
If a user's state has been deactivated but that user still has access to Frontline through your SSO provider, on their next login, that user's state will be updated to active
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateUser() {11const user = await client.frontlineApi.v112.users("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.update({ state: "deactivated" });1415console.log(user.state);16}1718updateUser();
Response
1{2"sid": "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"identity": "john@example.com",4"friendly_name": "John Doe",5"avatar": "https://example.com/profile.png",6"state": "deactivated",7"is_available": true,8"url": "https://frontline-api.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"9}