From 217f808641acf16cd64eae2ba7a2d6aee72f500b Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Mon, 17 Nov 2025 16:08:03 -0800 Subject: [PATCH] change to microsoftteams --- apps/sim/app/api/cron/renew-subscriptions/route.ts | 2 +- apps/sim/app/api/webhooks/route.ts | 4 ++-- apps/sim/app/api/webhooks/test/route.ts | 2 +- .../sim/executor/handlers/trigger/trigger-handler.ts | 2 +- apps/sim/lib/webhooks/processor.ts | 12 ++++++------ apps/sim/lib/webhooks/provider-utils.ts | 2 +- apps/sim/lib/webhooks/utils.server.ts | 12 ++++++------ apps/sim/lib/webhooks/webhook-helpers.ts | 2 +- apps/sim/triggers/microsoftteams/chat_webhook.ts | 4 ++-- apps/sim/triggers/microsoftteams/webhook.ts | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/apps/sim/app/api/cron/renew-subscriptions/route.ts b/apps/sim/app/api/cron/renew-subscriptions/route.ts index 214399345..2f58f5faa 100644 --- a/apps/sim/app/api/cron/renew-subscriptions/route.ts +++ b/apps/sim/app/api/cron/renew-subscriptions/route.ts @@ -35,7 +35,7 @@ export async function GET(request: NextRequest) { }) .from(webhookTable) .innerJoin(workflowTable, eq(webhookTable.workflowId, workflowTable.id)) - .where(and(eq(webhookTable.isActive, true), eq(webhookTable.provider, 'microsoft-teams'))) + .where(and(eq(webhookTable.isActive, true), eq(webhookTable.provider, 'microsoftteams'))) logger.info( `Found ${webhooksWithWorkflows.length} active Teams webhooks, checking for expiring subscriptions` diff --git a/apps/sim/app/api/webhooks/route.ts b/apps/sim/app/api/webhooks/route.ts index 5f0d58a27..86fd3ff64 100644 --- a/apps/sim/app/api/webhooks/route.ts +++ b/apps/sim/app/api/webhooks/route.ts @@ -137,7 +137,7 @@ export async function POST(request: NextRequest) { const isCredentialBased = credentialBasedProviders.includes(provider) // Treat Microsoft Teams chat subscription as credential-based for path generation purposes const isMicrosoftTeamsChatSubscription = - provider === 'microsoft-teams' && + provider === 'microsoftteams' && typeof providerConfig === 'object' && providerConfig?.triggerId === 'microsoftteams_chat_subscription' @@ -297,7 +297,7 @@ export async function POST(request: NextRequest) { } } - if (provider === 'microsoft-teams') { + if (provider === 'microsoftteams') { const { createTeamsSubscription } = await import('@/lib/webhooks/webhook-helpers') logger.info(`[${requestId}] Creating Teams subscription before saving to database`) try { diff --git a/apps/sim/app/api/webhooks/test/route.ts b/apps/sim/app/api/webhooks/test/route.ts index 3de2e19b1..8467f5306 100644 --- a/apps/sim/app/api/webhooks/test/route.ts +++ b/apps/sim/app/api/webhooks/test/route.ts @@ -441,7 +441,7 @@ export async function GET(request: NextRequest) { }) } - case 'microsoft-teams': { + case 'microsoftteams': { const hmacSecret = providerConfig.hmacSecret if (!hmacSecret) { diff --git a/apps/sim/executor/handlers/trigger/trigger-handler.ts b/apps/sim/executor/handlers/trigger/trigger-handler.ts index 1b53cd864..85fbffb4a 100644 --- a/apps/sim/executor/handlers/trigger/trigger-handler.ts +++ b/apps/sim/executor/handlers/trigger/trigger-handler.ts @@ -55,7 +55,7 @@ export class TriggerBlockHandler implements BlockHandler { } } - if (provider === 'microsoft-teams') { + if (provider === 'microsoftteams') { const providerData = (starterOutput as any)[provider] || webhookData[provider] || {} const payloadSource = providerData?.message?.raw || webhookData.payload || {} return { diff --git a/apps/sim/lib/webhooks/processor.ts b/apps/sim/lib/webhooks/processor.ts index 5d58b36d0..1b7661009 100644 --- a/apps/sim/lib/webhooks/processor.ts +++ b/apps/sim/lib/webhooks/processor.ts @@ -250,7 +250,7 @@ export async function verifyProviderAuth( const rawProviderConfig = (foundWebhook.providerConfig as Record) || {} const providerConfig = resolveProviderConfigEnvVars(rawProviderConfig, decryptedEnvVars) - if (foundWebhook.provider === 'microsoft-teams') { + if (foundWebhook.provider === 'microsoftteams') { if (providerConfig.hmacSecret) { const authHeader = request.headers.get('authorization') @@ -556,7 +556,7 @@ export async function checkRateLimits( traceSpans: [], }) - if (foundWebhook.provider === 'microsoft-teams') { + if (foundWebhook.provider === 'microsoftteams') { return NextResponse.json( { type: 'message', @@ -634,7 +634,7 @@ export async function checkUsageLimits( traceSpans: [], }) - if (foundWebhook.provider === 'microsoft-teams') { + if (foundWebhook.provider === 'microsoftteams') { return NextResponse.json( { type: 'message', @@ -783,7 +783,7 @@ export async function queueWebhookExecution( // For Microsoft Teams Graph notifications, extract unique identifiers for idempotency if ( - foundWebhook.provider === 'microsoft-teams' && + foundWebhook.provider === 'microsoftteams' && body?.value && Array.isArray(body.value) && body.value.length > 0 @@ -835,7 +835,7 @@ export async function queueWebhookExecution( ) } - if (foundWebhook.provider === 'microsoft-teams') { + if (foundWebhook.provider === 'microsoftteams') { const providerConfig = (foundWebhook.providerConfig as Record) || {} const triggerId = providerConfig.triggerId as string | undefined @@ -886,7 +886,7 @@ export async function queueWebhookExecution( } catch (error: any) { logger.error(`[${options.requestId}] Failed to queue webhook execution:`, error) - if (foundWebhook.provider === 'microsoft-teams') { + if (foundWebhook.provider === 'microsoftteams') { return NextResponse.json( { type: 'message', diff --git a/apps/sim/lib/webhooks/provider-utils.ts b/apps/sim/lib/webhooks/provider-utils.ts index 2ae0681e9..4c94335cb 100644 --- a/apps/sim/lib/webhooks/provider-utils.ts +++ b/apps/sim/lib/webhooks/provider-utils.ts @@ -71,7 +71,7 @@ const PROVIDER_EXTRACTORS: Record string | null> = { hubspot: extractHubSpotIdentifier, linear: extractLinearIdentifier, jira: extractJiraIdentifier, - 'microsoft-teams': extractMicrosoftTeamsIdentifier, + microsoftteams: extractMicrosoftTeamsIdentifier, airtable: extractAirtableIdentifier, } diff --git a/apps/sim/lib/webhooks/utils.server.ts b/apps/sim/lib/webhooks/utils.server.ts index 47aacdba3..d21867e18 100644 --- a/apps/sim/lib/webhooks/utils.server.ts +++ b/apps/sim/lib/webhooks/utils.server.ts @@ -133,7 +133,7 @@ async function formatTeamsGraphNotification( input: 'Teams notification received', webhook: { data: { - provider: 'microsoft-teams', + provider: 'microsoftteams', path: foundWebhook?.path || '', providerConfig: foundWebhook?.providerConfig || {}, payload: body, @@ -397,7 +397,7 @@ async function formatTeamsGraphNotification( }, webhook: { data: { - provider: 'microsoft-teams', + provider: 'microsoftteams', path: foundWebhook?.path || '', providerConfig: foundWebhook?.providerConfig || {}, payload: body, @@ -446,7 +446,7 @@ async function formatTeamsGraphNotification( }, webhook: { data: { - provider: 'microsoft-teams', + provider: 'microsoftteams', path: foundWebhook?.path || '', providerConfig: foundWebhook?.providerConfig || {}, payload: body, @@ -818,7 +818,7 @@ export async function formatWebhookInput( } } - if (foundWebhook.provider === 'microsoft-teams') { + if (foundWebhook.provider === 'microsoftteams') { // Check if this is a Microsoft Graph change notification if (body?.value && Array.isArray(body.value) && body.value.length > 0) { return await formatTeamsGraphNotification(body, foundWebhook, foundWorkflow, request) @@ -875,7 +875,7 @@ export async function formatWebhookInput( webhook: { data: { - provider: 'microsoft-teams', + provider: 'microsoftteams', path: foundWebhook.path, providerConfig: foundWebhook.providerConfig, payload: body, @@ -1653,7 +1653,7 @@ export function verifyProviderWebhook( break } - case 'microsoft-teams': + case 'microsoftteams': break case 'generic': if (providerConfig.requireAuth) { diff --git a/apps/sim/lib/webhooks/webhook-helpers.ts b/apps/sim/lib/webhooks/webhook-helpers.ts index 9d9d6775a..c1ccf976b 100644 --- a/apps/sim/lib/webhooks/webhook-helpers.ts +++ b/apps/sim/lib/webhooks/webhook-helpers.ts @@ -623,7 +623,7 @@ export async function cleanupExternalWebhook( ): Promise { if (webhook.provider === 'airtable') { await deleteAirtableWebhook(webhook, workflow, requestId) - } else if (webhook.provider === 'microsoft-teams') { + } else if (webhook.provider === 'microsoftteams') { await deleteTeamsSubscription(webhook, workflow, requestId) } else if (webhook.provider === 'telegram') { await deleteTelegramWebhook(webhook, requestId) diff --git a/apps/sim/triggers/microsoftteams/chat_webhook.ts b/apps/sim/triggers/microsoftteams/chat_webhook.ts index 563e03350..b31874268 100644 --- a/apps/sim/triggers/microsoftteams/chat_webhook.ts +++ b/apps/sim/triggers/microsoftteams/chat_webhook.ts @@ -4,7 +4,7 @@ import type { TriggerConfig } from '@/triggers/types' export const microsoftTeamsChatSubscriptionTrigger: TriggerConfig = { id: 'microsoftteams_chat_subscription', name: 'Microsoft Teams Chat', - provider: 'microsoft-teams', + provider: 'microsoftteams', description: 'Trigger workflow from new messages in Microsoft Teams chats via Microsoft Graph subscriptions', version: '1.0.0', @@ -16,7 +16,7 @@ export const microsoftTeamsChatSubscriptionTrigger: TriggerConfig = { title: 'Credentials', type: 'oauth-input', description: 'This trigger requires microsoft teams credentials to access your account.', - provider: 'microsoft-teams', + provider: 'microsoftteams', requiredScopes: [ 'openid', 'profile', diff --git a/apps/sim/triggers/microsoftteams/webhook.ts b/apps/sim/triggers/microsoftteams/webhook.ts index 1777c5d30..b21a407dc 100644 --- a/apps/sim/triggers/microsoftteams/webhook.ts +++ b/apps/sim/triggers/microsoftteams/webhook.ts @@ -4,7 +4,7 @@ import type { TriggerConfig } from '../types' export const microsoftTeamsWebhookTrigger: TriggerConfig = { id: 'microsoftteams_webhook', name: 'Microsoft Teams Channel', - provider: 'microsoft-teams', + provider: 'microsoftteams', description: 'Trigger workflow from Microsoft Teams channel messages via outgoing webhooks', version: '1.0.0', icon: MicrosoftTeamsIcon,