slack.message() function

slack.message() sends a single message to a Slack channel and returns the HTTP response code of the request.

The function works with either with the chat.postMessage API or with a Slack webhook.

Function type signature
    channel: A,
    color: string,
    text: B,
    ?token: string,
    ?url: string,
) => int
For more information, see Function type signatures.



Slack API URL. Default is

If using the Slack webhook API, this URL is provided in the Slack webhook setup process.


Slack API token. Default is "".

If using the Slack Webhook API, a token is not required.


(Required) Slack channel or user to send the message to.


(Required) Message text.


(Required) Slack message color.

Valid values:

  • good
  • warning
  • danger
  • Any hex RGB color code


Send a message to Slack using a Slack webhook

import "slack"

    url: "",
    channel: "#example-channel",
    text: "Example slack message",
    color: "warning",

Send a message to Slack using chat.postMessage API

import "slack"

    url: "",
    token: "mySuPerSecRetTokEn",
    channel: "#example-channel",
    text: "Example slack message",
    color: "warning",

Was this page helpful?

Thank you for your feedback!

Introducing InfluxDB 3.0

The new core of InfluxDB built with Rust and Apache Arrow. Available today in InfluxDB Cloud Dedicated.

Learn more

State of the InfluxDB Cloud Serverless documentation

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.