Send a Message to a Slack Channel using cURL Request in PHP

Slack messaging using PHP

Iftikhar Ahmed
Feb 23, 2019 · 1 min read

Slack is an instant messaging and collaboration system. Slack allows you to send messages to channel from your application. This will help you to learn what’s happening within your application or when you want to monitor and get real-time notifications when some event occurs.


First, you need a Slack API Token.

Here you can get API Token https://api.slack.com/custom-integrations/legacy-tokens

Let’s write a cURL request function.

slack-message-function.php

Setup API Token, Channel name, and your desired Username in the above code.

Now, let’s send a message like the below code:

That’s all.

Thank you for reading the article.

If you want to read my other articles:

If you have any questions please feel free to contact me Twitter, GitHub or join me on Slack #powwow

Iftikhar Ahmed

Written by

My name is Iftikhar Ahmed and I am a Full-Stack Developer, currently living in Karachi, Pakistan.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade