cleentfaar/slack-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

This bundle provides integration with the Slack API library, allowing you to interact with the Slack API from within your Symfony projects

Installs: 404 163

Dependents: 0

Suggesters: 4

Security: 0

Stars: 46

Watchers: 7

Forks: 31

Open Issues: 6

Type:symfony-bundle

0.20.1 2016-05-30 22:12 UTC

README

Symfony bundle that integrates the Slack API client by providing easy-to-use services and configuration.

If you would like to access the Slack Web API from the command-line, consider installing the slack-cli package.

Build Status Coverage Status Quality Score Latest Version Total Downloads

Quick example

Here is an example of how you can access the API's chat.postMessage method to send a message to one of your Slack channels:

<?php
// Acme\DemoBundle\Controller\MySlackController

public function sendAction()
{
    $payload = new ChatPostMessagePayload();
    $payload->setChannel('#general');   // Channel names must begin with a hash-sign '#'
    $payload->setText('Hello world!');  // also supports Slack formatting
    $payload->setUsername('acme');      // can be anything you want
    $payload->setIconEmoji('birthday'); // check out emoji.list-payload for a list of available emojis

    $response = $this->get('cl_slack.api_client')->send($payload);

    // display the Slack channel ID on which the message was posted
    echo $response->getChannel(); // would return something like 'C01234567'

    // display the Slack timestamp on which the message was posted (note: NON-unix timestamp!)
    echo $response->getTimestamp(); // would return something like '1407190762.000000'
}

In Slack, that should give you something like this in the #general channel: Example of a message posted to Slack

These and more examples can be found in the usage documentation.

Documentation

Detailed documentation on how to access each API method can be found in the documentation of the package that this bundle integrates: Slack API library

Thanks

  • @fieg, for initial ideas about integrating Slack with our projects.
  • The guys at Slack, for making an awesome product and clean documentation.

Contributing

If you would like to contribute to this package, check out the contribution doc here.