I’m trying to automate our Web Messaging deployment using the CXone REST API, and the /api/v2/webchat/deployments endpoint keeps throwing a 400 Bad Request when I include the uiConfig block with custom colors.
Here’s the JSON payload I’m sending in the body:
{
"name": "Support Chat Widget",
"integrationId": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"uiConfig": {
"launcherPosition": "bottom-right",
"colors": {
"launcher": "#FF5733",
"header": "#004488",
"text": "#FFFFFF"
}
}
}
The error response is pretty vague:
{
"code": "bad-request",
"message": "Invalid UI configuration",
"errors": [
{
"code": "invalid-field",
"message": "colors.launcher is not a valid hex color"
}
]
}
I’ve double-checked the hex codes. They’re valid. I even tried removing the # symbol, but that just gave me a different error saying the format is wrong. The documentation for the Web Messaging API is sparse on this specific sub-object structure. It mentions uiConfig exists but doesn’t detail the allowed keys or value formats for colors.
Is there a specific format required here? Maybe it expects RGB values instead of hex? Or perhaps the launcherPosition key needs to be part of a different parent object?
I’m using Python requests to make this call, so I’m pretty sure the JSON is being serialized correctly. Here’s the relevant snippet:
import requests
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
response = requests.post(
f"{base_url}/api/v2/webchat/deployments",
headers=headers,
json=payload
)
print(response.status_code)
print(response.json())
It’s frustrating because the basic deployment works fine without the uiConfig block. I just need to style it. Any ideas on what the API is actually expecting for these color fields?