Giter Club home page Giter Club logo

slackbuu's Introduction

SlackBuu

What is SlackBuu?

SlackBuu is Slack Bot User Underlayer.

It is a PHP library for building Slack chat bot apps on top of.

It does not try to make use of every type of custom integration in Slack. It is specifically made to build Slack chat bot services, one that connects to Slack's WebSockets API and send & receive messages.

Additionally, this also includes the OAuth logic for users to add your app onto their Slack team. (Optional)

The motivation to develop this comes from the fact that while many good libraries for Slack integration are available in other langauges, the selection for PHP is more limited. There are a few out there that have very heavy dependencies, like React PHP, or PHP 5.4+ / 5.5+. (At this moment, PHP 5.3 is still the default version that comes with many AWS and Digital Ocean builds, which makes having a PHP 5.4+ requirement a laborous effort to deploy something quickly to play around with.)

Requirements

  • PHP 5.3 or above
  • PHP cURL library
  • PHP POSIX library (php-posix or php-process)
  • Apache web server (Optional, only if you want the OAuth integration)
  • No other dependencies, so composer not required; since everything needed is included in the repo.

Credits

Because I'm not using composer dependencies, I included in this repo two PHP libraries I made use of:

  • Websocket-PHP to allow a PHP script to act as a WebSocket client (not server)
  • ToroPHP to make clean URLs easily in a very light-weight way

Slack APIs used

This library makes use of the following Slack APIs:

Getting started

You can use only the SlackBotUser module on its own, as a PHP chat bot server just for your Slack team as custom integration; or you can use the OAuth layer in addition, which will be a full base code for building your own distributable Slack app.

To start a bot user on your Slack team only

  1. Visit https://[yourteam].slack.com/apps/manage/A0F7YS25R-bots
  2. Click "Add integration", choose a name, and copy the API token of the bot.
  3. Cd to the root of this repo, and use the API token in the following command.
  4. Run php start-dev.php xoxb-123-abc and your chat bot will start running!

To build a distributable Slack chat bot app

  1. Run chmod 777 logs to make the logs directory writable and executable by Apache.
  2. Set up a vhost on your domain and dev domain.
  3. Look at www/index.php to see how prod and dev environment is determined. Set up your vhost accordingly.
  4. Create a new Slack app from this page.
  5. Enter something for App Name, Team, Description, Icon, etc.
  6. In the "Redirect URI(s)" field, enter your domain. For example: http://yourdomain.com/
  7. Copy the Client ID and Client Secret from the result page, paste into Config.php accordingly, and update the host name in there.
  8. Scroll down on this page, to "Bot User", click "Add a bot to this app".
  9. Pick a name and click the "Add bot user" button.
  10. Visit http://yourdomain.com and install your own app and try it out!

License

SlackBuu was created by Bigi Lui and released under the MIT License.

slackbuu's People

Contributors

bigicoin avatar

Stargazers

Allen Sebastian avatar José Cage  avatar Max Grom avatar Franz Josef Kaiser avatar Alvin P. avatar

Watchers

 avatar Alvin P. avatar  avatar

slackbuu's Issues

pcntl_fork php function

Not sure if this is just my machine or what, but I get an error saying "Fatal error: Call to undefined function pcntl_fork()"

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.