Slack->DynamDB->Some applications

Overview

slack-event-subscriptions

About The Project

Do you want to get simple attendance checks? If you are using Slack, participants can just react on a specific post, then we can check the attendance based on the reaction. It's so simple and fun.

Built With

If you are not familiar with the libraries below, please read the documentation for the links below before getting started.

Getting Started

Prerequisites

  • Python3 (below 3.9, Zappa doesn't support 3.9 yet)
  • AWS credentials
  • Slack App
    1. Create the new app from https://api.slack.com/apps.
      screenshot_01
    2. Copy the signing secret.
      screenshot_02
    3. Add an OAuth scope (users.profile:read) and install to work space.
      screenshot_03
      screenshot_04
    4. Copy the OAuth Access Token.
      screenshot_05

Installation

  1. Clone the repo
    git clone https://github.com/UpstageAI/slack-event-subscriptions.git
  2. Install Python packages
    cd slack-event-subscriptions
    pip install -r requirements.txt
  3. Init Zappa
    zappa init
  4. Update the zappa_settings.json like the example below.
    • (REQUIRED) aws_region, REGION_NAME : AWS region for your services
    • (REQUIRED) SLACK_SIGNING_SECRET : Siging secret of your slack app
    • (REQUIRED) SLACK_OAUTH_TOKEN : Oauth token of your slack app
    • (REQUIRED) TABLE_NAME : Table name for DynamoDB
    • (OPTIONAL) SLACK_CHECK_CHANNEL : Specific channel id for the event subscription. (if it's empty, you will get the events from all channels.)
    • (OPTIONAL) KEY_WORD : In case you want to filter some users based on their name.
    ###Example for `zappa_settings.json`
    
     {
         "dev": {
             "app_function": "app.app",
             "aws_region": "ap-northeast-2",
             "profile_name": null,
             "project_name": "slack-event-sub",
             "runtime": "python3.8",
             "s3_bucket": "zappa-ih029w3pa",
             "environment_variables": {
                 "SLACK_SIGNING_SECRET": "<YOUR_SLACK_SIGNING_SECRET>",
                 "SLACK_OAUTH_TOKEN": "<YOUR_SLACK_OAUTH_TOKEN>",
                 "SLACK_CHECK_CHANNEL":"XXXXXXXXXXX",
                 "REGION_NAME": "ap-northeast-2",
                 "TABLE_NAME":"slack_attendance_check",
                 "KEY_WORD":""
             }
         }
     }
  5. Deploy the app and copy the endpoint from the output
    zappa deploy dev
    ...
    Waiting for stack slack-event-sub2-dev to create (this can take a bit)..
    50%|███████████████████████████████████████████████                                               | 2/4 [00:09<00:09,  4.90s/res]
    Deploying API Gateway..
    Deployment complete!: https://eycl36fqk9.execute-api.ap-northeast-2.amazonaws.com/dev
    
  6. Create the tables (for the first time)
    zappa invoke dev 'from db import create_table;create_table()' --raw
  7. Update the configurations for slack app.
    1. Enable events by adding <YOUR_ENDPOINT_URL>/slack/events
      screenshot_06
    2. Add workspace event reaction_added and user_change
      screenshot_07
  8. Save and reinstall your app.

Usage

Once you finish the setting, post the sample message in your slack channel and add a reaction.
screenshot_08

Then, you can find two tables from your DynamoDB.
screenshot_09 the shorter name one is the table for the event storing
screenshot_10 And, the table with a suffix _user is an actual organized version by the date and the name of the users.
screenshot_11

You can also access the data via api <YOUR_ENDPOINT>/csv, and it will return csv version.

user_id,username,z20210112
U01JH17VD19,Jungwon Seo,17:35:19
U01JH17VD20,Junglost Seo,17:36:20
U01JH17VD33,Jungdraw Seo,17:37:33
...

The csv api supports two query parameters d and s.

  • d: specific date for the list (e.g., d=20210112), if none, entire dataset will be returned.

  • s: sorting key for the result (e.g., s='user_id`). Only ascending order supports yet.

How to Test

You can update the temporary environment variable in pytest.ini

pytest test.py

Ohters

  • Updating the work
    zappa update dev
  • Cleaning the work
    zappa invoke dev 'from db import delete_table;delete_table()' --raw
    zappa undeploy dev 

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Jungwon Seo - [email protected]

Project Link: https://github.com/UpstageAI/slack-event-subscriptions

Owner
UpstageAI
UpstageAI
a discord libary that use to make discord bot with low efficiency and bad performance because I don't know how to manage the project

Aircord 🛩️ a discord libary that use to make discord bot with low efficiency and bad performance because I don't know how to manage the project Examp

Aircord 2 Oct 24, 2021
discord token grabber scam - eductional purposes only!

Discord-QR-Scam תופס אסימון תמונה של Discord על אודות סקריפט Python שיוצר אוטומטית קוד QR הונאה של Nitro ותופס את אסימון הדיסקורד בעת סריקה. כלי זה מד

Amit Pinchasi 0 May 22, 2022
Bot for mirroring one or multiple Twitter accounts in Pleroma/Mastodon.

Stork (pleroma-bot) Mirror one or multiple Twitter accounts in Pleroma/Mastodon. Introduction After using the pretty cool mastodon-bot for a while, I

73 Jan 08, 2023
A bot for Large Fry Larrys

GroupMe Bot Driver This driver is written entirely in Python, and with easy configuration in mind. Using this driver, you'll be able to monitor multip

1 Oct 25, 2021
It is automated instagram follower bot.

Instagram-Follower-Bot It is automated instagram follower bot. In This project I've used Selenium and Python. Work-Flow When I run my code. It's gonna

Falak Shair 3 Sep 28, 2022
Modified Version of mega.py package for Pyrogram Bots

Pyro Mega.py Python library for the Mega.co.nz API, currently supporting: login uploading downloading deleting searching sharing renaming moving files

I'm Not A Bot #Left_TG 10 Aug 03, 2022
Python library for RetroMMO related stuff, including API wrapper

python library for RetroMMO related stuff, including API wrapper.

1 Nov 25, 2021
Eva Maria Telegram Bot

Eva Maria Bot Features Auto Filter Manuel Filter IMDB Admin Commands Broadcast Index IMDB search Inline Search Random pics ids and User info Stats, Us

Eva Maria TG 477 Dec 31, 2022
Telegram Remote Administration Tool

Telegram Remote Administration Tool DISCLAIMER | Telegram Remote Administration Tool can only be used at your PC. Do not be evil! Читайте на Русском |

13 Nov 12, 2022
Telegram bot for logistic - Telegram bot for logistic

Демонстрационный телеграм-бот для нужд транспортной компании Цель проекта Реализ

M1chigun 1 Feb 05, 2022
❄️ Don't waste your money paying for new tokens, once you have used your tokens, clean them up and resell them!

TokenCleaner Don't waste your money paying for new tokens, once you have used your tokens, clean them up and resell them! If you have a very large qua

0xVichy 59 Nov 14, 2022
ML-Test-Client

ML-Test-Client Introduction What is this? This Test Client App is to be used to crowd-test machine learning models with the goal of finding the best c

11 Jul 15, 2022
A bot to get Statistics like the Playercount from your Minecraft-Server on your Discord-Server

Hey Thanks for reading me. Warning: My English is not the best I have programmed this bot to show me statistics about the player numbers and ping of m

spaffel 12 Sep 24, 2022
Api REST para gerenciamento de cashback.

Documentação API para gerenciamento de cashback - MaisTODOS Features Em construção... Tecnologias utilizadas Back end Python 3.8.10 Django REST Framew

Alinne Grazielle 2 Jan 22, 2022
Melissa Songs is a telegram bot to easily find songs sending music snippets and search tracks 💃🏽🎵

Find songs on Telegram, like on Shazam... 😎 Open on telegram · Report Bug · Request Feature ⬇️ Installation To get a local copy installed and working

Joaquim Roque 21 Nov 10, 2022
SpamSMS - SPAM SMS menggunakan api web INDIHOME

SPAM SMS Unlimited SPAM SMS menggunakan api web INDIHOME Cara Install Di Termux

Zuck-Ker 1 Jan 08, 2022
PepeSniper is an open-source Discord Nitro auto claimer/redeemer made in python.

PepeSniper is an open-source Discord Nitro auto claimer made in python. It sure as hell is not the fastest sniper out there but it gets the job done in a timely and stable manner. It also supports ho

Unknown User 1 Dec 22, 2021
For Help/Questions Join in discord

Simple-Nitro-Generator-Source Must have installed python! Discord: $MartoBossX#7777 Server: https://discord.gg/ErynDxTV5Y DONATE: (Crypto) BTC: bc1qg8

1 Jan 08, 2022
Track player's stats, find out when they're online and grinding!

Hypixel Stats Tracker Track player's stats, find out when they're online and playing games! INFO Showcase Server: https://discord.gg/yY5qQHPar6 Suppor

4 Dec 18, 2022
💻 Discord-Auto-Translate-Bot - If you type in the chat room, it automatically translates.

💻 Discord-Auto-Translate-Bot - If you type in the chat room, it automatically translates.

LeeSooHyung 2 Jan 20, 2022