Add a Slack Login to a shiny app

The shinyslack package makes it easy to add a Slack login to a shiny app.

Imagine you have a shiny app in an app.R file.

library(shiny)
ui <- fluidPage(
  "This is my super secret data."
)
server <- function(input, output, session) {
}
shinyApp(ui, server)

{shinyslack} makes it easy to require a Slack login before the user can view that app. Simply replace the call to shinyApp() with a call to shiny_slack_app().

library(shiny)
library(shinyslack)
ui <- fluidPage(
  "This is my super secret data."
)
server <- function(input, output, session) {
}
shiny_slack_app(
  ui, server, 
  team_id = "T6UC1DKJQ"
)

Finding your team_id

The team_id shown here is the ID for the R4DS Online Learning Community Slack. You can find your team_id in a few ways:

  • Open your Slack team in a web browser. The url will display as something like https://app.slack.com/client/T6UC1DKJQ/C8J63E0TA, where the string immediately after client/ is your team_id.
  • In the Slack desktop app, click the name of your team at the top-left corner of the app. Choose the first link below the team name, which will say something like “See plans”. The url will be something like https://app.slack.com/plans/T6UC1DKJQ, where the string after plans/ is your team_id.