Files
simstudioai--sim/apps/sim/triggers/microsoftteams/webhook.ts
T
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

129 lines
4.9 KiB
TypeScript

import { MicrosoftTeamsIcon } from '@/components/icons'
import type { TriggerConfig } from '../types'
export const microsoftTeamsWebhookTrigger: TriggerConfig = {
id: 'microsoftteams_webhook',
name: 'Microsoft Teams Channel',
provider: 'microsoft-teams',
description: 'Trigger workflow from Microsoft Teams channel messages via outgoing webhooks',
version: '1.0.0',
icon: MicrosoftTeamsIcon,
subBlocks: [
{
id: 'selectedTriggerId',
title: 'Trigger Type',
type: 'dropdown',
mode: 'trigger',
options: [
{ label: 'Microsoft Teams Channel', id: 'microsoftteams_webhook' },
{ label: 'Microsoft Teams Chat', id: 'microsoftteams_chat_subscription' },
],
value: () => 'microsoftteams_webhook',
required: true,
},
{
id: 'webhookUrlDisplay',
title: 'Webhook URL',
type: 'short-input',
readOnly: true,
showCopyButton: true,
useWebhookUrl: true,
placeholder: 'Webhook URL will be generated',
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'microsoftteams_webhook',
},
},
{
id: 'hmacSecret',
title: 'HMAC Secret',
type: 'short-input',
placeholder: 'Enter HMAC secret from Teams',
description:
'The security token provided by Teams when creating an outgoing webhook. Used to verify request authenticity.',
password: true,
required: true,
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'microsoftteams_webhook',
},
},
{
id: 'triggerInstructions',
title: 'Setup Instructions',
hideFromPreview: true,
type: 'text',
defaultValue: [
'Open Microsoft Teams and go to the team where you want to add the webhook. See the <a href="https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-outgoing-webhook" target="_blank" rel="noopener noreferrer">Microsoft Teams documentation</a> for detailed steps.',
'Click the three dots (•••) next to the team name and select "Manage team".',
'Go to the "Apps" tab and click "Create an outgoing webhook".',
'Provide a name, description, and optionally a profile picture.',
'Set the callback URL to your Sim webhook URL above.',
'Copy the HMAC security token and paste it into the "HMAC Secret" field.',
'Click "Create" to finish setup.',
]
.map(
(instruction, index) =>
`<div class="mb-3"><strong>${index + 1}.</strong> ${instruction}</div>`
)
.join(''),
mode: 'trigger',
condition: {
field: 'selectedTriggerId',
value: 'microsoftteams_webhook',
},
},
],
outputs: {
from: {
id: { type: 'string', description: 'Sender ID' },
name: { type: 'string', description: 'Sender name' },
aadObjectId: { type: 'string', description: 'AAD Object ID' },
},
message: {
raw: {
attachments: { type: 'json', description: 'Array of attachments' },
channelData: {
team: { id: { type: 'string', description: 'Team ID' } },
tenant: { id: { type: 'string', description: 'Tenant ID' } },
channel: { id: { type: 'string', description: 'Channel ID' } },
teamsTeamId: { type: 'string', description: 'Teams team ID' },
teamsChannelId: { type: 'string', description: 'Teams channel ID' },
},
conversation: {
id: { type: 'string', description: 'Composite conversation ID' },
name: { type: 'string', description: 'Conversation name (nullable)' },
isGroup: { type: 'boolean', description: 'Is group conversation' },
tenantId: { type: 'string', description: 'Tenant ID' },
aadObjectId: { type: 'string', description: 'AAD Object ID (nullable)' },
conversationType: { type: 'string', description: 'Conversation type (channel)' },
},
text: { type: 'string', description: 'Message text content' },
messageType: { type: 'string', description: 'Message type' },
channelId: { type: 'string', description: 'Channel ID (msteams)' },
timestamp: { type: 'string', description: 'Timestamp' },
},
},
activity: { type: 'object', description: 'Activity payload' },
conversation: {
id: { type: 'string', description: 'Composite conversation ID' },
name: { type: 'string', description: 'Conversation name (nullable)' },
isGroup: { type: 'boolean', description: 'Is group conversation' },
tenantId: { type: 'string', description: 'Tenant ID' },
aadObjectId: { type: 'string', description: 'AAD Object ID (nullable)' },
conversationType: { type: 'string', description: 'Conversation type (channel)' },
},
},
webhook: {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
},
}