Hi folks,
I have a challenge with creating a proper module configuration
I’m doing it for this endpoint https://api-docs.mailtrap.io/docs/mailtrap-api-docs/7d76bbcbcf6e3-create-a-new-contact#response-body
so actually here is a payload
"contact": {
"email": "john.smith@example.com",
"fields": {
"first_name": "John",
"last_name": "Smith"
},
"list_ids": [
1,
2,
3
]
}
Just fields
is dynamic, so a user1 can have 1 fields, user2 - 5 fields. It’s all depends on his configuration
With params I tried to use
{
"name": "fields",
"type": "collection",
"label": "Contact Fields",
"required": false,
"default": {},
"help": "Define additional fields as key-value pairs. Example: {\"first_name\": \"John\", \"last_name\": \"Smith\"}."
},
{
"name": "list_ids",
"type": "text",
"label": "List IDs (JSON array)",
"required": false,
"default": "[]",
"help": "Enter the contact list IDs as a valid JSON array. For example: [1,2,3]."
}
but in connection I got an error
{
"url": "{{common.endpoints.contacts}}/api/accounts/{{parameters.account_id}}/contacts",
"method": "POST",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Api-Token": "{{connection.apiKey}}"
},
"qs": {},
"body": {
"contact": {
"email": "{{parameters.contact_email}}",
"fields": {{parameters.fields}},
"list_ids": {{ JSON.parse(parameters.list_ids) }}
}
},
"response": {
"output": "{{body}}"
}
}
Thou I can’t save it in connection as got some validation error.
Can you help? What I’m doing wrong? Thanks a lot!