Send a message tagging yourself programmatically in a Slack channel
The shortest tutorial to start your Slack integration

Introduction
This is a quick guide to show how to send a message to yourself programmatically using cURL in Slack using the Slack API.
1. Create a Slack app
- Go here: https://api.slack.com/apps
- Click on “Create New App”
- Give it a name
- Select “From Scratch”
- Enter a name and select the slack workspace you want to test the app:
2. Give permission to write messages:
Once created, you need to go to the “OAuth & Permissions” section and give the bot permission to write messages:
3. Install the app in your slack workspace
Scroll up and click on “Install to {your workspace}” button to enable the bot in your slack workspace:
(You need to reinstall the app everytime you change permissions)
4. Create a channel where the bot will send messages:
Go to the “Channels” section in Slack:
5. Get the channel id:
Once channel created, go to the channel details:
Scroll down and copy the channel id:
We will use the bot token to send a message to yourself:
6. Test the integration by sending a message tagging yourself.
Go find your user id, by click on your profile in Slack:
Copy the user id:
Open your terminal and replace the $BOT_TOKEN with the bot token, the channel id “C09XXXXXX” and the user id “U09XXXXXX” with the ones you copied in the previous steps:
curl -X POST \
-H "Authorization: Bearer $BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"channel": "C09XXXXXX", "text": "Hello, world! <@U09XXXXXX>"}' \
https://slack.com/api/chat.postMessage
You should see the message in the channel: