Skip to content

saezlab/F1000_Slack

Repository files navigation

F the Bot

A Slack app companion script connecting F1000/Sciwheel to Slack

Requirements

The bot requires a state.rdata object

This object should contain 3 variables:

  • bottoken - character, a varialb containing the Slack authetincation token for the bot.

  • f1000auth - character, a variable containing the F1000/Sciwheel external API access token.

  • webhooks - data.frame, a table with four columns - (character) channel, (numeric) projectId, (character) webhook and (numeric) lastDate. Each row contains information about the mapping between the name of the slack channel, the F1000/Sciwheel subproject id from where the papers will be queried and posted to that channel, the complete url of the Slack webhook that the app can use to post to that channel and the last time (in milliseconds since Jan 1, 1970 00:00:00 UTC) F1000/Sciwheel was queried for that channel/projectId.

Scheduling

The bot can be scheduled as a cron job to run once daily, for example, at 8 a.m.

Open the crontab crontab -e and add a job

0 8 * * * Rscript /path/to/bot.R

Plotting sciwheel stats

The generated data dump can can be found in the bq_shared folder on the BioQuant cluster. Use the sciwheel_stats_process.R script to filter the data for the year of interest and tidy the data to generate plots of the labs sciwheel usage.

Some notes:

As of 26/07/2023 the bot uses Github Actions. The above mentioned state.rdata file was split: the state data is stored on Saezlab_docs as a csv file, authentication tokens are stored as github action secrets. You need admin rights to this repo to change them.

Slack

  • webhooks: we need webhooks to identify channels. These were generated by Jovan per channel using slack API. Keep these urls confidential to avoid external people posting to channel
  • authentication: authentication token stored as secret

Sciwheel

Google drive

  • Authentication: first we needed a google drive API key. This can be obtain by registering a Google project on google cloud services. There are tutorials, e.g a short list of instructions are here: https://securitysenses.com/videos/obtaining-api-key-google-drive-api
  • GCP: Attila generated a f1000bot service with attila.gabor _ at _ uni-heidelberg.de google account. He can add people to the project if needed, but in theory you just need to invite the bot to access a file/folder.
  • The API key belongs to f1000bot-service-account at f1000bot.iam.gserviceaccount.com
  • Share with bot: If you want to access a file on google drive, make sure that this email is invited to view/edit

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages