/ruby-capstone-bot

An implementation of a bot that automatically sends the upcoming events retrieved on Google Calendar API to the users' Slack messages using Slack Web API. Built with Ruby.

Primary LanguageRubyMIT LicenseMIT

Ruby Capstone Project

Create your own BOT

A project made in Ruby where I made a BOT using Slack Web API and Google Calendar API to automatically send a message on Slack with the upcoming events present on the users' Calendar

screenshot

Getting Started

Installation

How to configure Slack APP and Google Calendar API

Requirements

Setting token

Command to start the program

Live demo

Author

Acknowledgments

Contributing

Show your support

License

Built With

  • Ruby
  • Slack Web API
  • HTTParty
  • Google API Ruby Client

Getting started

In order to run the project locally follow all steps below:

Install git following the instructions available at Git

Clone the repository typing the command below on your preferred terminal

git clone https://github.com/marcelomaidden/ruby-capstone-bot/

After you have cloned the repository, enter the directory typing

cd ruby-capstone-bot

Installation

Install ruby following the instructions available at Ruby

After that run bundle to install all needed Ruby packages

bundle install

Explanation on how to configure Slack APP and Google Calendar API

https://www.loom.com/share/4b442db4c7b7487682305a6db1224532?sharedAppSource=personal_library

https://www.loom.com/share/e26b55c4f87847e686dac077b92de2ef?sharedAppSource=personal_library

https://www.loom.com/share/ba1bc757304f419eb7ccc5e10ea2e41e?sharedAppSource=personal_library

Requirements

Slack Web API

  • Add workspace to Slack

  • Create app on Slack API in your new workspace

  • Add features and functionalities listed above in order for it to work properly:

    • Bots
    • Permissions
  • Install your app to your workspace

  • Add Bot Token Scopes

    • Scopes
      • users:read
      • usergroups:read
      • channels:history
      • channels:read
      • chat:write
      • chat:write.public
      • groups:history
      • im:history
      • mpim:history
  • Invite ruby-capstone-bot by running the command below in a Slack conversation

    /invite ruby-capstone-bot

  • Mention @ruby-capstone-project on a message

    @ruby-capstone-bot hello

Google Api Client

  • Turn on the Google Calendar API here

After that, place credentials.json and token.yaml files on the root directory from the project

Set environment variable token

Linux

export BOT_USER_OAUTH_ACCESS_TOKEN='string_token_from_bot_oauth_slack'

Windows

setx /m BOT_USER_OAUTH_ACCESS_TOKEN='string_token_from_bot_oauth_slack'

More information click here

Command to start the program

BOT_USER_OAUTH_ACCESS_TOKEN=$BOT_USER_OAUTH_ACCESS_TOKEN bundle exec ruby bin/run.rb 

Live Demo

Live Demo Link

How to test

In order to test our project run:

bundle exec rspec --format doc

Author

Marcelo Araújo

Acknowledgements

  • Ruby creators
  • Rspec project
  • Slack API
  • Google API

Contributing

Contributions, issues, and feature requests are welcome!

Show your support

Give a ⭐️ if you like this project!

License

This project is MIT licensed.