Coder Social home page Coder Social logo

clslackbundle's Introduction

SlackBundle Software License

UPDATE: There were issues with earlier releases, please try using ~0.15.1 and report any further issues asap!

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

If you would like to access the Slack 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.

clslackbundle's People

Contributors

cleentfaar avatar codingninja avatar scrutinizer-auto-fixer avatar

Watchers

 avatar James Cloos avatar Marc Foi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.