Python Slack SDK
Go to GitHub

Webhook Client

You can use slack_sdk.webhook.WebhookClient for Incoming Webhooks and message responses using response_url in payloads.

The Python document for this module is available at

Incoming Webhooks

To use Incoming Webhooks, just calling WebhookClient(url)#send(payload) method works for you. The call posts a message in a channel associated with the webhook URL.

from slack_sdk.webhook import WebhookClient
url = ""
webhook = WebhookClient(url)

response = webhook.send(text="Hello!")
assert response.status_code == 200
assert response.body == "ok"

It’s also possible to use blocks, richer message using Block Kit.

from slack_sdk.webhook import WebhookClient
url = ""
webhook = WebhookClient(url)
response = webhook.send(
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "You have a new request:\n*<|Fred Enriquez - New device request>*"


User actions in channels generates a response_url and includes the URL in its payload. You can use WebhookClient to send a message via the response_url.

import os
from slack_sdk.signature import SignatureVerifier
signature_verifier = SignatureVerifier(

from slack_sdk.webhook import WebhookClient

from flask import Flask, request, make_response
app = Flask(__name__)

@app.route("/slack/events", methods=["POST"])
def slack_app():
    # Verify incoming requests from Slack
    if not signature_verifier.is_valid(
        return make_response("invalid request", 403)

    # Handle a slash command invocation
    if "command" in request.form \
        and request.form["command"] == "/reply-this":
        response_url = request.form["response_url"]
        text = request.form["text"]
        webhook = WebhookClient(response_url)
        # Send a reply in the channel
        response = webhook.send(text=f"You said '{text}'")
        # Acknowledge this request
        return make_response("", 200)

    return make_response("", 404)


The webhook client is available in asynchronous programming using the standard asyncio library, too. You use AsyncWebhookClient instead for it.

AsyncWebhookClient internally relies on AIOHTTP library but it is an optional dependency. So, to use this class, run pip install aiohttp beforehand.

import asyncio
# requires: pip install aiohttp
from slack_sdk.webhook.async_client import AsyncWebhookClient
url = ""

async def send_message_via_webhook(url: str):
    webhook = AsyncWebhookClient(url)
    response = await webhook.send(text="Hello!")
    assert response.status_code == 200
    assert response.body == "ok"

# This is the simplest way to run the async method
# but you can go with any ways to run it