2017 © Pedro Peláez
 

symfony-bundle slackmessengerbundle

An integration bundle with slack

image

xteam/slackmessengerbundle

An integration bundle with slack

  • Friday, March 4, 2016
  • by piotrpasich
  • Repository
  • 0 Watchers
  • 0 Stars
  • 41 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

SlackMessenger

This bundle allows you to receive and publish messages from Slack mapped to Message objects., (*1)

Scrutinizer Code Quality ScrutinizerBuild Status Travis Build Status SensioLabsInsight, (*2)

Extending

To receive messages you need to create an EventListener which will be listening to the event slack.message_received, (*3)

Example:, (*4)

namespace PP\AwesomeBundle\EventListener;

use XTeam\SlackMessengerBundle\Event\MessageEvent;

class AwesomeWorkListener
{
    public function doYourJob(MessageEvent $event)
    {
        $message = $event->getMessage();
        /** Do the right job **/
    }
}

And register this in services.yml, (*5)

;PP/AwesomeBundle/Resources/config/service.yml
services:
    pp_awesome.awesome.listener:
        class: %pp_awesome.awesome.listener.class%
        tags:
            - { name: kernel.event_listener, event: slack.message_received, method: doYourJob }

Installation

Step 1: Composer require

``` bash $ php composer.phar require xteam/slackmessengerbundle "dev-master", (*6)


### Step 2: Enable the bundle Enable the bundle in the kernel: ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new XTeam\SlackMessengerBundle\XTeamSlackMessengerBundle(), ); }

Step 3: Add options to parameters.yml

#app/config/parameters.yml
parameters:
  # ...
  slack.token: Your SLack token

Step 4: Add routes

#app/congig/routes.yml

x_team_slack_messenger:
    resource: "@XTeamSlackMessengerBundle/Resources/config/routing.yml"
    prefix:   /

Notes

This bundle requires a Symfony in version higher or equal 2.7, (*7)

Usage example

curl -X POST --data 'token=XXXXXXXXXXXXXXXXXX&team_id=T0001&team_domain=example&channel_id=C2147483705&channel_name=test&timestamp=1355517523.000005&user_id=U2147483697&user_name=Steve&text=googlebot: What is the air-speed velocity of an unladen swallow?&trigger_word=googlebot' http://localhost/app_dev.php/v1/message/post

curl -X POST --data 'token=XXXXXXXXXXXXXXXXXX&team_id=T0001&team_domain=example&channel_id=C2147483705&channel_name=test&timestamp=1355517523.000005&user_id=U2147483697&user_name=Steve&text=googlebot: What is the air-speed velocity of an unladen swallow? /five <@U07E9557H> and <@U07HSHYAU>&trigger_word=googlebot' http://localhost/app_dev.php/v1/message/post

The Versions

04/03 2016

dev-master

9999999-dev

An integration bundle with slack

  Sources   Download

MIT

The Requires

 

by Piotr Pasich

04/03 2016

v0.1.1

0.1.1.0

An integration bundle with slack

  Sources   Download

MIT

The Requires

 

by Piotr Pasich

23/07 2015

v0.1

0.1.0.0

An integration bundle with slack

  Sources   Download

MIT

The Requires

 

by Piotr Pasich