[Slack][API] How to well done the URL verification of Event API

Message APP Integration

Before to listen Events from Slack, you have to complete Event URL verification. ( please see url_verification )

When you click Even Subscriptions link of your Slack APP, you would see the page as below diagram.


https://api.slack.com/apps/{Your APP ID}/event-subscriptions .

As the diagram, it said they will send HTTP POST request to your Event Listener URL and then need your Event Listener to respond the challenge that it gave to you.

But actually, it send raw data to you. that means if you are using PHP, you CANNOT use $_POST to receive that. you have to use php://input .

( An interested question – PHP “php://input” vs $_POST  )

Here is a sample PHP code for reference.

$rawdata = file_get_contents('php://input');
$auth_event = json_decode($rawdata, true);
error_log('event: ' . print_r($auth_event, true));

$ tail -f /var/log/httpd/access - - [20/Aug/2017:13:32:32 +0000] "POST /v1/slack/slashcode/listener HTTP/1.1" 200 1 "-" "Slackbot 1.0 (+https://api.slack.com/robots)"

$ tail -f /var/log/httpd/error

[Sun Aug 20 13:32:32.874573 2017] [:error] [pid 26406] [client] event: Array\n(\n [token] => sQcqV3yOTBd4N3iF7ulcUCf7\n [challenge] => fzxFv3KmdVuhUMcaqp4aeAxIw4bAKKWDkaGpIUqhJXt6t1q7ybQb\n [type] => url_verification\n)\n

Once you passed verification, it will immediately show you verified message as bellow:


Message APP Integration
[Slack][App] Building a Slash Command Slack App

Here, I’d like to record how to build a Slash Command Slack App – slashcode. App – https://slack.com/apps/A6SMGELHL  GitHub – https://github.com/dozstyle/slack_slashcommand This App provides three commands as below: /code: /code command will auto detect the language of your code snippet /codetype: you can specify the language of your code snippet via …

Message APP Integration
[Slack][API Server] How to well configure SSL Certificate on your API Server

Slack will validate SSL Certificate of your API Server. ( you can use SSL Lab to get your SSL report ) If you didn’t configure it well (ex: forgot to configure CA file in your SSL settings), you will get below error message. Darn – that slash command didn’t work …

[WordPress][Plugin] Integrated with Slack Notification

Plugin – https://wordpress.org/plugins/slack/ This plugin is using Slack Incoming WebHooks to send data to Slack in real time. Here is the link to do Incoming WebHooks integration. you may get your team’s Webhook URL there. You could use curl command to send message to your slack team’s channel via Webhook URL. Example: …