14221: Enqueue: Provided Attributes JSON was not valid
ERROR
You receive this error when <Enqueue> includes a <Task> noun whose body is not a valid JSON object. When you use workflowSid with <Enqueue>, Twilio creates a new TaskRouter Task for the call, and the <Task> noun sets the attributes for that Task.
- The
<Task>noun body contains JSON that Twilio cannot parse as a valid object. - Your application generated malformed task attributes before returning the TwiML response for
<Enqueue>. Twilio expects those attributes to be formatted as JSON. - Custom task attributes were added to a TaskRouter enqueue flow, but the value sent in
<Task>was not valid JSON.
- Update the
<Task>noun body so it contains a valid JSON object before Twilio executes the<Enqueue>verb. - If you generate TwiML in code, build the attributes as an object and serialize them with
JSON.stringifyinstead of hand-writing the JSON string. - If you do not need custom task attributes, omit
<Task>. Twilio will still create the Task with the call's standard parameters as attributes when you enqueue withworkflowSid.