---
title: t Slack
description: Available triggers
documentId: ipaas-slack-trigger
locale: en-US
---

The [**Slack**](https://camel.apache.org/components/4.10.x/slack-component.html) component allows you to send messages, notifications, and alerts to Slack channels or users directly from your integration flows.

**URI Syntax**: `slack:channel`

## Main fields

*Path parameters*

| **Name** | **Description** | **Default** | **Type** |
|----------|---------------|------------|----------|
|`channel` (common)| (required) The channel name (syntax #name) or slack username (syntax userName) to send a message directly to a user.| — | String |

*Query parameters*

| **Name** | **Description** | **Default** | **Type** |
|----------|---------------|------------|----------|
| `token` (common) | The token to access Slack. This app needs to have permissions channels:history, groups:history, im:history, mpim:history, channels:read, groups:read, im:read and mpim:read. The type of token needed is User OAuth Token. | —  | String |
| `conversationType` (consumer) | Type of the conversation. Possible values: PUBLIC_CHANNEL, PRIVATE_CHANNEL, etc. | PUBLIC_CHANNEL | ConversationType |

## Example

The flow below receives messages sent in a public group and demonstrates two ways to access the message content: through Java methods and through conversion to Map via JSON.

<Steps>
  <Step>
    The flow starts when a message is sent in the `outros-assuntos` channel on Slack. The parameters indicate the conversation type (public channel) and the authentication token. 
  </Step>
  <Step>
    Then, the body of the received message is logged as `${body}`.
  </Step>
  <Step>
    The second log shows the class type of the received object with `${body.class}`, which will be `com.slack.api.model.Message`.
  </Step>
  <Step>
    Since the message is a Java object, the `getText()` method is used to get the text: `${body.getText()}`.
  </Step>
  <Step>
    Next, the message is converted to JSON with the `marshal` EIP.
  </Step>
  <Step>
    Then, the message is converted to Map with the `unmarshal` EIP, making it easier to access the data.
  </Step>
  <Step>
    Finally, after conversion to Map, the text field is accessed directly using index notation: `${body[text]}`.
  </Step>
</Steps>

```yaml
 - from:
          uri: "slack:outros-assuntos"
          parameters:
            conversationType: PUBLIC_CHANNEL
            token: xoxb-5478261862112-7840169246688-JdgvOzHhQvERqDPScj7geCWG
          steps:
          - log:
              message: "Received message: ${body}"
          - log:
              message: "Body type is: ${body.class}"
          # since the message is of type com.slack.api.model.Message, it's necessary to access the data as methods. 
          - log:
              message: "Received message text: ${body.getText()}"
           # or alternatively convert to json and then to Map.
          - marshal:
              json: {}
          - unmarshal:
              json: {}
          - log:
              message: "Message text: ${body[text]}"
```

![](https://creative-ball-51b3fc85c0.media.strapiapp.com/slack_trigger_1943804e52.png)
