| Title: | Integrate Slack and Shiny |
|---|---|
| Description: | Login to Shiny apps using Slack, and use Slack information in those apps. |
| Authors: | Jon Harmon [aut, cre] (ORCID: <https://orcid.org/0000-0003-4781-4346>) |
| Maintainer: | Jon Harmon <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.0.9010 |
| Built: | 2026-05-20 10:35:56 UTC |
| Source: | https://github.com/r4ds/shinyslack |
Confirm that a user is logged into Slack.
check_login( team_id, session = shiny::getDefaultReactiveDomain(), shinyslack_key = Sys.getenv("SHINYSLACK_KEY") )check_login( team_id, session = shiny::getDefaultReactiveDomain(), shinyslack_key = Sys.getenv("SHINYSLACK_KEY") )
team_id |
The Slack team ID through which the user is being authenticated. |
session |
The shiny session object. The default
|
shinyslack_key |
(optional) A key to use to encrypt the string. If not set, the string is returned unencrypted. |
A shiny::reactive() which returns a logical indicating whether the
user is logged in with proper API access.
The team_id is set when an app is launched. In almost all cases, that value
is the one you will want for any instances of team_id.
get_shinyslack_team_id() set_shinyslack_team_id(team_id)get_shinyslack_team_id() set_shinyslack_team_id(team_id)
team_id |
The Slack team ID through which the user is being authenticated. |
A string representing the team_id.
# If no app is active, the team_id will be a zero-length character vector. get_shinyslack_team_id() set_shinyslack_team_id("T123456") get_shinyslack_team_id()# If no app is active, the team_id will be a zero-length character vector. get_shinyslack_team_id() set_shinyslack_team_id("T123456") get_shinyslack_team_id()
Launch a shiny::shinyApp() with an integrated Slack login.
shinyslack_app( ui, server, team_id, ..., expiration = 90, shinyslack_key = Sys.getenv("SHINYSLACK_KEY") )shinyslack_app( ui, server, team_id, ..., expiration = 90, shinyslack_key = Sys.getenv("SHINYSLACK_KEY") )
ui |
A 0- or 1-argument function defining the UI of a Shiny app, or a
|
server |
A function with three parameters: |
team_id |
The Slack team ID through which the user is being authenticated. |
... |
Additional parameters passed on to |
expiration |
Days after which the cookie should expire. To remove an HttpOnly cookie, send a negative value for this attribute. |
shinyslack_key |
(optional) A key to use to encrypt the string. If not set, the string is returned unencrypted. |
An object that represents the app. See shiny::shinyApp() for
details.
Get information about the logged-in user from the Slack API.
user_info( components = c("user_id", "real_name", "display_name", "pronouns", "user_name"), session = shiny::getDefaultReactiveDomain(), slack_api_key = session$userData$shinyslack_api_key, team_id = get_shinyslack_team_id(), shinyslack_key = Sys.getenv("SHINYSLACK_KEY") )user_info( components = c("user_id", "real_name", "display_name", "pronouns", "user_name"), session = shiny::getDefaultReactiveDomain(), slack_api_key = session$userData$shinyslack_api_key, team_id = get_shinyslack_team_id(), shinyslack_key = Sys.getenv("SHINYSLACK_KEY") )
components |
A character vector of user components to include. Current options are:
|
session |
The shiny session object. The default
|
slack_api_key |
The Slack API key to use. The default value should likely always be used outside of tests. |
team_id |
The Slack team ID through which the user is being authenticated. |
shinyslack_key |
(optional) A key to use to encrypt the string. If not set, the string is returned unencrypted. |
A shiny::reactive() with a named character vector.