# Slack Swarm module A simple Swarm module that monitors the Project's Activity feed for changes. Changes are sent to the Slack channel specified in the Project's configuration page. ![Add Integration](images/PerforceSlack.png) The hyperlinks will take you directly to the Change or user specs in Swarm. ## Installation **Swarm 2015.4 is required** (the Slack module needs data-access to the Project's configuration). The Slack module consists of 4 four files... ``` module/Slack/config/module.config.php module/Slack/Module.php module/Slack/src/Slack/Message.php public/module/Slack/js/Slack.js ``` 1. Copy the module directory `module/Slack` into your Swarm's `module/...` installation directory. Typically `/opt/swarm/module/...` 2. Copy the remainding file `Slack.js` into your Swarm's `public` folder keeping the directory structure `module/Slack/js/`. A typical install destination: `/opt/swarm/public/module/Slack/js/Slack.js` 3. Restart your Swarm web service and the you should be ready to use the Slack integration. ## Setup For the Swarm project to talk to Slack you need to add an `Incoming Webhook`. Open Slack and access the options menu for the channel you want to add the integration. Then select 'Add a service integration ...' ![Add Integration](images/AddIntegration.png) Scroll down to the bottom of the list to 'DIY Integrations and Customizations' and select 'Incoming Webhook'. ![Add Incoming Webhook](images/Incoming.png) Find the channel from the list... ![Find Channel](images/FindChannel.png) then click to add.. ![Add Add Hook](images/AddHook.png) Copy the Webhook URL ![Add Add Hook](images/Webhook.png) and add the Webhook URL to the 'Slack Webhook' box on your Swarm Project's configuration page. ![Add Add Hook](images/SwarmConfig.png) 'Save' and you are done. ##Configuration The configuration of the module is located in: `module/Slack/config/module.config.php` you can see the default [here](https://swarm.workshop.perforce.com/projects/paul_allen-slack/files/main/module/Slack/config/module.config.php). 'slack' => array( 'user' => 'Swarm', 'icon' => 'https://pbs.twimg.com/profile_images/572920496824406016/Io8m39jD.jpeg', 'max_length' => 80 ) The fields are `user` the name of the Swarm Slack BOT shown in the chat feed. An external URL for `icon` used for the Slack BOT icon and `max_length` the number of characters to show from the Change description (default 80 characters).