Skip to content

Send Teams Message

This service task sends a message to a Microsoft Teams channel or chat using the Microsoft Graph API. It supports plain text, HTML formatting, and Adaptive Cards.

Benefit: Process events (approvals, status changes, escalations) can trigger Teams notifications automatically — no manual forwarding needed.


Prerequisites

A Microsoft Entra ID (Azure AD) App Registration is required with:

  • Application permissions (not delegated):
    • ChannelMessage.Send — to send messages to channels
    • Chat.ReadWrite.All — to send messages to chats
  • Admin consent granted for the tenant

The credentials (tenantId, oAuthClientID, clientSecret) can be stored as Pantarey Secrets and referenced via {{secret:NAME}}.


Input Parameters

Parameter Type Required Description
credentials Object Yes { tenantId, oAuthClientID, clientSecret } — Microsoft Entra ID credentials.
teamId String Conditional Team ID (required for channel messages).
channelId String Conditional Channel ID (required for channel messages).
chatId String Conditional Chat ID (required for chat messages). Use teamId + channelId or chatId.
message String Yes* Message text (plain text or HTML). *Not required when using card.
contentType String No text or html. Default: text.
card Object No An Adaptive Card JSON object. Takes precedence over message.

Example: Channel Message (Text)

{
  "credentials": {
    "tenantId": "{{secret:MS_TENANT_ID}}",
    "oAuthClientID": "{{secret:MS_CLIENT_ID}}",
    "clientSecret": "{{secret:MS_CLIENT_SECRET}}"
  },
  "teamId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "channelId": "19:xxxxxxxx@thread.tacv2",
  "message": "Order #2024-001 has been approved.",
  "contentType": "text"
}

Example: Adaptive Card

{
  "credentials": { "..." : "..." },
  "teamId": "...",
  "channelId": "...",
  "message": "Order approved",
  "card": {
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.4",
    "body": [
      {
        "type": "TextBlock",
        "text": "Order #2024-001 approved",
        "weight": "Bolder",
        "size": "Medium"
      },
      {
        "type": "FactSet",
        "facts": [
          { "title": "Amount", "value": "€ 1,500.00" },
          { "title": "Approved by", "value": "Max Mustermann" }
        ]
      }
    ]
  }
}

Output

Field Type Description
messageId String The ID of the created message.
createdDateTime String ISO timestamp of when the message was created.
webUrl String / null Direct link to the message in Teams (if available).

Example Output

{
  "messageId": "1234567890",
  "createdDateTime": "2026-02-14T10:30:00Z",
  "webUrl": "https://teams.microsoft.com/l/message/..."
}

Finding Team and Channel IDs

  • In Teams: Right-click on a channel → "Get link to channel". The URL contains both IDs.
  • Via Graph Explorer: https://developer.microsoft.com/graph/graph-explorer
    • GET /me/joinedTeams → lists teams with IDs
    • GET /teams/{teamId}/channels → lists channels with IDs

Use Cases

  • Approval notifications: "Invoice #2024-001 was approved by Max Mustermann."
  • Escalations: Alert a support channel when an SLA is about to expire.
  • Status updates: Post project milestones to a project channel.
  • Onboarding: Notify the IT channel when a new employee process starts.
  • Adaptive Cards: Rich formatted messages with facts, images, and action buttons.