Slack Web API
  1. chat
Slack Web API
  • admin.apps
    • /admin.apps.approve
      POST
    • /admin.apps.restrict
      POST
  • admin.apps.approved
    • /admin.apps.approved.list
      GET
  • admin.apps.requests
    • /admin.apps.requests.list
      GET
  • admin.apps.restricted
    • /admin.apps.restricted.list
      GET
  • admin.conversations
    • /admin.conversations.archive
      POST
    • /admin.conversations.convertToPrivate
      POST
    • /admin.conversations.create
      POST
    • /admin.conversations.delete
      POST
    • /admin.conversations.disconnectShared
      POST
    • /admin.conversations.getConversationPrefs
      GET
    • /admin.conversations.getTeams
      GET
    • /admin.conversations.invite
      POST
    • /admin.conversations.rename
      POST
    • /admin.conversations.search
      GET
    • /admin.conversations.setConversationPrefs
      POST
    • /admin.conversations.setTeams
      POST
    • /admin.conversations.unarchive
      POST
  • admin.conversations.ekm
    • /admin.conversations.ekm.listOriginalConnectedChannelInfo
  • admin.conversations.restrictAccess
    • /admin.conversations.restrictAccess.addGroup
    • /admin.conversations.restrictAccess.listGroups
    • /admin.conversations.restrictAccess.removeGroup
  • admin.emoji
    • /admin.emoji.add
    • /admin.emoji.addAlias
    • /admin.emoji.list
    • /admin.emoji.remove
    • /admin.emoji.rename
  • admin.inviteRequests
    • /admin.inviteRequests.approve
    • /admin.inviteRequests.deny
    • /admin.inviteRequests.list
  • admin.inviteRequests.approved
    • /admin.inviteRequests.approved.list
  • admin.inviteRequests.denied
    • /admin.inviteRequests.denied.list
  • admin.teams.admins
    • /admin.teams.admins.list
  • admin.teams
    • /admin.teams.create
    • /admin.teams.list
  • admin.teams.owners
    • /admin.teams.owners.list
  • admin.teams.settings
    • /admin.teams.settings.info
    • /admin.teams.settings.setDefaultChannels
    • /admin.teams.settings.setDescription
    • /admin.teams.settings.setDiscoverability
    • /admin.teams.settings.setIcon
    • /admin.teams.settings.setName
  • admin.usergroups
    • /admin.usergroups.addChannels
    • /admin.usergroups.addTeams
    • /admin.usergroups.listChannels
    • /admin.usergroups.removeChannels
  • admin.users
    • /admin.users.assign
    • /admin.users.invite
    • /admin.users.list
    • /admin.users.remove
    • /admin.users.setAdmin
    • /admin.users.setExpiration
    • /admin.users.setOwner
    • /admin.users.setRegular
  • admin.users.session
    • /admin.users.session.invalidate
    • /admin.users.session.reset
  • api
    • /api.test
  • apps.event.authorizations
    • /apps.event.authorizations.list
  • apps.permissions
    • /apps.permissions.info
    • /apps.permissions.request
  • apps.permissions.resources
    • /apps.permissions.resources.list
  • apps.permissions.scopes
    • /apps.permissions.scopes.list
  • apps.permissions.users
    • /apps.permissions.users.list
    • /apps.permissions.users.request
  • apps
    • /apps.uninstall
  • auth
    • /auth.revoke
    • /auth.test
  • bots
    • /bots.info
  • calls
    • /calls.add
    • /calls.end
    • /calls.info
    • /calls.update
  • calls.participants
    • /calls.participants.add
    • /calls.participants.remove
  • chat
    • /chat.delete
      POST
    • /chat.deleteScheduledMessage
      POST
    • /chat.getPermalink
      GET
    • /chat.meMessage
      POST
    • /chat.postEphemeral
      POST
    • /chat.postMessage
      POST
    • /chat.scheduleMessage
      POST
    • /chat.unfurl
      POST
    • /chat.update
      POST
  • chat.scheduledMessages
    • /chat.scheduledMessages.list
  • conversations
    • /conversations.archive
    • /conversations.close
    • /conversations.create
    • /conversations.history
    • /conversations.info
    • /conversations.invite
    • /conversations.join
    • /conversations.kick
    • /conversations.leave
    • /conversations.list
    • /conversations.mark
    • /conversations.members
    • /conversations.open
    • /conversations.rename
    • /conversations.replies
    • /conversations.setPurpose
    • /conversations.setTopic
    • /conversations.unarchive
  • dialog
    • /dialog.open
  • dnd
    • /dnd.endDnd
    • /dnd.endSnooze
    • /dnd.info
    • /dnd.setSnooze
    • /dnd.teamInfo
  • emoji
    • /emoji.list
  • files.comments
    • /files.comments.delete
  • files
    • /files.delete
    • /files.info
    • /files.list
    • /files.revokePublicURL
    • /files.sharedPublicURL
    • /files.upload
  • files.remote
    • /files.remote.add
    • /files.remote.info
    • /files.remote.list
    • /files.remote.remove
    • /files.remote.share
    • /files.remote.update
  • migration
    • /migration.exchange
  • oauth
    • /oauth.access
    • /oauth.token
  • oauth.v2
    • /oauth.v2.access
  • pins
    • /pins.add
    • /pins.list
    • /pins.remove
  • reactions
    • /reactions.add
    • /reactions.get
    • /reactions.list
    • /reactions.remove
  • reminders
    • /reminders.add
    • /reminders.complete
    • /reminders.delete
    • /reminders.info
    • /reminders.list
  • rtm
    • /rtm.connect
  • search
    • /search.messages
  • stars
    • /stars.add
    • /stars.list
    • /stars.remove
  • team
    • /team.accessLogs
    • /team.billableInfo
    • /team.info
    • /team.integrationLogs
  • team.profile
    • /team.profile.get
  • usergroups
    • /usergroups.create
    • /usergroups.disable
    • /usergroups.enable
    • /usergroups.list
    • /usergroups.update
  • usergroups.users
    • /usergroups.users.list
    • /usergroups.users.update
  • users
    • /users.conversations
    • /users.deletePhoto
    • /users.getPresence
    • /users.identity
    • /users.info
    • /users.list
    • /users.lookupByEmail
    • /users.setActive
    • /users.setPhoto
    • /users.setPresence
  • users.profile
    • /users.profile.get
    • /users.profile.set
  • views
    • /views.open
    • /views.publish
    • /views.push
    • /views.update
  • workflows
    • /workflows.stepCompleted
    • /workflows.stepFailed
    • /workflows.updateStep
  1. chat

