curl --request POST \
--url https://api.example.com/slack/events \
--header 'X-Slack-Request-Timestamp: <x-slack-request-timestamp>' \
--header 'X-Slack-Signature: <x-slack-signature>'import requests
url = "https://api.example.com/slack/events"
headers = {
"X-Slack-Request-Timestamp": "<x-slack-request-timestamp>",
"X-Slack-Signature": "<x-slack-signature>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Slack-Request-Timestamp': '<x-slack-request-timestamp>',
'X-Slack-Signature': '<x-slack-signature>'
}
};
fetch('https://api.example.com/slack/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/slack/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-Slack-Request-Timestamp: <x-slack-request-timestamp>",
"X-Slack-Signature: <x-slack-signature>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/slack/events"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-Slack-Request-Timestamp", "<x-slack-request-timestamp>")
req.Header.Add("X-Slack-Signature", "<x-slack-signature>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/slack/events")
.header("X-Slack-Request-Timestamp", "<x-slack-request-timestamp>")
.header("X-Slack-Signature", "<x-slack-signature>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/slack/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Slack-Request-Timestamp"] = '<x-slack-request-timestamp>'
request["X-Slack-Signature"] = '<x-slack-signature>'
response = http.request(request)
puts response.read_body{
"challenge": "<string>"
}Slack Events
Receives incoming Slack events (messages, mentions, thread starts).
URL Verification: On first setup, Slack sends a url_verification challenge. The endpoint echoes back the challenge string.
Event Processing: Normal events are acknowledged immediately with {"status": "ok"} and processed in the background. This prevents Slack’s 3-second retry timeout.
Retry Handling: Events with X-Slack-Retry-Num header are duplicates and return 200 without reprocessing.
Setup: Configure this URL in your Slack App under Event Subscriptions > Request URL.
See the setup guide for creating a Slack App or use the manifest for quick setup.
curl --request POST \
--url https://api.example.com/slack/events \
--header 'X-Slack-Request-Timestamp: <x-slack-request-timestamp>' \
--header 'X-Slack-Signature: <x-slack-signature>'import requests
url = "https://api.example.com/slack/events"
headers = {
"X-Slack-Request-Timestamp": "<x-slack-request-timestamp>",
"X-Slack-Signature": "<x-slack-signature>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Slack-Request-Timestamp': '<x-slack-request-timestamp>',
'X-Slack-Signature': '<x-slack-signature>'
}
};
fetch('https://api.example.com/slack/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/slack/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-Slack-Request-Timestamp: <x-slack-request-timestamp>",
"X-Slack-Signature: <x-slack-signature>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/slack/events"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-Slack-Request-Timestamp", "<x-slack-request-timestamp>")
req.Header.Add("X-Slack-Signature", "<x-slack-signature>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/slack/events")
.header("X-Slack-Request-Timestamp", "<x-slack-request-timestamp>")
.header("X-Slack-Signature", "<x-slack-signature>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/slack/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Slack-Request-Timestamp"] = '<x-slack-request-timestamp>'
request["X-Slack-Signature"] = '<x-slack-signature>'
response = http.request(request)
puts response.read_body{
"challenge": "<string>"
}Headers
Unix timestamp when Slack sent the request
HMAC signature for request verification (v0=hash)
Retry attempt number (present on retried events)
Response
Event processed successfully
- SlackChallengeResponse
- SlackEventResponse
Challenge string to echo back to Slack
Was this page helpful?