How to make Dialog from button click

I’m looking for a way to open it by clicking the button.
I want to make it like a slack polly app.

button click → open dialog → something dialog submit.

I created a button as below.

    "attachments": [
                      "pretext": "This is the attachment pretext.",
                      "text": "This is the attachment text.",
                      "actions": [
                          "id": "message",
                          "name": "Ephemeral Message",
                          "integration": {
                            "url": default_url + '/bbb',
                            "context": {
                              "action": "do_something_ephemeral"
                        }, {
                          "id": "update",
                          "name": "Update",
                          "integration": {
                            "url": default_url + '/bbb',
                            "context": {
                              "action": "do_something_update"

Code executed at button click.
The trigger id does not exist and cannot be opened.

Do you have any suggestions for me?

Thank you your help.

@app.route(’/bbb’, methods=[‘POST’, ‘GET’])
def aaaa():


headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token}

payload = {
    "trigger_id": request.json['trigger_id'],
    "url": post_url,
    "dialog": {
        "callback_id": "create_command",
        "title": "Create Test",
        "icon_url": "",
        "elements": [
                "display_name": "Test",
                "type": "select",
                "name": "test_list",
                "placeholder": "Select Test Type",
                "options": [
                    {"text": "ALL", "value": "ALL"},
                    {"text": "HOME", "value": "HOME"},
                    {"text": "MANUAL", "value": "MANUAL"}
        "submit_label": "CreateTest",
res =, headers=headers, data=json.dumps(payload))

return make_response('', 200)