post_message: Sends a message to a channel.

View source: R/conversations.R

post_messageR Documentation

Sends a message to a channel.

Description

Sends a message to a channel.

Usage

post_message(
  token = Sys.getenv("SLACK_TOKEN"),
  channel,
  message = NULL,
  as_user = NULL,
  attachments = NULL,
  blocks = NULL,
  icon_emoji = NULL,
  icon_url = NULL,
  link_names = NULL,
  mrkdwn = NULL,
  parse = NULL,
  reply_broadcast = NULL,
  text = NULL,
  thread_ts = NULL,
  unfurl_links = NULL,
  unfurl_media = NULL,
  username = NULL,
  return_response = F
)

Arguments

token

Authentication token bearing required scopes. Tokens should be passed as an HTTP Authorization header or alternatively, as a POST parameter.

channel

Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.

message

A message object.

as_user

Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.

attachments

A JSON-based array of structured attachments, presented as a URL-encoded string.

blocks

A JSON-based array of structured blocks, presented as a URL-encoded string.

icon_emoji

Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.

icon_url

URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.

link_names

Find and link channel names and usernames.

mrkdwn

Disable Slack markup parsing by setting to false. Enabled by default. Default: true

parse

Change how messages are treated. Defaults to none. See below.

reply_broadcast

Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.

text

How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.

thread_ts

Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.

unfurl_links

Pass true to enable unfurling of primarily text-based content.

unfurl_media

Pass false to disable unfurling of media content.

username

Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.

return_response

Whether or not to return the API call response as opposed to the response body. Defaults to FALSE (return response body)

container_id
file_annotation

Details

This method supports application/json via HTTP POST. Present your token in your request's Authorization header. Learn more.


samterfa/slackme documentation built on April 11, 2022, 3:29 a.m.