Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,27 @@ Here is a very simple example of using this package:
```php
<?php

// if you are in a standalone page, uncomment the following line
// include 'vendor/autoload.php';

use Frlnc\Slack\Http\SlackResponseFactory;
use Frlnc\Slack\Http\CurlInteractor;
use Frlnc\Slack\Core\Commander;

$interactor = new CurlInteractor;
$interactor->setResponseFactory(new SlackResponseFactory);

// see doc/Toekn.md for more informations
$commander = new Commander('xoxp-some-token-for-slack', $interactor);

$response = $commander->execute('chat.postMessage', [
'channel' => '#general',
'text' => 'Hello, world!'
]);

if ($response['ok'])
$responseBody = $response->getBody();

if ($responseBody && responseBody['ok'])
{
// Command worked
}
Expand Down
2 changes: 2 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* TOKEN.md Get the token for communication with API of slack

8 changes: 8 additions & 0 deletions doc/TOKEN.md
Original file line number Diff line number Diff line change
@@ -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.



2 changes: 1 addition & 1 deletion src/Contracts/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface Response {
/**
* Gets the body of the response.
*
* @return string
* @return array
*/
public function getBody();

Expand Down
2 changes: 1 addition & 1 deletion src/Http/SlackResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class SlackResponse implements \Frlnc\Slack\Contracts\Http\Response, \JsonSerial
/**
* The response body.
*
* @var string
* @var array
*/
protected $body;

Expand Down