I am creating a simple integration that invokes an Interactive Dialog
in response to when a user types a Slash Command
, which is working fine. I somehow cannot get the form submissions on the backend, the submission
key is empty in response, I’ll post the code below
This is the JSON I return to Mattermost from the backend when a slash command is executed:
{
"trigger_id": request.GET['trigger_id'],
"url": "https://0dc80a84.ngrok.io/hello/",
"dialog": {
"callback_id": "somecallbackid",
"title": "Test Title",
"icon_url": "http://www.mattermost.org/wp-content/uploads/2016/04/icon.png",
"elements": [
{
"display_name": "One",
"name": "wins",
"type": "textarea",
"placeholder": "Wins"
},
{
"display_name": "Two",
"name": "setbacks",
"type": "textarea",
"placeholder": "Setbacks"
},
{
"display_name": "Three",
"name": "Mood",
"type": "select",
"help_text": "1 for lowest, 5 for highest",
"placeholder": "1 for lowest, 5 for highest",
"optional": False,
"options": [
{
"text": "1",
"value": "1"
},
{
"text": "2",
"value": "2"
},
{
"text": "3",
"value": "3"
},
{
"text": "4",
"value": "4"
},
{
"text": "5",
"value": "5"
}
]
}
],
"submit_label": "Submit",
"notify_on_cancel": False,
"state": "somestate"
}
}
And this is my backend code snippet:
@csrf_exempt
def hello(request):
print(request.POST.get("submission", None))
return JsonResponse({
"text": "Hello"
})
This prints None
. Any pointers?