1

I have created an interactive message button to open up a dialog.

This is the application code to the interaction message end-point.

$httpClient = new GuzzleHttp\Client();

$httpClient->post($interactionRequest->payload->response_url, [
    'json' => [
        'text' => 'dialog open',
        'trigger_id' => $interactionRequest->payload->trigger_id,
        'dialog' => [
            'callback_id' => 'ryde-46e2b0',
            'title' => 'Request a Ride',
            'submit_label' => 'Request',
            'elements' => [
                [
                    'type' => 'text',
                    'label' => 'Pickup Location',
                    'name' => 'loc_origin',
                ],
                [
                    'type' => 'text',
                    'label' => 'Dropoff Location',
                    'name' => 'loc_destination',
                ],
            ],
        ],
    ],
]);

Request succeed and the message I have defined in the json text attribute is shown in the slack. But the dialog doesn't open.

What is the missing part of my code, to open up a dialog?

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
Tharaka Dilshan
  • 4,371
  • 3
  • 14
  • 28

1 Answers1

2

This does not work, because you are not using the correct approach for opening a Dialog.

If you want to open a Slack dialog you need to post the dialog definition along with the trigger to this API method: dialog.open.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114