# Workflow Application: Using SENDHTTPPOST to send messages to Slack

**URL:** <https://discuss.workflowgen.com/t/workflow-application-using-sendhttppost-to-send-messages-to-slack/673>\
**Category:** Workflow Applications\
**Created:** [January 11, 2017, 8:15pm UTC](https://discuss.workflowgen.com/t/workflow-application-using-sendhttppost-to-send-messages-to-slack/673 "2017-01-11T20:15:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [January 11, 2017, 8:15pm UTC](https://discuss.workflowgen.com/t/workflow-application-using-sendhttppost-to-send-messages-to-slack/673/1 "2017-01-11T20:15:31Z")

</div>

### About SENDHTTPPOST

The SENDHTTPPOST workflow application (available as of WorkflowGen version 6.6.0) lets you create webhook HTTP requests to external systems. For example, this is an easy way to send messages to Slack channels. The JSON and URLENCODED request exhange formats are supported, and you can create more action parameters to send additional data.

> **Note:** It’s recommended to use the [RESTAPICLIENT workflow application](https://docs.workflowgen.com/admin/workflow-applications/restapiclient-workflow-application) instead of SENDHTTPPOST, since RESTAPICLIENT provides more extensive features.

For general information on integrating webhooks with WorkflowGen, see the [Using webhooks with WorkflowGen](https://discuss.workflowgen.com/t/using-webhooks-with-workflowgen/675) topic and the [SENDHTTPPOST workflow application](https://docs.workflowgen.com/admin/workflow-applications/sendhttppost-workflow-application) section in the [WorkflowGen Administration Guide](https://docs.workflowgen.com/admin/).

For samples of APIs that use SENDHTTPPOST, see the [SENDHTTPPOST Workflow Application](https://github.com/advantys/workflowgen-templates/tree/master/integration/webhooks/sendhttppost) repository on GitHub.

### Configuring SENDHTTPPOST to send webhooks to Slack

In this article, we’ll set up SENDHTTPPOST to send webhooks to Slack channels, and create a form that will let users enter messages in a text box to send to a channel selected from a drop-down list.

First, you’ll need to get an incoming webhook URL with your Slack token; see [Sending messages using incoming webhooks | Slack Developer Docs](https://api.slack.com/incoming-webhooks) for information on how to do this.

**Note:** A Slack incoming webhook URL will contain your Slack token. If you’re configuring SENDHTTPPOST for an external API that doesn’t support tokens concatenated in the URL, you can include the optional TOKEN parameter (see the **Optional parameters** table below), which SENDHTTPPOST will then include in the JSON payload.

1. Create a new process or open an existing process.

2. On the **Data** tab, create a text type data called `URL` with the Slack webhook URL set as its default value.

3. Create a text type data called `RESPONSE_STATUS` and another called `RESPONSE_MESSAGE`, and leave them empty for HTTP request status codes and error messages from Slack.

4. In the Form Designer, add a text box labeled `Username` for the user’s Slack username, a text area labeled `Message` for the contents of the message, and a drop-down list labeled `Slack channel` to let the user choose from a set of Slack channels.

5. Configure the drop-down list of Slack channels. To do this:

6. On the **Mapping** tab, create the OUT values for the username and message text boxes and the channel drop-down list, which we’ll call `USERNAME`, `TEXT`, and `CHANNEL`.

7. In the Workflow Designer, add a SENDHTTPPOST action to your process and link it to the other actions in the process design.

8. On the **Parameters** tab in the **Edit action** panel, set the `URL` data you configured in the first step as the value of the required `APP_URL` parameter.

9. Add IN parameters called `username`, `text`, and `channel` (these are the data that will received by Slack and must be in lowercase), and set their values as the corresponding `USERNAME`, `TEXT`, and `CHANNEL` data you mapped to the text boxes and drop-down list in the form.

10. Add the optional `APP_RESPONSE_STATUS` and `APP_RESPONSE_CONTENT` OUT parameters (available by clicking **Browse** in the **Add parameter** panel), and set them to retrieve their values into the `RESPONSE_STATUS` and `RESPONSE_MESSAGE` data you created.

### JSON payload

The payload created by SENDHTTPPOST for a message sent to Slack would look something like this:

```auto
{
  "channel": "#marketing-channel",
  "text": "This is a test",
  "username": "eric_knox"
}

```

### SENDHTTPPOST parameters

The following tables list the required and optional parameters that can be used in SENDHTTPPOST actions.

#### Required parameter

| Parameter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Direction | Description |
| --- | --- | --- | --- |
| APP\_URL | Text | IN | External API URL |

#### Optional parameters

| Parameter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Direction | Description |
| --- | --- | --- | --- |
| TOKEN | Text | IN | API authorization token (use this parameter to specify a token for external APIs that don't include the token in the URL) |
| APP\_TIMEOUT | Numeric | IN | Maximum time interval between the request sending and the response reception (default: 3000 milliseconds; maximum 60000 milliseconds) |
| APP\_CONTENT\_TYPE | Text | IN | Request content type supported by the external API (SENDHTTPPOST supports JSON and URLENCODED; the default is JSON) |
| APP\_RESPONSE\_CONTENT | Text | OUT | Returned optional payload or error message |
| APP\_RESPONSE\_STATUS | Text | OUT | Returned HTTP request status code |

  
You can also add additional custom parameters specific to the external API. For example, you can add a parameter to include an emoji in a Slack message, and map this to Slack's "icon\_emoji" parameter.  
  

| Parameter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Direction | Description |
| --- | --- | --- | --- |
| icon\_emoji | Text | IN | Slack emoji (e.g. the parameter value ":smile:" without quotation marks will include a smile emoji in the message) |
