Skip to contents

Returns a dataframe of post history in a channel.

Usage

slackr_history(
  message_count = 100,
  channel = Sys.getenv("SLACK_CHANNEL"),
  token = Sys.getenv("SLACK_TOKEN"),
  posted_to_time = as.numeric(Sys.time()),
  duration = NULL,
  posted_from_time = 0,
  paginate = FALSE,
  inclusive = TRUE
)

Arguments

message_count

The number of messages to retrieve (only when paginate = FALSE). Corresponds to limit in the conversations.history docs. Note: If using pagination, setting a value of (e.g.) 1 will result in paginating through the channel's history one message at a time. Slack recommends using a value of 200. (Default: 100)

channel

Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.

token

Authentication token bearing required scopes.

posted_to_time

Timestamp of the last post to consider. Corresponds to latest in the conversations.history docs. Default: current time.

duration

Number of hours of history to retrieve. If neither duration nor posted_from_time is specified, there is no time limit on the retrieved history. (default: NULL)

posted_from_time

Timestamp of the first post time to consider. If both posted_to_time and duration is specifed, they take precedence. Corresponds to oldest in the conversations.history docs. Default: 0

paginate

If TRUE, uses the Slack API pagination mechanism, and will retrieve all history inside the timeframe. Otherwise, makes a single call to the API and retrieves a maximum of message_count messages.

inclusive

Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified.

Value

A tibble with message metadata

Scopes

You need one or more of these scopes enabled in your slack app: * channels:history * groups:history * im:history * mpim:history