Legacy Dev Forum Posts

 View Only

Sign Up

Add contact to contact list from data action error validation

  • 1.  Add contact to contact list from data action error validation

    Posted 06-05-2025 18:41

    AClivati | 2019-10-09 14:49:27 UTC | #1

    Hi, i'm trying to add a single contact to a contact list using a custom Data Action for the Architect tool.

    The API that I have to call is /api/v2/outbound/contactlists/{contactListId}/contacts that requires a body similar to:

    [ { "contactListId": "xxxxxxxxxx", "data": { "phone":"yyyyyyyyyyy" } } ]

    The contracts seem to be correctly configured:

    The json generated is the following:

    { "type": "array", "items": { "type": "object", "properties": { "contactListId": { "type": "string" }, "data": { "type": "object", "properties": { "phone": { "type": "string" } }, "additionalProperties": true } }, "additionalProperties": true } }

    The problem is that when configuring the contract for this type of body, we get this error during validation:

    Failed Validation of contract.input.inputSchema as a simple properties schema. Must be an Object with properties and no sub-objects. JSON failed schema validation for the following reasons: Schema: # @/properties/type. Error location: /type. instance value ("array") not found in enum (possible values: ["object"])

    Errors seem to be related to the array type usage and nested objects.

    Thanks for the help


    Jason_Mathison | 2019-10-09 18:19:08 UTC | #2

    Hi AClivati,

    Data Actions only allow a very simple input schema of a root object with key/value pairs, where the values are simple types like string/number/boolean.

    To handle more complicated situations like this you will need to setup your input to have a root object with contactListId and phone number fields. Then use a request template to setup the basic body, and insert the values into the right spots.

    Documentation for this is here: https://help.mypurecloud.com/articles/request-configuration-data-actions/

    If you use the "Simple" UI mode you should be able to literally copy the body you included above and use the "Available Inputs" links in the UI to drop the inputs where you need them. Simple UI mode takes care of JSON escaping, which is a huge help.

    If you have any further issues please upload an export of your action and include a copy and paste (not screenshot) of the error you get.

    --Jason


    AClivati | 2019-10-14 15:25:47 UTC | #3

    thanks Matt,

    we found that the problem was during the validation of the output response. We used the request that you suggested and everything works fine.


    system | 2019-11-14 15:37:05 UTC | #4

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 6211