Skip to content

A slack bot that automates show notes creation for Les Cast Codeurs podcast

License

Notifications You must be signed in to change notification settings

lescastcodeurs/lcc-slack-bot

Repository files navigation

Build CodeQL

lcc-slack-bot - Les Cast Codeurs podcast bot

A slack bot that automates show notes creation for Les Cast Codeurs podcast.

Use it !

This bot is using the Socket Mode and can be set up without much hassle.

Register the bot in your workspace

First you need to create a Slack app and install it in your workspace :

  1. go to https://api.slack.com/apps,
  2. create a new Slack app using this manifest.yml,
  3. optionally set an app icon in Settings > Basic Information,
  4. create an app-level token with the scope connections:write in Settings > Basic Information and save it for later (it will be referred as SLACK_APP_TOKEN),
  5. install the app using the Install to workspace button in Settings > Basic Information,
  6. save the Bot User OAuth Token for later in Features > OAuth & Permissions (it will be referred as SLACK_BOT_TOKEN).

Create customised emojis

Then you need to add customised emojis to your workspace. Those will allow you to categorize news using reactions.

The following emojis must be added (suggested emojis can also be found in this directory) :

Category Name Suggested image
Langages lcc_lang https://openmoji.org/library/emoji-E1C1/
Librairies lcc_lib https://openmoji.org/library/emoji-1F4DA/
Infrastructure lcc_infra https://openmoji.org/library/emoji-1F3E3/
Cloud lcc_cloud https://openmoji.org/library/emoji-1F32C/
Web lcc_web https://openmoji.org/library/emoji-1F310/
Data lcc_data https://openmoji.org/library/emoji-1F4BD/
Outillage lcc_outil https://openmoji.org/library/emoji-1F6E0/
Architecture lcc_archi https://openmoji.org/library/emoji-E04A/
Méthodologies lcc_methodo https://openmoji.org/library/emoji-1F9D1-200D-1F373/
Sécurité lcc_secu https://openmoji.org/library/emoji-1F510/
Loi, société et organisation lcc_loi https://openmoji.org/library/emoji-2696/
Outils de l’épisode lcc_outil_ep https://openmoji.org/library/emoji-1F984/
Rubrique débutant lcc_debutant https://openmoji.org/library/emoji-1F423/
Conférences lcc_conf https://openmoji.org/library/emoji-1F3A4/
Messages exclus lcc_exclude https://openmoji.org/library/emoji-274C/
Messages inclus lcc_include https://openmoji.org/library/emoji-2714/
Ordonner en 1 lcc_1 https://openmoji.org/library/emoji-0031-FE0F-20E3/
Ordonner en 2 lcc_2 https://openmoji.org/library/emoji-0032-FE0F-20E3/
Ordonner en 3 lcc_3 https://openmoji.org/library/emoji-0033-FE0F-20E3/
Ordonner en 4 lcc_4 https://openmoji.org/library/emoji-0034-FE0F-20E3/
Ordonner en 5 lcc_5 https://openmoji.org/library/emoji-0035-FE0F-20E3/
Ordonner en 6 lcc_6 https://openmoji.org/library/emoji-0036-FE0F-20E3/
Ordonner en 7 lcc_7 https://openmoji.org/library/emoji-0037-FE0F-20E3/
Ordonner en 8 lcc_8 https://openmoji.org/library/emoji-0038-FE0F-20E3/
Ordonner en 9 lcc_9 https://openmoji.org/library/emoji-0039-FE0F-20E3/

Note also that aliases does not work because the name returned by the Slack API is not the name of the alias (it is the name of the aliased emoji).

Create the GitHub token

Then you need to create a GitHub personal access token and a publication repository (a repository where the show notes will be published) :

  1. go to https://github.com/settings/tokens/new,
  2. create a new personal access token with the scope repo and save it for later (it will be referred as GITHUB_TOKEN),
  3. create, if needed, a new publication repository and keep its coordinates (it will be referred as GITHUB_REPOSITORY).

Deploy the lcc-slack-bot

Warning This way of deploying lcc-slack-bot is fragile and will soon be modified. The ultimate goal is to deploy the bot on Google Cloud.

First install Java 17 on the target server and create the dedicated user that will run the bot (every instruction below must be executed with this user from its home directory).

Then download the latest lcc-slack-bot jar from the com.lescastcodeurs.lcc-slack-bot Maven repository and copy it on your server.

You also need to create the launch script using the following template (do not forget to make the script executable) :

#!/usr/bin/env bash

# GitHub credentials and repository used for the publication of the show notes.
# See the "Create the GitHub token" section for an explanation of how to get this token.
export GITHUB_TOKEN='ghp_xxx'
export GITHUB_REPOSITORY='lescastcodeurs/staging.lescastcodeurs.com'

# Credentials used to retrieve the show notes in Slack. See the "Register the bot in your workspace" section for an
# explanation of how to get those tokens.
export SLACK_BOT_TOKEN='xoxb-xxx'
export SLACK_APP_TOKEN='xapp-xxx'

# Name of the GitHub repository used to retrieve the conferences list, and criteria used for filtering the list.
# Those properties are already set to those values by default.
#export CONFERENCES_JSON_URL='https://developers.events/all-events.json'
#export CONFERENCES_SELECTION_CRITERIA='(France),Devoxx'

# Criterion used to retrieve the record date. Any top-level message of a thread containing this criterion is a
# candidate for guessing the record date (the last one wins).
# This property is already set to this value by default.
#export LCC_RECORD_DATE_CRITERION='recording.zencastr.com'

export JAR=$(find . -name 'lcc-slack-bot-*-runner.jar' | sort | tail -n 1)

java -Xmx128m -jar "$JAR" | tee -a 'lcc-slack-bot.log'

Finally, you can start the bot in a screen using the following command :

screen -S lcc-slack-bot -d -RR ./lcc-slack-bot.sh

> __  ____  __  _____   ___  __ ____  ______
>  --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
>  -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
> --\___\_\____/_/ |_/_/|_/_/|_|\____/___/
> 2022-09-04 21:33:28,921 INFO  [io.quarkus] (main) lcc-slack-bot 1.4.0 on JVM (powered by Quarkus 2.12.0.Final) started in 4.069s.
> 2022-09-04 21:33:29,118 INFO  [io.quarkus] (main) Profile prod activated.
> 2022-09-04 21:33:29,119 INFO  [io.quarkus] (main) Installed features: [cdi, qute, smallrye-context-propagation, vertx]
> 2022-09-04 21:33:33,846 INFO  [com.sla.api.soc.SocketModeClient] (Grizzly(2)) New session is open (session id: 123e4567-e89b-12d3-a456-426614174000)

Once the bot is started, you can verify it is working using the following message : @lcc Are you there !?.

About

A slack bot that automates show notes creation for Les Cast Codeurs podcast

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages