Chat

Chat Post Message

POST
/chat.postMessage

Sends a message to a channel.

Authorization

slackAuth chat:write:user, chat:write:bot
AuthorizationBearer <token>

In: header

Scope: chat:write:user, chat:write:bot

Header Parameters

token*string

Authentication token. Requires scope: chat:write

Content-Type*"application/x-www-form-urlencoded"

Value in

  • "application/x-www-form-urlencoded"

Request Body

application/x-www-form-urlencoded

as_user?string

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

attachments?string

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

blocks?string

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

channel*string

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

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

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?boolean

Find and link channel names and usernames.

mrkdwn?boolean

Disable Slack markup parsing by setting to false. Enabled by default.

parse?string

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

reply_broadcast?boolean

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

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

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?boolean

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

unfurl_media?boolean

Pass false to disable unfurling of media content.

username?string

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

Response Body

application/json

application/json

curl -X POST "https://example.com/chat.postMessage" \  -H "token: string" \  -H "Content-Type: application/x-www-form-urlencoded" \  -H "Content-Type: application/x-www-form-urlencoded" \  -d 'channel=string'
{  "channel": "string",  "message": {    "attachments": [      {        "fallback": "string",        "id": 0,        "image_bytes": 0,        "image_height": 0,        "image_url": "string",        "image_width": 0      }    ],    "blocks": [      {        "type": "string"      }    ],    "bot_id": null,    "bot_profile": {      "app_id": "string",      "deleted": true,      "icons": {        "image_36": "http://example.com",        "image_48": "http://example.com",        "image_72": "http://example.com"      },      "id": "string",      "name": "string",      "team_id": "string",      "updated": 0    },    "client_msg_id": "string",    "comment": {      "comment": "string",      "created": 0,      "id": "string",      "is_intro": true,      "is_starred": true,      "num_stars": 0,      "pinned_info": {},      "pinned_to": [        "string"      ],      "reactions": [        {          "count": 0,          "name": "string",          "users": [            "string"          ]        }      ],      "timestamp": 0,      "user": "string"    },    "display_as_bot": true,    "file": {      "channels": [        "string"      ],      "comments_count": 0,      "created": 0,      "date_delete": 0,      "display_as_bot": true,      "editable": true,      "editor": "string",      "external_id": "string",      "external_type": "string",      "external_url": "http://example.com",      "filetype": "string",      "groups": [        "string"      ],      "has_rich_preview": true,      "id": "string",      "image_exif_rotation": 0,      "ims": [        "string"      ],      "is_external": true,      "is_public": true,      "is_starred": true,      "is_tombstoned": true,      "last_editor": "string",      "mimetype": "string",      "mode": "string",      "name": "string",      "non_owner_editable": true,      "num_stars": 0,      "original_h": 0,      "original_w": 0,      "permalink": "http://example.com",      "permalink_public": "http://example.com",      "pinned_info": {},      "pinned_to": [        "string"      ],      "pretty_type": "string",      "preview": "string",      "public_url_shared": true,      "reactions": [        {          "count": 0,          "name": "string",          "users": [            "string"          ]        }      ],      "shares": {        "private": null,        "public": null      },      "size": 0,      "source_team": "string",      "state": "string",      "thumb_1024": "http://example.com",      "thumb_1024_h": 0,      "thumb_1024_w": 0,      "thumb_160": "http://example.com",      "thumb_360": "http://example.com",      "thumb_360_h": 0,      "thumb_360_w": 0,      "thumb_480": "http://example.com",      "thumb_480_h": 0,      "thumb_480_w": 0,      "thumb_64": "http://example.com",      "thumb_720": "http://example.com",      "thumb_720_h": 0,      "thumb_720_w": 0,      "thumb_80": "http://example.com",      "thumb_800": "http://example.com",      "thumb_800_h": 0,      "thumb_800_w": 0,      "thumb_960": "http://example.com",      "thumb_960_h": 0,      "thumb_960_w": 0,      "thumb_tiny": "string",      "timestamp": 0,      "title": "string",      "updated": 0,      "url_private": "http://example.com",      "url_private_download": "http://example.com",      "user": "string",      "user_team": "string",      "username": "string"    },    "files": [      {        "channels": [          "string"        ],        "comments_count": 0,        "created": 0,        "date_delete": 0,        "display_as_bot": true,        "editable": true,        "editor": "string",        "external_id": "string",        "external_type": "string",        "external_url": "http://example.com",        "filetype": "string",        "groups": [          "string"        ],        "has_rich_preview": true,        "id": "string",        "image_exif_rotation": 0,        "ims": [          "string"        ],        "is_external": true,        "is_public": true,        "is_starred": true,        "is_tombstoned": true,        "last_editor": "string",        "mimetype": "string",        "mode": "string",        "name": "string",        "non_owner_editable": true,        "num_stars": 0,        "original_h": 0,        "original_w": 0,        "permalink": "http://example.com",        "permalink_public": "http://example.com",        "pinned_info": {},        "pinned_to": [          "string"        ],        "pretty_type": "string",        "preview": "string",        "public_url_shared": true,        "reactions": [          {            "count": 0,            "name": "string",            "users": [              "string"            ]          }        ],        "shares": {          "private": null,          "public": null        },        "size": 0,        "source_team": "string",        "state": "string",        "thumb_1024": "http://example.com",        "thumb_1024_h": 0,        "thumb_1024_w": 0,        "thumb_160": "http://example.com",        "thumb_360": "http://example.com",        "thumb_360_h": 0,        "thumb_360_w": 0,        "thumb_480": "http://example.com",        "thumb_480_h": 0,        "thumb_480_w": 0,        "thumb_64": "http://example.com",        "thumb_720": "http://example.com",        "thumb_720_h": 0,        "thumb_720_w": 0,        "thumb_80": "http://example.com",        "thumb_800": "http://example.com",        "thumb_800_h": 0,        "thumb_800_w": 0,        "thumb_960": "http://example.com",        "thumb_960_h": 0,        "thumb_960_w": 0,        "thumb_tiny": "string",        "timestamp": 0,        "title": "string",        "updated": 0,        "url_private": "http://example.com",        "url_private_download": "http://example.com",        "user": "string",        "user_team": "string",        "username": "string"      }    ],    "icons": {      "emoji": "string",      "image_64": "http://example.com"    },    "inviter": "string",    "is_delayed_message": true,    "is_intro": true,    "is_starred": true,    "last_read": "string",    "latest_reply": "string",    "name": "string",    "old_name": "string",    "parent_user_id": "string",    "permalink": "http://example.com",    "pinned_to": [      "string"    ],    "purpose": "string",    "reactions": [      {        "count": 0,        "name": "string",        "users": [          "string"        ]      }    ],    "reply_count": 0,    "reply_users": [      "string"    ],    "reply_users_count": 0,    "source_team": "string",    "subscribed": true,    "subtype": "string",    "team": "string",    "text": "string",    "thread_ts": "string",    "topic": "string",    "ts": "string",    "type": "string",    "unread_count": 0,    "upload": true,    "user": "string",    "user_profile": {      "avatar_hash": "string",      "display_name": "string",      "display_name_normalized": "string",      "first_name": "string",      "image_72": "http://example.com",      "is_restricted": true,      "is_ultra_restricted": true,      "name": "string",      "real_name": "string",      "real_name_normalized": "string",      "team": "string"    },    "user_team": "string",    "username": "string"  },  "ok": "True",  "ts": "string"}