diff --git a/README.md b/README.md index 4d86104..5737a26 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ Here is a very simple example of using this package: ```php setResponseFactory(new SlackResponseFactory); +// see doc/Toekn.md for more informations $commander = new Commander('xoxp-some-token-for-slack', $interactor); $response = $commander->execute('chat.postMessage', [ @@ -33,7 +37,9 @@ $response = $commander->execute('chat.postMessage', [ 'text' => 'Hello, world!' ]); -if ($response['ok']) +$responseBody = $response->getBody(); + +if ($responseBody && responseBody['ok']) { // Command worked } diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 0000000..74fe4a3 --- /dev/null +++ b/doc/README.md @@ -0,0 +1,2 @@ +* TOKEN.md Get the token for communication with API of slack + diff --git a/doc/TOKEN.md b/doc/TOKEN.md new file mode 100644 index 0000000..13560ca --- /dev/null +++ b/doc/TOKEN.md @@ -0,0 +1,8 @@ +To communicate through the API of Slack, you need a token. Here is the way to get it. + +1. Go to https://api.slack.com/ +2. In "Authentication" section, click on generate token. +3. This is your token, change in sample 'xoxp-some-token-for-slack' by the one you just receive. + + + diff --git a/src/Contracts/Http/Response.php b/src/Contracts/Http/Response.php index b495f32..c87893e 100644 --- a/src/Contracts/Http/Response.php +++ b/src/Contracts/Http/Response.php @@ -5,7 +5,7 @@ interface Response { /** * Gets the body of the response. * - * @return string + * @return array */ public function getBody(); diff --git a/src/Http/SlackResponse.php b/src/Http/SlackResponse.php index dccfdfb..34e6939 100644 --- a/src/Http/SlackResponse.php +++ b/src/Http/SlackResponse.php @@ -5,7 +5,7 @@ class SlackResponse implements \Frlnc\Slack\Contracts\Http\Response, \JsonSerial /** * The response body. * - * @var string + * @var array */ protected $body;