Whether you want to have an automated conversation or respond to slash commands, bots are extremely useful and play an important part in your day to day life. By Integrating a Slack channel with Automated Bots, bot users can do almost anything you can program them to. It all depends on the AI we implement in the bot programs to respond to our queries.
Bot users have the same qualities that their human counterparts have—they can interact with you, answer your queries, post messages on your behalf, etc. Bot users are controlled programmatically by the AI we integrate in them—which can be anything depending upon your needs.
App42 provides a way to build your customized bots and to deploy it on App42 PaaS platform. App42 Platform-as-a-Service is a cloud application hosting and polyglot platform which supports multiple languages and frameworks.
Here we are explaining how you can configure Slack Bots as per your requirement and can easily host the same on App42 PaaS that provides complete web hosting services across multiple frameworks.
Here is the list of configurations and Steps that you will need to follow:
- Configure Webhook on Slack with Sample Application
- Custom Integration of Bots on Slack Dashboard
- Slack Slash command configuration
- Deploy Node.js server on App42 PaaS
- Attach Webhook URL with Slash Command
- Slack Bot Creation
- Slack Bot Configuration
Configure Webhook on Slack with Sample Application
For custom integration you need to configure Webhook on Slack. Configure the following settings below. We also provide a sample application, so that you can do configuration with ease:
● Download or Clone the sample Application from Git. This is a Sample Node.js(4.4.5) application
● Set up Node.js Server on your local system
● Navigate to project directory
● Install dependencies by running command $ npm install
● Copy .env-example to .env $ copy .env-example .env
● Start the server locally $ npm start
● Now you will be able to see node.js server running locally on 3000 port
Custom Integration of Bots on Slack Dashboard
Once Node.js server is running successfully on your local system we need to do the Custom integration of bot on slack dashboard.
- Open Slack Dashboard. Go to à apps à build and Click on Make a Custom Integration
- Select Incoming WebHooks option from Custom Integration
- Select the Channel and Click on Add Incoming WebHooks integration option
- After the Incoming WebHook Page is opened on Slack Dashboard, go to Integration Settings option and find the Webhook URL option
- Copy the Webhook URL by clicking the Copy URL option, open the Project and put the same URL in Config.js file in Node.js application like given below
WEBHOOK_URL: https://hooks.slack.com/services/T1KFSBW30/sss/wswswswssw
Slack Slash Command Configuration
Slash commands enable you to listen to a custom command across the slack channels, and trigger a POST or GET request to a configurable endpoint. In this case, endpoint will be the Node.js application that will be deployed on App42 PaaS.
- Go to Build your Own à Custom Integration option and select Slash command option and specify the name of command like /startbot and click on Add Slash command option
- Once your Slash Command is created, copy Slash Command Token from Integration settings option, copy the same and open the config.js file in Node project and add the token like STARBOT_COMMAND_TOKEN: “s21AvJ2ZiA5voJEXSG8nmd3a”
Deploy Node Server on App42 PaaS
Once slash command configuration is completed, deploy Node.js application on App42 PaaS to get the domain URL on which you need to add the URl hook
● Follow the App42 PaaS deployment steps given at the end of this doc.
● Once deployment is done launch the application and copy the URL
● Now open the index.js file of your sample App on local, and verify that the Post request URl is “/commands/startbot”
Attach WebHook URL with Slash Command
Open the Slash Command Integration settings and copy the Post request URl here like given below:
Slack Bot Creation
Now, you will need to create a Slack Bot for which the above steps are being follows. Slack Bot works on RTM (Real Time Messaging) principal.
Again go to Slack Custom Integration and select Bot option to create a Slack Bot. Enter a name of the Bot that you want to create.
Slack Bot Configuration
Once Slack Bot is created open the configuration page. Go to Integration Settings option and copy the Bot API Token as shown below
Bot Configuration in Sample Application
Open Config.js file of sample project and place the Slack Bot Token here that you have copied in the previous step
SLACK_TOKEN: “xoxb-55672202647-AW6KKc4kgPFwp8oEexIQ32L9”
● Follow the deployment step on App42 PaaS
● Deploy your application there
● Now you can open Slack Dashboard and you will be able to see your Bot there
● You can configure messages on Slack Dashboard and chat with Slack Bot
Deployment on App42 PaaS
Here are the steps, you need to follow for deployment of your Node server.
- Login/Register with App42 PaaS
- Go To PaaSHQ Dashboard
- Create a Node.js application there
- The request for the same will be sent to App42 Support Team, once it is approved, please follow the steps below
- Once application is created now go to your Node.js server code and make it in zip format
- Select deploy option on PaaS HQ dashboard and upload your code
- Once the status turns out to be Running, your server has been deployed on App42 PaaS
- Now you can test your Bot by using App42 PaaS Server
- You can develop and redeploy the same once development is done
Note: For proper messaging you will need to write your AI logic in the sample app and check the bot functionality.
For more information on App42 PaaS please click here. Should you have any query, please feel free to reach us at support@shephertz.com
Leave A Reply