Sending messages using Incoming Webhooks (2023)

Incoming Webhooks are a simple way to post messages from apps into Slack. Creating an Incoming Webhook gives you a unique URL to which you send a JSON payload with the message text and some options. You can use all the usual formatting and layout blocks with Incoming Webhooks to make the messages stand out.

If you're looking for the Help Center article on using webhooks with Workflow Builder, head over here. Otherwise, read on!

Getting started with Incoming Webhooks

We're going to walk through a really quick 4-step process (if you've already done some of these things it'll be even easier) that will have you posting messages using Incoming Webhooks in a few minutes:

1. Create a Slack app (if you don't have one already)

You won't get very far without doing this step, but luckily it's very simple, we even have a nice green button for you to click:

Create your Slack app

Pick a name, choose a workspace to associate your app with (bearing in mind that you'll probably be posting lots of test messages, so you might want to create a channel for sandbox use), and then click Create App. If you've already created one, you can use it too, also have a cookie 🍪.

2. Enable Incoming Webhooks

After creating, you'll be redirected to the settings page for your new app (if you are using an existing app, just load its settings via your app's management dashboard).

From here select the Incoming Webhooks feature, and click the Activate Incoming Webhooks toggle to switch it on. If you already have this activated, well you deserve another cookie 🍪.

3. Create an Incoming Webhook

Now that Incoming Webhooks are enabled, the settings page should refresh and some extra options will appear. One of those options will be a really helpful button marked Add New Webhook to Workspace, and you should click it.

What this button does is trigger a shortcut version of the installation flow for Slack apps, one that is completely self-contained so that you don't have to actually build any code to generate an Incoming Webhook URL. We'll show how you can generate webhooks programmatically later, but for now you'll see something like the following screen:

(Video) How to send message on slack using Slack incoming webhook URL

Sending messages using Incoming Webhooks (1)

Go ahead and pick a channel that the app will post to, and then click to Authorize your app. If you need to add the Incoming Webhook to a private channel you must first be in that channel.

You'll be sent back to your app settings, and you should now see a new entry under the Webhook URLs for Your Workspace section, with a Webhook URL that'll look something like this:

That URL is your shiny new Incoming Webhook, one that's specific to a single user, and a single channel. We've kind of run out of cookies, but nice work anyway!

Let's see how you can actually use that webhook to post a message.

Keep it secret, keep it safe. Your webhook URL contains a secret. Don't share it online, including via public version control repositories. Slack actively searches out and revokes leaked secrets.

4. Use your Incoming Webhook URL to post a message

Later in this doc we'll explain how to make your messages more expressive or interactive, but for right now something simple will do, so we're going to use that old standby - "Hello, world".

After all this build up, you might think posting a message will be really complicated, but it's very simple. Just make an HTTP POST request like this:

POST application/json{ "text": "Hello, world."}

The URL that you're making the POST request to should be the same URL you generated in the previous step.

That's it! Go and check the channel that your app was installed into, and you will see that the "Hello, World" message has been posted by your app.

(Video) How To Make An Incoming Webhook In Slack

You can use this in a real Slack app without much change, just substituting your favorite HTTP Request library for cURL, but structuring all the requests in the exact same way. You will also need to pay attention to some details we've outlined below when you're distributing your app.

Incoming Webhooks do not allow you to delete a message after it's posted. If you need a more complex chat flow, including message deletion, call chat.postMessage.

Great work, you've set up Incoming Webhooks for your Slack app and made a successful test call, and you're ready to start making those messages more interesting and useful. Also, we baked some extra cookies to celebrate 🍪🍪🍪🍪.

Making it fancy with advanced formatting

Incoming Webhooks conform to the same rules and functionality as any of our other messaging APIs. You can make your posted messages as simple as a single line of text, or make them really useful with interactive components.

Sending messages using Incoming Webhooks (2)

The process of using all these extras and features is basically the same as the one explained above. The only difference is the JSON payload that you send to your webhook URL will contain other fields in addition to text. Here's a more advanced HTTP request example that you can use with the same webhook url that you used above:

POST application/json{ "text": "Danny Torrence left a 1 star review for your property.", "blocks": [ { "type": "section", "text": { "type": "mrkdwn", "text": "Danny Torrence left the following review for your property:" } }, { "type": "section", "block_id": "section567", "text": { "type": "mrkdwn", "text": "<|Overlook Hotel> \n :star: \n Doors had too many axe holes, guest in room 237 was far too rowdy, whole place felt stuck in the 1920s." }, "accessory": { "type": "image", "image_url": "", "alt_text": "Haunted hotel image" } }, { "type": "section", "block_id": "section789", "fields": [ { "type": "mrkdwn", "text": "*Average Rating*\n1.0" } ] } ]}

This example uses Block Kit visual components to make the message more expressive and useful.

We have some fantastic docs that explain how to use text formatting and Block Kit to make your messages more interesting and interactive, so please dive into our overview of message composition.

You cannot override the default channel (chosen by the user who installed your app), username, or icon when you're using Incoming Webhooks to post messages. Instead, these values will always inherit from the associated Slack app configuration.

Post your message as a reply in a thread

You can use Incoming Webhooks to make your message appear as a reply in a thread. Read our guide to threading messages to see the process.

(Video) How to send Slack Messages from Node.js? Slack Webhooks tutorial for beginners | heymesh

Generating Incoming Webhook URLs programmatically

In the guide above we showed you how to quickly generate a webhook URL through your app settings UI, but when you're distributing your app (for use by non-collaborators), you'll need a way for it to generate those URLs on the fly.

Fortunately, Incoming Webhooks can be easily generated during the standard OAuth install flow.

If you are going to distribute your app, it's likely you're already planning to use the OAuth process anyway. Below we'll cover the adjustments you'll need to make to that process to enable Incoming Webhooks.

1. Change your scopes

As part of the install process, your app defines a set of initial permission scopes to request from a user. Whether you're using the Slack button to provide a link for users to install your app or your own custom OAuth redirect, there will be a scope parameter that sets this initial list of permissions.

To generate Incoming Webhook URLs, make sure you include the incoming-webhook permission in that scope list. When you do, users will see an additional permission on the Authorize screen that lets them pick the channel where Incoming Webhooks will post to, as shown above.

2. Grab Incoming Webhook URL from the OAuth Response

Once a user installs your app, and your app has completed the OAuth verification code exchange, you'll receive a JSON response like this:

{ "ok": true, "access_token": "xoxp-XXXXXXXX-XXXXXXXX-XXXXX", "scope": "identify,bot,commands,incoming-webhook,chat:write:bot", "user_id": "XXXXXXXX", "team_name": "Your Workspace Name", "team_id": "XXXXXXXX", "incoming_webhook": { "channel": "#channel-it-will-post-to", "channel_id": "C05002EAE", "configuration_url": "", "url": "" }}

You can see that this OAuth response contains an incoming_webhook object, and right there in the url field is your brand new Incoming Webhook URL. You can now go ahead and use this URL to post a message, as demonstrated above. Here's a full explanation of all the fields in this incoming_webhook object:

channelStringThe name of the channel that the user selected as a destination for webhook messages
channel_idStringThe ID of the same channel
configuration_urlStringA link to the page that configures your app within the workspace it was installed to
urlStringThe Incoming Webhook URL

Handling errors

Though in most cases you'll receive a "HTTP 200" response with a plain text ok indicating that your message posted successfully, it's best to prepare for scenarios where attempts to publish a message will fail.

Incoming webhooks may throw errors when receiving malformed requests, when utilized webhook URLs are no longer valid, or when something truly exceptional prevents your messages from making it through to channels and users.

Incoming webhooks return more expressive errors than our Web API, including more relevant HTTP status codes (like "HTTP 400 Bad Request" and "HTTP 404 Not Found"). These are described in our changelog: Changes to errors for incoming webhooks.

(Video) Use incoming webhooks as Connectors

Common errors you may encounter include:

  • invalid_payload typically indicates that received request is malformed — perhaps the JSON is structured incorrectly, or the message text is not properly escaped. The request should not be retried without correction.
  • user_not_found and channel_not_found indicate that the user or channel being addressed either do not exist or are invalid. The request should not be retried without modification or until the indicated user or channel is set up.
  • channel_is_archived indicates the specified channel has been archived and is no longer accepting new messages.
  • action_prohibited usually means that an admin has placed some kind of restriction on this avenue of posting messages and that, at least for now, the request should not be attempted again.
  • posting_to_general_channel_denied is thrown when an incoming webhook attempts to post to the "#general" channel for a workspace where posting to that channel is 1) restricted and 2) the creator of the same incoming webhook is not authorized to post there. You'll receive this error with a HTTP 403.
  • too_many_attachments is thrown when an incoming webhook attempts to post a message with greater than 100 attachments. A message can have a maximum of 100 attachments associated with it.
  • no_service means the webhook is either disabled, removed, or invalid.
  • no_service_id means the service_id (B00000000 in our examples above) was either invalid or missing.
  • no_team means the Slack workspace was either missing or invalid.
  • team_disabled means the Slack workspace is no longer active.
  • invalid_token means the token used was either invalid or missing.

Webhooks do not work with org-wide apps. Use our other messaging tools, including chat.postMessage, instead.

Triggering workflows with webhooks

Sending messages using Incoming Webhooks (3)

Create more advanced workflows using webhooks

Connect, simplify, and automate. Discover the power of apps and tools.

Workflows are automated multi-step tasks or processes that can run right in Slack, or connect with other tools and services. Workflows in Slack can be as simple or as complex as you’d like, and typically don’t require writing any code.


How do you send a message on webhook? ›

How do I add a webhook to Discord?
  1. Go to the Integrations page on your Discord server as described above and click Create Webhook.
  2. Give your webhook a descriptive name and select the channel you want your messages to be sent to.
  3. Remember to click Save Changes when you make any change to your webhook configuration.
Dec 16, 2021

How do I use incoming webhook? ›

Create Incoming Webhooks
  1. Open the channel in which you want to add the webhook and select ••• from the upper-right corner.
  2. Select Connectors from the dropdown menu.
  3. Search for Incoming Webhook and select Add.
  4. Select Configure, provide a name, and upload an image for your webhook if necessary.

How to send messages in Microsoft Teams using incoming webhook adaptive card? ›

ShowCard, and Action. ToggleVisibility.
  1. Set up a custom webhook in Teams.
  2. Test your Adaptive Card with Postman: Test the Adaptive Card using Postman to send a POST request to the URL, created to set up Incoming Webhook. Paste the JSON file in the body of the request and view the Adaptive Card message in Teams.
Jan 13, 2023

What is an incoming webhook? ›

Incoming Webhooks are a simple way to post messages from apps into Slack. Creating an Incoming Webhook gives you a unique URL to which you send a JSON payload with the message text and some options.

How do I automate sending messages? ›

How to Send Automatic Text Messages
  1. Sign Up For an Automated Texting Service. Don't be confused by the vast number of automated texting service companies out there. ...
  2. Upload Your Contacts. Upload your contacts. ...
  3. Create Segmented Groups. ...
  4. Set Up Keywords. ...
  5. Encourage New Users to Subscribe. ...
  6. Compose Text Templates. ...
  7. Schedule and Send.

Is webhook the sender or receiver? ›

A webhook URL is provided by the receiving application, and acts as a phone number that the other application can call when an event happens. Only it's more complicated than a phone number, because data about the event is sent to the webhook URL in either JSON or XML format.

How do you make a webhook chat? ›

Create a webhook
  1. In a web browser, open Google Chat.
  2. Go to the space to which you want to add a webhook.
  3. At the top, next to space title, click Down Arrow arrow_drop_down > Apps & integrations.
  4. Click Manage webhooks.
  5. If this space already has other webhooks, click Add another. ...
  6. For Name, enter "Quickstart Webhook".

Does a webhook send a response? ›

Webhooks automatically send data in response to a specific event, without any request from another software.

How do I test incoming webhook? ›

A simple way to test an incoming webhook and to make formatting messages easier is to use a simple command-line tool called cURL. Using this simple technique, you can place your message contents in a stand alone file, and then post that file to the URL of an incoming webhook.

How do you automate sending messages on a team? ›

Flow setup
  1. Sign in to Power Automate.
  2. Select My flows > New > Automated cloud flow.
  3. Enter a name for your flow.
  4. Select the When a file is created (properties only) trigger.
  5. Select Create.
  6. Set up your trigger by choosing a SharePoint site and Folder ID that you want to monitor.
4 days ago

How do I send a message in Microsoft Teams using API? ›

HTTP request
  1. Sending message in a channel. HTTP Copy. POST /teams/{team-id}/channels/{channel-id}/messages.
  2. Sending replies in a channel. HTTP Copy. POST /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies.
  3. Sending message in a chat. HTTP Copy. POST /chats/{chat-id}/messages.
Mar 1, 2023

What format are webhook messages in Teams? ›

The inbound webhook connector is one of the standard connectors supported by Office 365. In this context, you can think of the webhook as a URI that Office 365 can use to find a target destination into which it posts messages. The posted messages are in JSON format and are called cards.

Is webhook push or pull? ›

How webhooks differ from polling. Polling uses the pull model of communication where a system pulls information from another system, while webhooks use the push model by pushing information from a source application to a destination application.

How do I allow incoming webhook in Teams? ›

In Microsoft Teams, select a team and a channel for that team (the channel you want notifications sent to). Click the ellipsis icon on the right side of the highlighted channel name. From the More Options menu, click Connectors. Navigate to Incoming Webhook connector and click Configure.

What is a webhook message? ›

A webhook is a partner-created HTTPS callback that responds to events and messages from Business Messages. The webhook receives information about the conversation from Business Messages and decides how the agent should respond, by sending messages or events.

Can webhooks reply? ›

The Webhook Reply Node allows a workflow to send a reply back to a webhook trigger (as long as the webhook is configured to wait for a reply).

How do I send a message through a link? ›

To include a link in any text message, just type or paste the full URL into your text. Most messaging platforms will automatically turn the URL into a link that allows contacts to click and access the linked page.


1. Demo - Create incoming webhooks in a Microsoft Teams channel
(Microsoft 365 Developer)
2. How to set up Incoming Webhooks in Slack + MS Teams + Google Chat!
(Tomasz Mazur)
3. Send data into Slack using Javascript (Incoming Webhooks , Jquery)
(Coding Practice)
4. How to Send Teams Messages using a webhook in c#
(Coding Flamingo)
5. Creating Webhooks in Slack and sending messages from Powershell
6. Slack Create Incoming Webhook App
(Optimal Cloud Services)
Top Articles
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated: 23/09/2023

Views: 6525

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.