curl --request POST \
--url https://{appid}.api-{region}.cometchat.io/v3/bots/{uid}/messages \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '{
"receiverType": "user",
"data": {
"interactionGoal": {
"type": "allOf",
"elementIds": [
"element8"
]
},
"allowSenderInteraction": true,
"interactiveData": {
"title": "Form Title",
"formFields": [
{
"elementType": "textInput",
"elementId": "element1",
"defaultValue": "vivek",
"label": "Name",
"optional": false,
"maxLines": 1,
"placeholder": {
"text": "write your name here"
}
},
{
"elementType": "textInput",
"elementId": "element2",
"label": "Last Name",
"optional": false,
"maxLines": 1
},
{
"elementType": "textInput",
"elementId": "element3",
"label": "Address",
"optional": false,
"maxLines": 5
},
{
"elementType": "dropdown",
"elementId": "element4",
"label": "Country",
"optional": false,
"defaultValue": "option1",
"options": [
{
"value": "option1",
"label": "INDIA"
},
{
"value": "option2",
"label": "AUSTRALIA"
}
]
},
{
"elementType": "checkbox",
"elementId": "element5",
"optional": true,
"label": "Services",
"options": [
{
"value": "option1",
"label": "Garbage"
},
{
"value": "option2",
"label": "Electricity Bill"
},
{
"value": "option3",
"label": "Lift"
}
],
"defaultValue": [
"option1",
"option2"
]
},
{
"elementType": "singleSelect",
"elementId": "element6",
"optional": false,
"label": "Wing",
"defaultValue": "option1",
"options": [
{
"value": "option1",
"label": "A Wing"
},
{
"value": "option2",
"label": "B Wing"
}
]
},
{
"elementType": "button",
"elementId": "element9",
"buttonText": "About us",
"disableAfterInteracted": true,
"action": {
"actionType": "urlNavigation",
"url": "https://www.cometchat.com"
}
}
],
"submitElement": {
"elementType": "button",
"elementId": "element8",
"buttonText": "Submit",
"disableAfterInteracted": true,
"action": {
"actionType": "apiAction",
"url": "https://10893f2ae68f59.api-us.cometchat-staging.com/v3.0/messages",
"method": "POST",
"payload": {
"category": "message",
"type": "text",
"data": {
"text": "Thanks For filling the Form!"
},
"receiver": "superhero2",
"receiverType": "user"
},
"headers": {
"appId": "10893f2ae68f59",
"Content-Type": "application/json",
"apiKey": "5797f2d3d103d7d78f085eb46bfd14d5c45ddfdf",
"onBehalfOf": "superhero1"
},
"dataKey": "CometChatData"
}
}
}
},
"category": "interactive",
"type": "form",
"receiver": "superhero1",
"tags": [
"tag1"
]
}'