-
Notifications
You must be signed in to change notification settings - Fork 3
How To Use
First, let's go to the Slack APPS site, you'll fall into a page something like this:
Let's click Create New App, it will open a window asking App Name that you will put the name of your application, and Development Slack Workspace that you will place where your app will work, which in the case, it will be on your Slack server. After that, click Create App
After that, you will be redirected to the menu of your application, go to the option OAuth & Permissions, in Scopes> Select Permission Scopes you must select the permissions that your application will have, we recommend that you put the Administer the workspace, so that the application has access and permission to everything within Slack, but if your server is more careful, put the permissions as you prefer. Remember that the permissions you put in may influence the operation of the BOT.
After putting the permission, the part of Scopes will look something like this:
Just click Save Changes to save what was done.
After that, go to the option Bot Users and click Add a Bot User to add a new BOT to your application, customize the name that will be displayed and the user, and click Save Changes
After that, go back to Basic Information in the menu and look for Install your app to your workspace, click on this option, see that it will show some information next to the Install App to Workspace button, click button. When you click the button to install the application on your server, it will open a page asking you to authorize the application, click Authorize
To use SLfR is simple, you will first need to download the source code (by cloning this repository) console slack-bot @ pc: ~ $ git clone https://github.com/slack-bot-4all/slack-bot.git
(I.e.
After that, change the .env file by adding the Rancher 1.6, BOT and HTTP port information that will run the API
RANCHER_ACCESS_KEY=<RANCHER_API_ACCESS_KEY>
RANCHER_SECRET_KEY=<RANCHER_API_SECRET_KEY>
RANCHER_BASE_URL=<API_BASE_URL> Ex.: http://yourdomain.ip:8080/v1/projects
RANCHER_PROJECT_ID=<ENVIRONMENT_ID>
SLACK_BOT_TOKEN=<API_SLACK_ACCESS_TOKEN>
SLACK_BOT_ID=<BOT_ID>
SLACK_BOT_CHANNEL=<CHANNEL_WHERE_THE_BOT_LISTEN_COMMANDS>
SLACK_BOT_VERIFICATION_TOKEN=<BOT_VERIFICATION_TOKEN>
HTTP_PORT=<HTTP_PORT>Note: To get the BOT ID, you will need to first leave it blank and run the application (which will be taught below), you will get the BOT ID in the application logs, as in the image below.
With the .env file changed, you will need to decide how to run, whether to run on the machine where you are connected, or if you want to dockerizer. If you want to run directly on the machine, just run the .go files, as follows:
slack-bot@pc:~$ go run *.goIf you want dockerizar, just do the Docker image build, our Dockerfile is ready to be build:
slack-bot@pc:~$ docker build -t usuario/nome-da-imagem:versao .And after that, just give the docker run in your already-built image:
slack-bot@pc:~$ docker run -d -p PORT_HTTP:PORT_HTTP -e "FILE=.env" user/image-name:versionRemember to externalize the HTTP port you set in .env, so that the Slack API can access the URL.
Done, now the BOT is already running, just check the Slack channel you have set for him to listen to the messages if he sent the message telling you it's online, and just use it! 😊
SlackBot Jeremias
Magno Oliveira
|
Cayo Hollanda