2017 © Pedro Peláez
 

symfony-bundle slackbundle

Symfony2 Bundle for communicating with the Slack API

image

orukusaki/slackbundle

Symfony2 Bundle for communicating with the Slack API

  • Friday, March 13, 2015
  • by orukusaki
  • Repository
  • 2 Watchers
  • 10 Stars
  • 258 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 4 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Slack Bundle

Build Status, (*1)

This bundle provides, (*2)

  • A Guzzle client to access the Slack API
  • A Cli command to monitor a group on an event loop, dispatching events to handle messages received.
  • Controllers for recieving slash commands and outgoing webhooks
  • A Behat context class to help with functional testing of your bot

This bundle is very much in alpha status, (*3)

Installation

composer require 'orukusaki/slackbundle'

Add these lines you your AppKernal::registerBundles, (*4)

...
new Orukusaki\Bundle\SlackBundle\OrukusakiSlackBundle(),
new Misd\GuzzleBundle\MisdGuzzleBundle(),
...

Add config to config.yml:, (*5)

orukusaki_slack:
    api_key: <Your API Key>
    identity:
        username: My Api Bot
        emoji: ":space_invader:"

Recieving Slash commands and webhooks

Add the bundle to your routing.yml, (*6)

orukusaki_slack:
    resource: "@OrukusakiSlackBundle/Controller/"
    type:     annotation
    prefix:   /slack

In the Slack Integrations page, create a slash command pointing to /slack/slashcommand or a webhook pointing to /slack/webhook, (*7)

Running as a Bot

app/console slack:run < group name >, (*8)

Adding your own commands

Add an Event Listener which will be triggered every time a message is received. There are a couple of examples in the services.xml for this bundle:, (*9)

<service id="slack.listener.sayhi" class="Orukusaki\Bundle\SlackBundle\Listener\SayHiListener">
    <argument type="service" id="slack.client" />
    <tag name="kernel.event_listener" event="slack.message.received" method="handleMessageEvent" />
</service>

To see what commands you can run against the API, have a look at Resources/config/webservices.xml, (*10)

Behat Context

This bundle includes a Behat context to help you create functional tests for your bot. To use it, you much first enable the Symfony2 Behat extension in your behat.yml:, (*11)

composer require "behat/symfony2-extension" "*"

In behat.yml:, (*12)

default:
    extensions:
        Behat\Symfony2Extension\Extension: ~

Then in the constructor of your FeatureContext, import the SlackContext:, (*13)

$this->useContext('slack', new \Orukusaki\Bundle\SlackBundle\Context\SlackContext());

Use, (*14)

bin/behat -dl

To see the steps now available to you., (*15)

Contributing

Any bug reports / feature requests should be raised on this github page, (*16)

PRs are welcome, please branch from master, and run your code through phpcs (PSR-2 standard) and phpcs-fixer before submitting., (*17)

The Versions

13/03 2015

dev-master

9999999-dev http://github.com/orukusaki/slackbundle

Symfony2 Bundle for communicating with the Slack API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Peter Smith

api symfony2 slack

27/02 2014

0.0.1

0.0.1.0 http://github.com/orukusaki/slackbundle

Symfony2 Bundle for communicating with the Slack API

  Sources   Download

MIT

The Requires

 

by Peter Smith

api symfony2 slack