/chat.postMessage

POST
/chat.postMessage
chat
Sends a message to a channel.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://slack.com/api/chat.postMessage' \
--header 'token;' \
--data-urlencode 'channel='
Response Response Example
200 - response
{
    "channel": "C1H9RESGL",
    "message": {
        "attachments": [
            {
                "fallback": "This is an attachment's fallback",
                "id": 1,
                "text": "This is an attachment"
            }
        ],
        "bot_id": "B19LU7CSY",
        "subtype": "bot_message",
        "text": "Here's a message for you",
        "ts": "1503435956.000247",
        "type": "message",
        "username": "ecto1"
    },
    "ok": true,
    "ts": "1503435956.000247"
}

Request

Header Params
token
string 
required
Authentication token. Requires scope: chat:write
Body Params application/x-www-form-urlencoded
as_user
string 
optional
Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
attachments
string 
optional
A JSON-based array of structured attachments, presented as a URL-encoded string.
blocks
string 
optional
A JSON-based array of structured blocks, presented as a URL-encoded string.
channel
string 
required
Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
icon_emoji
string 
optional
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
string 
optional
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
string 
optional
Find and link channel names and usernames.
mrkdwn
string 
optional
Disable Slack markup parsing by setting to false. Enabled by default.
parse
string 
optional
Change how messages are treated. Defaults to none. See below.
reply_broadcast
string 
optional
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
string 
optional
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
string 
optional
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
string 
optional
Pass true to enable unfurling of primarily text-based content.
unfurl_media
string 
optional
Pass false to disable unfurling of media content.
username
string 
optional
Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.

Responses

🟢200Typical success response
application/json
Body
Schema for successful response of chat.postMessage method
channel
string 
required
Match pattern:
^[CGD][A-Z0-9]{8,}$
message
object (Message object) 
required
attachments
array [object {6}] 
optional
>= 1 items
blocks
array [object {2}] 
optional
This is a very loose definition, in the future, we'll populate this with deeper schema in this definition namespace.
bot_id
array [anyOf] 
optional
bot_profile
object (Bot Profile Object) 
optional
client_msg_id
string 
optional
comment
object (File Comment Object) 
optional
display_as_bot
boolean 
optional
file
object (file object) 
optional
files
array[object (file object) {70}] 
optional
>= 1 items
icons
object 
optional
inviter
string 
optional
Match pattern:
^[UW][A-Z0-9]{2,}$
is_delayed_message
boolean 
optional
is_intro
boolean 
optional
is_starred
boolean 
optional
last_read
string 
optional
Match pattern:
^\d{10}\.\d{6}$
latest_reply
string 
optional
Match pattern:
^\d{10}\.\d{6}$
name
string 
optional
old_name
string 
optional
parent_user_id
string 
optional
Match pattern:
^[UW][A-Z0-9]{2,}$
permalink
string <uri>
optional
pinned_to
array[string]
optional
purpose
string 
optional
reactions
array[object (Reaction object) {4}] 
optional
reply_count
integer 
optional
reply_users
array[string]
optional
>= 1 items
reply_users_count
integer 
optional
source_team
string 
optional
Match pattern:
^[TE][A-Z0-9]{8,}$
subscribed
boolean 
optional
subtype
string 
optional
team
string 
optional
Match pattern:
^[TE][A-Z0-9]{8,}$
text
string 
required
thread_ts
string 
optional
Match pattern:
^\d{10}\.\d{6}$
topic
string 
optional
ts
string 
required
Match pattern:
^\d{10}\.\d{6}$
type
string 
required
unread_count
integer 
optional
upload
boolean 
optional
user
string 
optional
Match pattern:
^[UW][A-Z0-9]{2,}$
user_profile
object (objs_user_profile_short) 
optional
user_team
string 
optional
Match pattern:
^[TE][A-Z0-9]{8,}$
username
string 
optional
ok
enum<boolean> 
required
Allowed value:
true
ts
string 
required
Match pattern:
^\d{10}\.\d{6}$
🔴500Typical error response if too many attachments are included
Previous
/chat.postEphemeral
Next
/chat.scheduleMessage
Built with