Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Simple application to send a messages to Slack and listen outgoing messages from Slack and reply those.

License

Notifications You must be signed in to change notification settings

by-pinja/labs-slack-integration

Repository files navigation

What is this

MIT licensed Build Status

Simple application to send a messages to Slack and listen outgoing messages from Slack and reply those.

Table of Contents

Requirements

Installation

1. Clone repository

Use your favorite IDE and get checkout from GitHub or just use following command

git clone https://github.com/protacon/labs-slack-integration.git

2. Configuration

Next you need to create .env file, which contains all the necessary environment variables that application needs. You can create it by following command (in folder where you cloned this project):

cp .env.dist .env

Then open that file and make necessary changes to it. Note that this .env file is ignored on VCS.

3. Dependencies installation

Next phase is to install all needed dependencies. This you can do with following command, in your project folder:

composer install

Or if you haven't installed composer globally

curl -sS https://getcomposer.org/installer | php
php composer.phar install

4. File permissions

Next thing is to make sure that application var directory has correct permissions. Instructions for that you can find here.

I really recommend that you use ACL option in your development environment.

5. Environment checks

To check that your environment is ready for this application. You need to make two checks; one for CLI environment and another for your web-server environment.

CLI environment

You need to run following command to make all necessary checks.

./vendor/bin/requirements-checker

Web-server environment

Open terminal and go to project root directory and run following command to start standalone server.

./bin/console server:start

Open your favorite browser with http://127.0.0.1:8000/check.php url and check it for any errors.

6. Slack configuration

You need to configure your Slack to connect to this application. And to do that open https://[your_slack].slack.com/customize/ in your favorite browser and click Configure Apps on left hand side menu.

And after that click Custom Integrations

Incoming WebHooks

Create new hook as you like, and copy that Webhook URL to your .env file SLACK_WEBHOOK_URL value.

Outgoing WebHooks

Create new hook as you like, and set this application URL to URL(s) section on configuration. Then copy token to your .env file SLACK_TOKEN value.

Development

IDE

I highly recommend that you use "proper" IDE to development your application. Below is short list of some popular IDEs that you could use.

Personally I recommend PhpStorm, but just choose one which is the best for you. Also note that project contains .idea folder that holds default settings for PHPStorm.

PHP Code Sniffer

It's highly recommended that you use this tool while doing actual development to application. PHP Code Sniffer is added to project dev dependencies, so all you need to do is just configure it to your favorite IDE. So the phpcs command is available via following example command.

./vendor/bin/phpcs -i

If you're using PhpStorm following links will help you to get things rolling.

Docker

Todo

Testing

Project contains bunch of tests (Functional, Integration, Unit) which you can run simply by following command:

./bin/phpunit

Note that you need to create .env.test file to define your testing environment. This file has the same content as the main .env file, just change it to match your testing environment.

Or you could easily configure your IDE to run these for you.

Coverage

After you have run tests you can see actual code coverage by opening ./build/report/index.html with your favorite browser

Metrics

Project also contains PhpMetrics to make some analyze of your code. You can run this by following command:

./vendor/bin/phpmetrics --junit=build/logs/junit.xml --report-html=build/phpmetrics .

And after that open build/phpmetrics/index.html with your favorite browser.

Links / resources

Authors

Tarmo Leppänen

License

The MIT License (MIT)

Copyright © 2018 Protacon Solutions Ltd

About

Simple application to send a messages to Slack and listen outgoing messages from Slack and reply those.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages