Blog
TUTORIAL

Send and Automate Slack & Microsoft Teams Notifications with Node.js

Shreya Gupta

March 22, 2023

automate-slack-msteams-nodejs-header

Table of contents

Send and Automate Slack & Microsoft Teams Notifications with One API

Want to send notifications to Slack, Microsoft Teams, or both—without managing multiple APIs? This guide shows you how to send and automate messages across channels using a single Courier API call from your Node.js app.

You’ll learn how to:

  • Set up Slack and Teams integrations
  • Use Courier’s Node.js SDK to send messages
  • Route messages to one or multiple channels
  • Automate delivery using Courier’s visual workflow builder

If you're working in Python, check out our Slack and Teams automation guide for Python. Or jump straight to the working code.

Prerequisites: What You Need to Get Started

Before you send Slack or Microsoft Teams messages from Node.js, make sure you have the following in place:

  • ✅ A Courier account and access to your Courier API Key
  • ✅ Node.js installed on your machine
  • ✅ The Courier Node.js SDK installed:
    bash npm install @trycourier/courier ## How to Send Slack Notifications with Node.js and Courier

You can use Courier to send direct messages to Slack users from your Node.js app with just one API call. Here’s how to get your Slack integration set up and running.

Step 1: Add the Slack Integration in Courier

Go to Courier’s Slack channel configuration and click Install Provider.

🎯 If you're only using Microsoft Teams, skip ahead to the Teams integration setup.

Slack integration UI


Step 2: Create Your Slack App

Head over to Slack Apps and click Create an App. Choose an app name and workspace.

Slack app creation


Step 3: Set OAuth Scopes

Under OAuth & Permissions, add the following scopes:

  • chat:write
  • im:write
  • users:read
  • users:read.email

Then click Install App to Workspace. After installation, copy the Bot User OAuth Token—you’ll need it later.

Slack app scopes
Slack OAuth token


Step 4: Send a Slack Message with Node.js

Here’s a code example for sending a direct message using Courier:

Copied!

const { CourierClient } = require("@trycourier/courier");
const courier = CourierClient({ authorizationToken: "auth_token" });
async function send_message() {
const { requestId } = await courier.send({
message: {
to: {
slack: {
access_token: "slack_access_token",
email: "example@email.com"
}
},
content: {
title: "Important Survey Reminder",
body: "This is a reminder to fill out your survey by the end of this week.",
},
routing: {
method: "single",
channels: ["direct_message"]
}
},
});
console.log(requestId);
}
send_message();

Run the Node.js program to see your notification popup in the user's Slack direct message!

Slack message

Check your Courier logs for errors if your user did not receive the message.

Slack Resources

How to Send Microsoft Teams Notifications with Node.js and Courier

Courier makes it easy to send direct messages to Microsoft Teams users from your Node.js app. Here’s how to configure your Teams integration and send messages with a single API call.

Step 1: Set Up a Microsoft 365 Developer Account

If you don’t already have one, create a free Microsoft 365 developer account. You’ll use it to register and manage your Teams app.


Step 2: Create a Teams App

Install the Microsoft Teams Developer Portal and create a new app:

  1. Open the Developer Portal → Apps tab → click New App
  2. Enter your App Name
  3. Copy your App ID for later

MS Teams Add App
App ID


Step 3: Configure the Bot

Go to App features → Bot and either select an existing bot or create one. Save the password you generate.

Leave the Messaging endpoint blank for now.

Bot Setup


Step 4: Deploy the Bot

Deploy your bot using the Courier Microsoft Teams Netlify Starter:

Once deployed, copy the Netlify site URL—you’ll use it for the messaging endpoint.

Deploy App


Step 5: Finalize the Bot Setup

Back in the Developer Portal:

  • Go to Tools → Bot Management
  • Open your bot → click Configure
  • Paste your Netlify site URL as the Bot endpoint address
  • In the left menu, go to Channels → enable Microsoft Teams

Bot Endpoint
Teams Channel


Step 6: Connect Teams in Courier

In your Courier Channels settings, choose Microsoft Teams, then paste in your:

  • App ID
  • App Password

Click Install Provider.

Teams Provider


Step 7: Send a Teams Message with Node.js

Here’s a working code example:

Copied!

const { CourierClient } = require("@trycourier/courier");
const courier = CourierClient({ authorizationToken: "auth_token" });
async function send_message() {
const { requestId } = await courier.send({
message: {
to: {
ms_teams: {
conversation_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
tenant_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
service_url: "https://smba.trafficmanager.net/amer"
}
},
content: {
title: "Important Survey Reminder",
body: "This is a reminder to fill out your survey by the end of this week.",
},
routing: {
method: "single",
channels: ["direct_message"]
}
},
});
console.log(requestId);
}
send_message();

Finally, you can run the Node.js program, and you will see a notification in your Team channel.

Microsoft Teams Resources

How to Send Slack, Teams, and Email Notifications in One API Call

Courier’s multi-channel messaging makes it easy to send a single message to multiple platforms—like Slack, Microsoft Teams, and email—using one API call from your Node.js app.

Use this when:

  • You need to alert users across their preferred tools
  • You want a reliable fallback if one provider fails
  • You’re supporting multiple internal teams or workspaces

Example: Send to Slack, Teams, and Email from Node.js

Copied!

const { CourierClient } = require("@trycourier/courier");
const courier = CourierClient({ authorizationToken: "auth_token" });
async function send_message() {
const { requestId } = await courier.send({
message: {
to: {
slack: {
access_token: "access_token",
email: "example@email.com"
},
ms_teams: {
conversation_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
tenant_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
service_url: "https://smba.trafficmanager.net/amer"
},
email: "example@email.com"
},
content: {
title: "Important Survey Reminder",
body: "This is a reminder to fill out your survey by the end of this week.",
},
routing: {
method: "all",
channels: ["direct_message", "email"]
}
},
});
console.log(requestId);
}
send_message();

Add Email as a Channel (or Fallback)

Courier supports a wide range of multi-channel notification providers—including email, SMS, push, and chat tools like Slack and Microsoft Teams.

You can expand your message delivery by including email in the to object, and adding "email" to the channels array inside routing. This allows you to send the same notification across chat and email in a single API call.

Courier Channels

Copied!

const { CourierClient } = require("@trycourier/courier");
const courier = CourierClient({ authorizationToken: "auth_token" });
async function send_message() {
const { requestId } = await courier.send({
message: {
to: {
slack: {
access_token: "access_token",
email: "example@email.com"
},
ms_teams: {
conversation_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
tenant_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
service_url: "https://smba.trafficmanager.net/amer"
},
email: "example@email.com"
},
// template: "template_id",
content: {
title: "Important Survey Reminder",
body: "This is a reminder to fill out your survey by the end of this week.",
},
routing: {
method: "all",
channels: ["direct_message", "email"]
}
},
});
console.log(requestId);
}
send_message();

💡 To prioritize delivery without duplicates, use "single" as your routing.method.
Courier will attempt each channel in order—Slack, then Teams, then email—until one succeeds.

Automate Slack and Microsoft Teams Notifications with Visual Workflows

If you prefer to build notifications without writing code, Courier’s visual automation tools let you design, schedule, and send messages using a drag-and-drop interface.


Step 1: Create a Notification Template

Start by opening the Notification Designer and creating a new notification. You can add one or more channels—such as Slack, Microsoft Teams, email, or SMS—and customize the content for each one individually.

Click any channel icon to edit its message content. Use the drag-and-drop Library on the left side to reuse content blocks across channels and maintain consistency.

library

Once your message is ready, click the gear icon next to the notification title (top right) to copy the Notification ID. You’ll need it when setting up the automation.


Step 2: Build an Automation

Go to the Automations dashboard and click Create Automation. Select a Schedule Trigger and choose a date and time for when the message should send.

Next, add a Send step and choose the notification you created. Change the Payload Type to JSON, then click Editor to define your recipient data.

Here’s how to structure the fields:

  • Click

    • Add field
    and enter slack as an Object

    • Add nested fields: access_token, email
  • Click

    • Add field
    again and enter ms_teams as an Object

    • Add nested fields: conversation_id, tenant_id, service_url

If you'd also like to send email or SMS, add fields for "email" and "phone_number" using the same structure.

Courier will now send the message to the selected channels using the profile data provided.

automation slack and teams

Conclusion

Automating notifications in team communication platforms such as Slack and Teams can significantly improve team productivity and communication. However, building automated notifications from scratch can be complex and time-consuming. That's where Courier comes in with its easy-to-use Node.js SDK that allows developers to send notifications to multiple channels with just a few lines of code.

By following the steps outlined in this article, you can set up notification automation with Courier and Node.js for both Slack and Teams. Additionally, you can leverage Courier's multi-channel functionality to integrate other applications and channels into your notification system.

FAQs

How do I send a message to both Slack and Microsoft Teams with one API call?

Courier supports multi-channel delivery using a single send API call. To send to both Slack and Teams, include both in the to object and use the routing configuration to specify behavior.

Copied!

routing: {
method: "all", // or "single" for fallback
channels: ["direct_message"]
}
  • Use "all" to send to all channels at once
  • Use "single" to send to the first available (e.g., Slack → fallback to Teams → fallback to email)

Learn more about routing logic here.


How do I handle Slack OAuth tokens securely?

Courier does not store your Slack tokens. You provide them at runtime in the API call. Be sure to keep these tokens in environment variables or a secure secrets manager—never commit them to version control.

Copied!

slack: {
access_token: process.env.SLACK_BOT_TOKEN,
email: "user@example.com"
}

What does “MISSING_PROVIDER_SUPPORT” mean in Courier?

This error usually means the integration for the channel you’re trying to send with—like Slack or Teams—is not properly installed or configured in your Courier account.

Fix:

  1. Go to your Courier Channels dashboard
  2. Remove the problematic channel
  3. Re-add and re-authorize it with valid credentials

Check logs in the Courier Message Log to confirm which provider failed.


Can I send fallback messages with Courier if one channel fails?

Yes. Set routing.method to "single" and Courier will attempt to deliver the message using each channel in order until one succeeds.

Copied!

routing: {
method: "single",
channels: ["direct_message", "email"]
}

This is ideal for high-priority alerts or workflows where delivery matters more than the channel.


How can I automate Slack and Teams messages without writing code?

Use Courier’s Notification Designer to build multi-channel messages, then schedule them in Automations using a visual workflow.

  • Choose your channels (Slack, Teams, Email, etc.)
  • Customize the message for each
  • Add recipient profile data via JSON (tokens, emails, tenant IDs)
  • Schedule or trigger the message with no code

What if my Teams message doesn’t send?

If you’re using Microsoft Teams and the message doesn’t arrive:

  • Make sure the bot is installed and the Bot Endpoint URL is set in the Teams Developer Portal
  • Double-check that the App ID, Tenant ID, and Service URL match the current environment
  • Confirm that Microsoft Teams is installed and configured as a provider in Courier

You can also view failed attempts in the Courier logs to troubleshoot further.


Can I send to Slack users by email address?

Yes—Courier identifies Slack users by their email address (using Slack’s users.lookupByEmail under the hood). Just make sure the email is tied to an active Slack account and the Bot Token has the correct scopes (users:read.email).


How do I test without bothering real users?

You can send test messages to yourself using your own Slack or Teams credentials and email. Use Courier’s test users and preview tools to confirm layout, content, and channel behavior without affecting production users.

💡 Pro tip: Use Courier’s Message Designer Preview to test all channels in one place.

Similar resources

BUILD WITH AI
AIGuideTutorialProduct News

Build with AI: let your agent handle notifications end to end

Courier's Build with AI toolkit gives coding agents direct access to your notification infrastructure. Four integration points, one goal: let your agent send messages, debug deliveries, manage users, and follow notification best practices without context-switching. Works with Claude Code, Cursor, and any agent that can run shell commands or call MCP tools.

By Kyle Seyler

April 07, 2026

ai notifications
AITutorialProduct Management

How to Use Claude Code on Mobile to Design, Test, and Ship Multichannel Notifications

A walkthrough of using Claude Code's mobile app with Courier's MCP server and CLI to design, test, and ship a multichannel product announcement from a phone. Covers the full workflow: drafting the content outline, creating notification templates using Courier's elemental format, building channel-specific variants for email, Slack, push, and SMS, customizing brand styling through the API, iterating on design with test sends, getting team approval, and publishing with custom routing rules. The whole thing took a couple hours, mostly cold start and design iterations.

By Kyle Seyler

April 06, 2026

transactional vs. marketing vs. product notifications
GuideTutorialNotifications Landscape

Transactional, Product, and Marketing Notifications: What Are the Differences?

Understanding the difference between transactional, product, and marketing notifications is essential for developers building notification infrastructure. Transactional notifications confirm user actions and require no opt-in. Product notifications drive feature adoption through education. Marketing notifications promote sales and require explicit consent. This guide explains the legal requirements, best practices, and when to use each notification type to build compliant systems users trust.Retry

By Kyle Seyler

October 23, 2025

Multichannel Notifications Platform for SaaS

Products

Platform

Integrations

Customers

Blog

API Status

Subprocessors


© 2026 Courier. All rights reserved.