Adsense

  • Latest News

    Monday 5 February 2018

    Creating a SlackBot in Python using Flask, Slack App, AWS Account & MySQL Workbench


    What is Slack and SlackBot?
    Slack is a cloud-based set of team collaboration tools and services. While no longer using an IRC backend, Slack offers a lot of IRC-like features: persistent chat rooms (channels) organized by topic, as well as private groups and direct messaging. All content inside Slack is searchable, including files, conversations, and people. Slack integrates with a large number of third-party services and supports community-built integrations.
    SlackBot is a Slack-integrable bot that functions as per the user requirements. The admin can define the functions for the bot like reading the messages, replying and manipulating them and accessing information from 3rd party websites.

    Requirements
    • 1. Slack App
    • 2. AWS Account
    • 3. Zappa
    • 4. Ngrok
    • 5. MySQL Workbench
    Python dependencies
    • 1. PyMySQL
    • 2. slackclient==1.0.6
    • 3. anyjson==0.3.3
    • 4. aws
    • 5. PythonConfluenceAPI==0.0.1rc6
    Coding & Configurations
    • 1. Find the python code available at www.github.com/prayas26/slackbot. This code will help you communicate with Confluence Wiki using Slack.
    • 2. Replace the confidential fields with your details.
      • a.Go to http://api.slack.com and create a new app. Replace the client_id, client_secret and verification token by the ones of your app in bot.py.
      • b. Replace your email id credentials in app.py.
    • 3. Create an AWS free-tier account and install aws on your PC. To configure aws, use the command aws configure. You can get the AWS Access ID and Secret Access Key from IAM Management Console of AWS.
    •  
    • 4. Open db.py and update the credentials of your database in it.
    • 5. After you get the following credentials, run the command zappa init on the terminal.
    •  
    • 6. Run the command zappa deploy <bucket_name> and then after each update in code, run zappa update <bucket_name>.
    • 7. After uploading the project online, you will get the link to your deployment. Copy the URL as we will need it further.
    • 8. Now in the bot settings in Slack, set the Request url as URL/listening. Use the installation link as URL/install.
    • 9. Now open the installation link and install the bot on your slack team.
    • 10. Now you can send a personal message to the bot or on the channel where you have added the blog.
    • 11. Change the handle function in bot.py to make your bot follow your orders.
    Working Demo: https://www.youtube.com/watch?v=l09h6l6SYm0

    Author: Prayas Mittal 
    • Blogger Comments
    • Facebook Comments

    0 comments:

    Post a Comment

    Thanks for your comment. We will try to reply as soon as possible.

    Regards
    VSL Creations

    Item Reviewed: Creating a SlackBot in Python using Flask, Slack App, AWS Account & MySQL Workbench Rating: 5 Reviewed By: Vishal Aditya
    Scroll to Top