Example of responding to a Microsoft Teams command

This script respond to a Microsoft Teams command /windmill <text>.

Script teams Verified

by alex308 ยท 2/6/2025

The script

Submitted by alex308 Bun
Verified 371 days ago
1
import * as wmill from "windmill-client"
2

3
export async function main(
4
  activity_id: string,
5
  command: string,
6
  from_name: string,
7
  team_id: string,
8
  teams_message: any
9
) {
10
  // Your business logic
11
  const res = "task completed successfully!"
12

13
  // (optional) Send update to Teams channel about completion of job
14
  await wmill.TeamsService.sendMessageToConversation(
15
    {
16
      requestBody: {
17
        conversation_id: activity_id,
18
        success: true,
19
        text: `Hi, ${from_name}, command: ${command} ran successfully with the following result: ${res}`
20
      }
21
    }
22
  )
23
}