From 8ae0a89fbc42460cb74d7051b941d95676cf1a52 Mon Sep 17 00:00:00 2001 From: Paco Alba Ponce Date: Fri, 23 Apr 2021 10:05:09 +0100 Subject: [PATCH] chat.postMessage POST Method In Slack the method 'chat.postmessage' is being sent by "get" when it should be for "post". [https://api.slack.com/methods/chat.postMessage](https://api.slack.com/methods/chat.postMessage) In addition, the Slack documentation says that the authorization method should go to the Token in the Header. [https://api.slack.com/legacy/oauth#authenticating-users-with-oauth__using-access-tokens](https://api.slack.com/legacy/oauth#authenticating-users-with-oauth__using-access-tokens) --- src/Core/Commander.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Core/Commander.php b/src/Core/Commander.php index 8be8cd9..db30e5b 100644 --- a/src/Core/Commander.php +++ b/src/Core/Commander.php @@ -94,6 +94,7 @@ class Commander { ], 'chat.postMessage' => [ 'token' => true, + 'post' => true, 'endpoint' => '/chat.postMessage', 'format' => [ 'text', @@ -474,6 +475,8 @@ public function execute($command, array $parameters = []) $url = self::$baseUrl . $command['endpoint']; + $headers = array_merge($headers, ['Authorization' => 'Bearer ' . $this->token]); + if (isset($command['post']) && $command['post']) return $this->interactor->post($url, [], $parameters, $headers);