I am creating a Slack app in Bolt framework for Python. I successfully created new command, which open new modal window with text input and datepicker.
The problem is, that when trying to submit I receive error: We had some trouble connecting. Try again?
Code:
@app.command("/echo")
def handle_command(body, ack, client, logger):
logger.info(body)
ack()
res = client.views_open(
trigger_id=body["trigger_id"],
view={
"title": {
"type": "plain_text",
"text": "Add info to feedback",
"emoji": True
},
"submit": {
"type": "plain_text",
"text": "Save",
"emoji": True
},
"type": "modal",
"callback_id": "view123",
"blocks": [
{
"type": "input",
"element": {
"type": "plain_text_input"
},
"label": {
"type": "plain_text",
"text": "Label",
"emoji": True
}
},
{
"type": "actions",
"elements": [
{
"type": "datepicker",
"initial_date": "1990-04-28",
"placeholder": {
"type": "plain_text",
"text": "Select a date",
"emoji": True
},
"action_id": "actionId-0"
},
{
"type": "datepicker",
"initial_date": "1990-04-28",
"placeholder": {
"type": "plain_text",
"text": "Select a date",
"emoji": True
},
"action_id": "actionId-1"
}
]
}
]
},
)
logger.info(res)
I figured out, that I have to listen to view submission, but don't know how to do it.
It doesn't work:
@app.view("view123")
def handle_submission(ack, body, client, view, logger):
ack()
Any ideas / suggestions what I am doing wrong?