The Flex Configuration REST API resource contains a collection of properties that control the appearance and functionality of your Flex instance.
For self-hosted Flex UI instances, any configuration values specified in your server's appConfig.js object will take precedence over corresponding values in the REST API Configuration resource.
To review your account's current Flex Configuration properties, fetch the resource instance by making a GET
request to the /Configuration
endpoint.
The response contains a complete JSON representation of the configuration.
1curl -X GET "https://flex-api.twilio.com/v1/Configuration" \2-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Not sure where to find your account SID or auth token? Check out this intro to using Twilio's REST APIs for help.
Issue a POST
request to the /Configuration
endpoint to update Flex Configuration values. Include a JSON object in the request body that contains your Twilio account SID along with any configuration items that you wish to update.
The following example request illustrates how to update a single configuration property with a Boolean value.
1JSON_PAYLOAD=$(cat <<EOF2{3"account_sid": "ACXXXXXXXXXXXXXXXXX",4"call_recording_enabled": true5}6EOF7)89curl -X POST https://flex-api.twilio.com/v1/Configuration \10-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN \11-H 'Content-Type: application/json' \12-d $JSON_PAYLOAD
Some properties expect a type as the value (Boolean, string, integer, etc), while other properties expect a value that is itself a full JSON object. When updating a JSON type property, the existing value of the property will be completely replaced by the JSON object that you provide as the new value.
To prevent accidentally overriding existing fields of a JSON type property when performing an update, you should always first fetch the existing value of the property first. Then make any desired adjustments to the JSON object before sending it in the body of a POST
request to update the property. You'll see an illustration of this in the following example.
Let's see how to update a property that uses a JSON object rather than a scalar as its value.
Suppose we want to update the ui_attributes
property in order to disable browser notifications. Since the value of ui_attributes
is a JSON object and it might contain fields other than the one we want to modify, we will first fetch the Configuration to get the complete current state of the object. Let's say that the current value of ui_attributes
that we see in the response looks like this:
1{2"warmTransfers": {3"enabled": true4},5"notifications": {6"browser": true7}8}9
Here's how we can send a request to update the property with our adjustment to one field within the JSON object value.
1JSON_PAYLOAD=$(cat <<EOF2{3"account_sid": "ACXXXXXXXXXXXXXXXXX",4"ui_attributes": {5"warmTransfers": {6"enabled": true7},8"notifications": {9"browser": false10}11}12}13EOF14)1516curl -X POST 'https://flex-api.twilio.com/v1/Configuration' \17-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN \18-H 'Content-Type: application/json' \19-d $JSON_PAYLOAD
The existing value for the ui_attributes
property will be entirely replaced by the JSON object we provided in the POST
request.
Some fields are read-only. If you attempt to update a read-only field, the API will return an HTTP 400 response with an error message:
1{2"code": 45004,3"message": "You are not allowed to modify property for [flex_service_instance_sid].",4"more_info": "https://www.twilio.com/docs/errors/45004",5"status": 4006}
Following is a description of some of the Configuration properties that you may wish to change.
JSON object
These configuration values control some aspects of the appearance and functionality of the Flex UI web application.
For self-hosted Flex UI instances, properties specified here are merged with any properties present in the server's appConfig.js
object. Values specified in appConfig.js
take precedence over corresponding values in the ui_attributes
field of the REST API Configuration resource.
Check out the appConfig.js guide to learn more about the available Flex UI configuration options.
Example value
1{2"warmTransfers": {3"enabled": true4},5"notifications": {6"browser": true7},8"logLevel": "debug",9"theme": {10"isLight": false11}12}
JSON object
This field allows you to define custom skills-based routing parameters for your Flex instance.
Example value
1[2{3"name": "voice",4"multivalue": false,5"minimum": null,6"maximum": null7},8{9"name": "language_fr",10"multivalue": false,11"minimum": null,12"maximum": null13},14{15"name": "language_ge",16"multivalue": false,17"minimum": null,18"maximum": null19},20{21"name": "messaging",22"multivalue": false,23"minimum": null,24"maximum": null25},26{27"name": "special_language",28"multivalue": true,29"minimum": 1,30"maximum": 1031}32]