fix ms teams

This commit is contained in:
Vikhyath Mondreti
2025-11-17 16:02:35 -08:00
parent 82f82faba4
commit 1cc6f54ad4
8 changed files with 19 additions and 19 deletions
@@ -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, 'microsoftteams')))
.where(and(eq(webhookTable.isActive, true), eq(webhookTable.provider, 'microsoft-teams')))
logger.info(
`Found ${webhooksWithWorkflows.length} active Teams webhooks, checking for expiring subscriptions`
+2 -2
View File
@@ -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 === 'microsoftteams' &&
provider === 'microsoft-teams' &&
typeof providerConfig === 'object' &&
providerConfig?.triggerId === 'microsoftteams_chat_subscription'
@@ -297,7 +297,7 @@ export async function POST(request: NextRequest) {
}
}
if (provider === 'microsoftteams') {
if (provider === 'microsoft-teams') {
const { createTeamsSubscription } = await import('@/lib/webhooks/webhook-helpers')
logger.info(`[${requestId}] Creating Teams subscription before saving to database`)
try {
+1 -1
View File
@@ -441,7 +441,7 @@ export async function GET(request: NextRequest) {
})
}
case 'microsoftteams': {
case 'microsoft-teams': {
const hmacSecret = providerConfig.hmacSecret
if (!hmacSecret) {
@@ -55,7 +55,7 @@ export class TriggerBlockHandler implements BlockHandler {
}
}
if (provider === 'microsoftteams') {
if (provider === 'microsoft-teams') {
const providerData = (starterOutput as any)[provider] || webhookData[provider] || {}
const payloadSource = providerData?.message?.raw || webhookData.payload || {}
return {
+6 -6
View File
@@ -250,7 +250,7 @@ export async function verifyProviderAuth(
const rawProviderConfig = (foundWebhook.providerConfig as Record<string, any>) || {}
const providerConfig = resolveProviderConfigEnvVars(rawProviderConfig, decryptedEnvVars)
if (foundWebhook.provider === 'microsoftteams') {
if (foundWebhook.provider === 'microsoft-teams') {
if (providerConfig.hmacSecret) {
const authHeader = request.headers.get('authorization')
@@ -556,7 +556,7 @@ export async function checkRateLimits(
traceSpans: [],
})
if (foundWebhook.provider === 'microsoftteams') {
if (foundWebhook.provider === 'microsoft-teams') {
return NextResponse.json(
{
type: 'message',
@@ -634,7 +634,7 @@ export async function checkUsageLimits(
traceSpans: [],
})
if (foundWebhook.provider === 'microsoftteams') {
if (foundWebhook.provider === 'microsoft-teams') {
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 === 'microsoftteams' &&
foundWebhook.provider === 'microsoft-teams' &&
body?.value &&
Array.isArray(body.value) &&
body.value.length > 0
@@ -835,7 +835,7 @@ export async function queueWebhookExecution(
)
}
if (foundWebhook.provider === 'microsoftteams') {
if (foundWebhook.provider === 'microsoft-teams') {
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 === 'microsoftteams') {
if (foundWebhook.provider === 'microsoft-teams') {
return NextResponse.json(
{
type: 'message',
+1 -1
View File
@@ -71,7 +71,7 @@ const PROVIDER_EXTRACTORS: Record<string, (body: any) => string | null> = {
hubspot: extractHubSpotIdentifier,
linear: extractLinearIdentifier,
jira: extractJiraIdentifier,
microsoftteams: extractMicrosoftTeamsIdentifier,
'microsoft-teams': extractMicrosoftTeamsIdentifier,
airtable: extractAirtableIdentifier,
}
+6 -6
View File
@@ -133,7 +133,7 @@ async function formatTeamsGraphNotification(
input: 'Teams notification received',
webhook: {
data: {
provider: 'microsoftteams',
provider: 'microsoft-teams',
path: foundWebhook?.path || '',
providerConfig: foundWebhook?.providerConfig || {},
payload: body,
@@ -397,7 +397,7 @@ async function formatTeamsGraphNotification(
},
webhook: {
data: {
provider: 'microsoftteams',
provider: 'microsoft-teams',
path: foundWebhook?.path || '',
providerConfig: foundWebhook?.providerConfig || {},
payload: body,
@@ -446,7 +446,7 @@ async function formatTeamsGraphNotification(
},
webhook: {
data: {
provider: 'microsoftteams',
provider: 'microsoft-teams',
path: foundWebhook?.path || '',
providerConfig: foundWebhook?.providerConfig || {},
payload: body,
@@ -818,7 +818,7 @@ export async function formatWebhookInput(
}
}
if (foundWebhook.provider === 'microsoftteams') {
if (foundWebhook.provider === 'microsoft-teams') {
// 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: 'microsoftteams',
provider: 'microsoft-teams',
path: foundWebhook.path,
providerConfig: foundWebhook.providerConfig,
payload: body,
@@ -1653,7 +1653,7 @@ export function verifyProviderWebhook(
break
}
case 'microsoftteams':
case 'microsoft-teams':
break
case 'generic':
if (providerConfig.requireAuth) {
+1 -1
View File
@@ -623,7 +623,7 @@ export async function cleanupExternalWebhook(
): Promise<void> {
if (webhook.provider === 'airtable') {
await deleteAirtableWebhook(webhook, workflow, requestId)
} else if (webhook.provider === 'microsoftteams') {
} else if (webhook.provider === 'microsoft-teams') {
await deleteTeamsSubscription(webhook, workflow, requestId)
} else if (webhook.provider === 'telegram') {
await deleteTelegramWebhook(webhook, requestId)