I have a module with the following Mappable Parameters:
[
{
"name": "target",
"label": "Target",
"type": "select",
"options": [
{
"label": "Private",
"value": "private",
"nested": [
{
"name": "phoneNumbers",
"label": "Phone Numbers",
"type": "array",
"spec": {
"type": "text",
"label": "Phone Number"
}
}
]
},
{
"label": "Group",
"value": "group",
"nested": [
{
"name": "ids",
"label": "Group IDs",
"type": "array",
"spec": {
"type": "text",
"label": "Group ID"
}
}
]
}
]
},
{
"name": "message",
"type": "text",
"label": "Message",
"required": true
}
]
The user interface looks like this:
My goal is to send a POST request to my API with
body
that looks as follows:
{
"to": <obj>,
"body": {
"type": "text",
"content": "bla bla"
}
}
where the format of <obj>
is:
{
type: "private",
phoneNumbers: []
}
if the user selected Private
, and:
{
type: "group",
ids: []
}
if they selected Group
.
I tried to define the module’s Communication like so:
{
"url": "/messages",
"method": "POST",
"body": {
"to": "{{parameters.target}}",
"body": {
"type": "text",
"content": "{{parameters.message}}"
}
},
"response": {
"output": "{{body}}"
}
}
but it doesn’t work. The request body I get is:
{
"to": "private",
"body": {
"type": "text",
"content": "nothing special"
}
}