https://github.com/thatkalle/slack-slash-command-php
Drive Slack slash commands with PHP
https://github.com/thatkalle/slack-slash-command-php
php slack slash-commands
Last synced: about 2 months ago
JSON representation
Drive Slack slash commands with PHP
- Host: GitHub
- URL: https://github.com/thatkalle/slack-slash-command-php
- Owner: ThatKalle
- License: mit
- Created: 2018-04-19T20:23:51.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-19T20:34:38.000Z (about 8 years ago)
- Last Synced: 2025-01-04T15:51:27.845Z (over 1 year ago)
- Topics: php, slack, slash-commands
- Language: PHP
- Size: 28.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slack-slash-command-PHP
Want to run the Slack [Slash Commands](https://api.slack.com/slash-commands) in a no hassle PHP environment?
### Installing
Follow Slacks [instuctions](https://api.slack.com/slash-commands#setting_up_your_slash_command) as to get an App up and running who'll perform your slash commands.
Deploy the 'bot' to, well, any PHP enabled webhost, the version of PHP needed will depend on what functions you decide to use. Go for atleast 5.4+.
```
sudo apt-get install git wget -y
git clone https://github.com/ThatKalle/slack-slash-command-PHP.git
cp -r slack-slash-command-PHP/. /var/www/public_html
```
You'll also have to update the `$valid_tokens` array in [config.php](/config.php) with your own **Verification Token** provided by Slack when creating your App. [link](https://api.slack.com/apps).
You can add multiple keys to authenticate the same bot to multiple Slacks _for example_.
Create a new Slash Command in Slack and point it to the .php file, for example https://FQDN/template to use [template.php](/template.php).
#### Examples
`/marvin lunch` will provide a list of local lunch restaurants, as well as a bonus on fridays! - [marvin.php](/example/marvin.php)

`/at T12341212.1234` will provide handy links to open the corresponding Ticket or Task in Autotask PSA. - [at.php](/example/at.php)

## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Acknowledgments
* Hat tip to anyone who's code was used
* [imlinus](https://github.com/imlinus)