mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-08 22:48:14 -05:00
change to microsoftteams
This commit is contained in:
@@ -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`
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -441,7 +441,7 @@ export async function GET(request: NextRequest) {
|
||||
})
|
||||
}
|
||||
|
||||
case 'microsoft-teams': {
|
||||
case 'microsoftteams': {
|
||||
const hmacSecret = providerConfig.hmacSecret
|
||||
|
||||
if (!hmacSecret) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -250,7 +250,7 @@ export async function verifyProviderAuth(
|
||||
const rawProviderConfig = (foundWebhook.providerConfig as Record<string, any>) || {}
|
||||
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<string, any>) || {}
|
||||
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',
|
||||
|
||||
@@ -71,7 +71,7 @@ const PROVIDER_EXTRACTORS: Record<string, (body: any) => string | null> = {
|
||||
hubspot: extractHubSpotIdentifier,
|
||||
linear: extractLinearIdentifier,
|
||||
jira: extractJiraIdentifier,
|
||||
'microsoft-teams': extractMicrosoftTeamsIdentifier,
|
||||
microsoftteams: extractMicrosoftTeamsIdentifier,
|
||||
airtable: extractAirtableIdentifier,
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -623,7 +623,7 @@ export async function cleanupExternalWebhook(
|
||||
): Promise<void> {
|
||||
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)
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user