I'm starting to use the Slack API with Python.
So far I was able to connect it and send messages just fine.
I want to create a dialog option so users can input variables and I'm able to do it but when I try to submit the dialog, an error appears saying: We had some trouble connecting. Try again?
Here's the code:
@app.route("/test", methods=["POST"])
def message_actions():
data = request.form
user_id = data.get('user_id')
client.api_call(api_method="dialog.open",
json={"trigger_id": data.get("trigger_id"),
"dialog": {
"title": "Request a coffee",
"submit_label": "Submit",
"callback_id": user_id + "coffee_order_form",
"elements": [{
"label": "Coffee Type",
"type": "select",
"name": "meal_preferences",
"placeholder": "Select a drink",
"options": [
{
"label": "Cappuccino",
"value": "cappuccino"
},
{
"label": "Latte",
"value": "latte"
},
{
"label": "Pour Over",
"value": "pour_over"
},
{
"label": "Cold Brew",
"value": "cold_brew"
}
]
}
]
}}
)
return make_response("", 200)