How do I get the format I need for my webhook response?
This is what I need:
{
"options": [
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-0"
},
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-1"
},
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-2"
}
]
}
This is what I have:
[
{
"options": [
{
"json": "{\"text\":{\"type\":\"plain_text\",\"text\":\"Company 1\"},\"value\":\"record_id_1\"}"
},
{
"json": "{\"text\":{\"type\":\"plain_text\",\"text\":\"Company 2\"},\"value\":\"record_id_2\"}"
}
]
}
]
This is the setup I am using right now:
My logic is this:
- I need to find records in Airtable based of my input
- Create an array from the results so I can iterate over it
- For each item in the array, create the JSON object in this format:
{
"text": {
"type": "plain_text",
"text": "*this is plain_text text*"
},
"value": "value-0"
},
- Combine the JSON objects in an array
- Rename the array to options like required for the response and store in variable for later use
- Get options variable and send it with the webhook response
I am confused because it seems so simple but it is also late already haha.
Does anyone have an idea that helps to get this done?