AUTH REQUIRED

You must connect to Slack on the Integrations page before using this integration.

After enabling the Slack integration, you’ll have access to Slack methods within your Task’s run context.

import { Task } from '@onuhq/node';
import { slack } from '@onuhq/integrations';

const task = new Task({
  name: "Demo Task",
  run: async (input, context) => {
    await slack.postMessage({
      message: 'This is my message!',
      channelName: '#general',
    })
  }
});

Post a message

slack.postMessage({message: string, channelName?: string, channelId?: string, botUsername?: string, botImageURL?: string})
messagerequired
string

The markdown formatted message to post to Slack

channelName
string

The name of the channel to post to.

channelName
string

The ID of the channel to post to. This can be provided instead of the channelName.

botUsername
string

The username of the bot that will post to the channel. Defaults to Onu Bot

botUsername
string

The image URL to use for the profile photo of the Slack bot. Defaults to Onu’s logo.