2017 © Pedro PelĂĄez
 

library pslackr

Inbound Webook intergration for Slack.com

image

kfreiman/pslackr

Inbound Webook intergration for Slack.com

  • Thursday, October 15, 2015
  • by k.freiman
  • Repository
  • 1 Watchers
  • 0 Stars
  • 117 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 6 % Grown

The README.md

Build Status Code Climate, (*1)

pslackr [slak-er]

pSlackr is a library for integrating Slack.com's inbound web hook into your application enabling you to send messages to your group chat channels from your application, (*2)

Installing

Via Composer, (*3)

composer require fullybaked/pslackr

 Slack API Token

Pslackr uses the old style of sending the token with the request to Slack, so to find the correct token go to your inbound web hook on Slack and you should see, (*4)

https://hooks.slack.com/services/A111AA1AA/B00BB0BBB/aBCDe1FGHijKlmNoP

Where ever Pslackr requires an API token you need to use the last string in the URL aBCDe1FGHijKlmNoP in the example above., (*5)

 Usage

Example of basic usage with suplied classes

<?php
require_once 'vendor/autoload.php';

use FullyBaked\Pslackr\Messages\CustomMessage;
use FullyBaked\Pslackr\Pslackr;

$message = new CustomMessage('Testing from Pslackr');

$config = ['token' => 'YOUR_TOKEN', 'domain' => 'YOUR_DOMAIN'];
$slack = new Pslackr($config);
$slack->send($message);

Customise the message

The supplied CustomMessage class details the optional parameters that can be sent as part of the request. These parameters allow you to customise the message., (*6)

  1. Channel
  2. Username
  3. Icon (url or emoji)
<?php 

use FullyBaked\Pslackr\Messages\CustomMessage;

$message = new CustomMessage('Testing from Pslackr');

$message->channel('#my-other-channel');

$message->username('slackbot');

$message->iconUrl('http://example.tld/path/to/my.png');
// OR //
$message->iconEmoji(':ghost:');

Changing the HTTP Client

By default Pslackr was built with Guzzle and has it listed as a dependency, however for various reasons you may wish to use your own HTTP client. If so, this can be acheived by implementing the Transport interface using your own choice of HTTP client., (*7)

The Versions

15/10 2015

dev-master

9999999-dev https://github.com/kfreiman/pslackr

Inbound Webook intergration for Slack.com

  Sources   Download

MIT

The Requires

 

The Development Requires

slack slack.com

09/03 2014

0.1.4

0.1.4.0 https://github.com/fullybaked/pslackr

Inbound Webook intergration for Slack.com

  Sources   Download

MIT

The Requires

 

The Development Requires

slack slack.com

09/03 2014

0.1.3

0.1.3.0 https://github.com/fullybaked/pslackr

Inbound Webook intergration for Slack.com

  Sources   Download

MIT

The Requires

 

The Development Requires

slack slack.com

08/03 2014

0.1.2

0.1.2.0 https://github.com/fullybaked/pslackr

Inbound Webook intergration for Slack.com

  Sources   Download

MIT

The Requires

 

The Development Requires

slack slack.com

08/03 2014

0.1.1

0.1.1.0 https://github.com/fullybaked/pslackr

Inbound Webook intergration for Slack.com

  Sources   Download

MIT

The Requires

 

The Development Requires

slack slack.com