Nice to meet you, I’m Japanese naoko1010hh.
I’m sorry, if you have any funny Japanese because I use Google interpreter
I did something similar in php but I can’t see the dialog via the button.
200 comes back with a callback but no dialog is displayed
The source code is here ↓
<?php $json = file_get_contents("php://input"); $contents = json_decode($json, true); error_log($contents["trigger_id"]); error_log($contents["channel_id"]); $data=[ "trigger_id"=>$contents["trigger_id"], "url"=>"https://fascode.net/api/mattermost/twitter.php", "dialog"=>[ "callback_id"=>"somecallbackid", "title"=>" @Fascode_SPTで返信する", "icon_url"=>"https://fascode.net/api/twitter/createimage.php?p=minasereneicon", "elements"=>[ [ "display_name"=>"返信ツイートURL", "name"=>"twurl", "type"=>"text", "subtype"=>"url", "default"=>$_GET["twurl"], "placeholder"=>"https://twitter.com/Fascode_SPT/status/1284175231540588544", "help_text"=>"何も変更しないでください", "optional"=>false, "min_length"=>0, "max_length"=>0, "data_source"=>"", "options"=>null ], [ "display_name"=>"返信の内容", "name"=>"twtext", "type"=>"textarea", "subtype"=>"", "default"=>"", "placeholder"=>"ほげほげ", "help_text"=>"返信内容を記述してください", "optional"=>false, "min_length"=>1, "max_length"=>140, "data_source"=>"", "options"=>null ], [ "display_name"=>"返信に送付する画像 0", "name"=>"twimg0", "type"=>"text", "subtype"=>"url", "default"=>"", "placeholder"=>"https://fascode.net/img.png", "help_text"=>"", "optional"=>true, "min_length"=>0, "max_length"=>0, "data_source"=>"", "options"=>null ], [ "display_name"=>"返信に送付する画像 1", "name"=>"twimg1", "type"=>"text", "subtype"=>"url", "default"=>"", "placeholder"=>"https://fascode.net/img.png", "help_text"=>"", "optional"=>true, "min_length"=>0, "max_length"=>0, "data_source"=>"", "options"=>null ], [ "display_name"=>"返信に送付する画像 2", "name"=>"twimg2", "type"=>"text", "subtype"=>"url", "default"=>"", "placeholder"=>"https://fascode.net/img.png", "help_text"=>"", "optional"=>true, "min_length"=>0, "max_length"=>0, "data_source"=>"", "options"=>null ], [ "display_name"=>"返信に送付する画像 3", "name"=>"twimg3", "type"=>"text", "subtype"=>"url", "default"=>"", "placeholder"=>"https://fascode.net/img.png", "help_text"=>"", "optional"=>true, "min_length"=>0, "max_length"=>0, "data_source"=>"", "options"=>null ], ], "submit_label"=>"ツイートする", "notify_on_cancel"=>false, "state"=>"NODATA" ] ]; foreach ($contents as $key => $value) { error_log($key." : ".$value); } $context = stream_context_create( array( 'http' => array( 'method'=> 'POST', 'header'=> 'Content-type: application/json; charset=UTF-8', 'content' => ''.json_encode($data) ) ) ); $contentss = file_get_contents("https:///api/v4/actions/dialogs/open", false, $context); It works fine for slash commands. In case of slash command, it is necessary to modify the source code from $contents["trigger_id"] to $_POST["trigger_id"]. If it is a slash command, it will return with POST If it's a button, it will come back with json. This difference is inconvenient