{"record":{"id":"7f8e6afdb5f2511c","repo":"Budibase/budibase","slug":"teams-integration-requires-appid-client-id-and-a","errorCode":null,"errorMessage":"Teams integration requires appId (client ID) and appPassword (client secret value)","messagePattern":"Teams integration requires appId \\(client ID\\) and appPassword \\(client secret value\\)","errorType":"http","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/ai/deployments/ms-teams.ts","lineNumber":52,"sourceCode":"const getHostname = (url: string) => new URL(url).hostname\n\nexport const validateMSTeamsIntegration = (\n  agent: Agent\n): ResolvedMSTeamsIntegration => {\n  const integration = agent.MSTeamsIntegration\n  if (!integration) {\n    throw new HTTPError(\n      \"Teams integration is not configured for this agent\",\n      400\n    )\n  }\n\n  const appId = integration.appId?.trim()\n  const appPassword = integration.appPassword?.trim()\n  const tenantId = integration.tenantId?.trim()\n\n  if (!appId || !appPassword || !tenantId) {\n    throw new HTTPError(\n      \"Teams integration requires appId (client ID) and appPassword (client secret value)\",\n      400\n    )\n  }\n\n  if (!isValidUUID(appId)) {\n    throw new HTTPError(\"Teams integration appId must be a valid UUID\", 400)\n  }\n\n  return {\n    appId,\n    appPassword,\n    tenantId,\n  }\n}\n\nexport const buildMSTeamsWebhookUrl = async (agentId: string) =>\n  await shared.buildProviderWebhookUrl(AgentChannelProvider.MSTEAMS, agentId)","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/deployments/ms-teams.ts#L34-L70","documentation":"After confirming MSTeamsIntegration exists, validateMSTeamsIntegration trims appId, appPassword, and tenantId and requires all three to be non-empty (note: tenantId is also enforced despite the message naming only appId/appPassword). Missing any of them aborts the Teams deployment with HTTP 400, since Azure Bot registration cannot proceed without full credentials.","triggerScenarios":"Saving/deploying an agent whose MSTeamsIntegration has empty/whitespace-only appId, appPassword, or tenantId — e.g. the form submitted without completing the Azure app registration fields, or secrets left blank in the integration object.","commonSituations":"Configuring Teams integration before creating the Azure Bot/app registration; secrets stripped when copying agent config between environments; tenantId field overlooked (it is required too).","solutions":["Fill in appId (Azure client ID), appPassword (client secret value), and tenantId on the agent's MSTeamsIntegration.","Complete the Azure app/bot registration to obtain the missing client ID/secret values.","Re-copy environment config including tenantId — it is mandatory even though the error message only mentions appId/appPassword."],"exampleFix":"// before\nMSTeamsIntegration: { appId: \"\", appPassword: secret, tenantId: \"\" }\n// after\nMSTeamsIntegration: { appId: \"00000000-0000-0000-0000-000000000000\", appPassword: secret, tenantId: \"11111111-1111-1111-1111-111111111111\" }","handlingStrategy":"validation","validationCode":"const i = agent.MSTeamsIntegration\nconst missing = [\"appId\", \"appPassword\", \"tenantId\"].filter(k => !i?.[k]?.trim())\nif (missing.length) throw new Error(`Teams integration missing: ${missing.join(\", \")}`)","typeGuard":"function isCompleteTeamsIntegration(i?: { appId?: string; appPassword?: string; tenantId?: string }): i is { appId: string; appPassword: string; tenantId: string } {\n  return Boolean(i?.appId?.trim() && i?.appPassword?.trim() && i?.tenantId?.trim())\n}","tryCatchPattern":"try {\n  validateMSTeamsIntegration(agent)\n} catch (e) {\n  if (e.status === 400 && e.message.includes(\"appId (client ID)\")) {\n    throw new Error(\"Complete Azure app registration fields (appId, appPassword, tenantId) in agent settings\")\n  }\n  throw e\n}","preventionTips":["Make appId, appPassword, and tenantId required fields in the Teams integration form.","Complete the Azure bot/app registration before saving the integration.","Re-verify secrets after copying agent configs between environments — blank fields trigger this error."],"tags":["validation","ms-teams","missing-credentials","http-400"],"backgroundTag":"missing-credentials","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}