How To Integrate With The Slack Api Using Web Hooks

1 minute read

Slack has made integration extremely easy! This tutorial will show you how to create a Slack app that will send messages to a specific Slack channel.


  1. This tutorial assumes you have already setup your Slack workstations and that you have admin privileges.


  1. Navigate to and click on the “Create new App” button.

  2. Choose a name for your new app. and the workstation that you want to associate it with.

  1. Once created click on the “Incoming Webhooks” link under the “Add features and functionality” section of the “Basic Information” page for the newly created app.

  2. Activate the “Incoming Webhooks” functionality, select the channel you wish messages from this app. to be posted to, and then click “Authorize” button.

That’s it!

Now all you need to do is post data to the Webhook URI that was created. Here are a couple of different methods for doing this:

  1. Using Curl:
curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}'
  1. Using JAVA:
package com.crm.api.slack;

import com.crm.utils.HttpUtils;
import junit.framework.TestCase;

import java.util.HashMap;
import java.util.Map;

public class SlackApiManualTest extends TestCase {

  private static final String CHANNEL_URL_MONITOR = "";

  public void testSendMessage() {
    Map<String, String> headers = new HashMap<String, String>();
    headers.put("Content-Type", "application/json");
    try {, "{\"text\":\"A message\"}", headers, HttpUtils.METHOD_POST);
    } catch (IOException e) {