Budibase/budibase · error · Error
Teams create conversation failed (${createResp.status}): ${a
Error message
Teams create conversation failed (${createResp.status}): ${await createResp.text()} What it means
When sending a Teams DM escalation, sendMSTeamsNotification first creates a conversation between the bot and the recipient via POST {serviceUrl}/v3/conversations, passing the resolved externalUserId and tenant ID. If that create call returns non-ok, this error is thrown with the status and the Bot Framework error body, before any card is posted.
Source
Thrown at packages/server/src/escalation/notifications/ms-teams.ts:416
channelData: { tenant: { id: msTenantId } },
}
console.log("sendMSTeamsNotification: creating conversation", {
escalationId: contextDoc._id,
externalUserId,
})
const createResp = await fetch(
`${dmServiceUrl.replace(/\/$/, "")}/v3/conversations`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(createBody),
}
)
if (!createResp.ok) {
throw new Error(
`Teams create conversation failed (${createResp.status}): ${await createResp.text()}`
)
}
const conversation = (await createResp.json()) as {
id: string
serviceUrl?: string
}
const postServiceUrl = conversation.serviceUrl || DEFAULT_SERVICE_URL
console.log("sendMSTeamsNotification: conversation created", {
conversationId: conversation.id,
serviceUrl: conversation.serviceUrl,
postServiceUrl,
})
await teamsPost(postServiceUrl, token, conversation.id, message)
console.log("sendMSTeamsNotification: message sent to user", {
escalationId: notifDoc.escalationId,
externalUserId,View on GitHub (pinned to a81a902e9a)
Solutions
- Re-resolve the recipient's identity link (chatIdentityLinks) to get a current externalUserId and serviceUrl; delete stale links for departed users.
- Ensure providerTenantId (or the integration's tenant ID) matches the recipient's actual Azure AD tenant and is included in the create body's channelData.
- Verify the bot is deployed (messagingEndpointUrl set) and installed in the recipient's tenant so it is permitted to create DM conversations.
- Use the serviceUrl from the identity link rather than the default when operating across regions.
Example fix
// before
members: [{ id: staleExternalUserId }], tenantId: integration.msTenantId // 404
// after
const link = await getChatIdentityLinkByGlobalUserId({ globalUserId, provider: "msteams" })
members: [{ id: link.externalUserId }], tenantId: link.providerTenantId Defensive patterns
Strategy: try-catch
Validate before calling
if (!externalUserId || !providerTenantId) {
throw new Error("Cannot create Teams DM: missing externalUserId or tenantId")
} Try / catch
try {
await sendMSTeamsNotification({ notifDoc, contextDoc })
} catch (err) {
if (err.message.includes("create conversation failed")) {
// 404: refresh identity link (externalUserId may be stale)
// 403: verify bot installed and not blocked by recipient
} else throw err
} Prevention
- Re-validate identity links before sending; prune links for departed users
- Ensure the bot is deployed (messagingEndpointUrl) and installed in the recipient's tenant
- Send the correct providerTenantId in both the tenant field and channelData
- Use the region-specific serviceUrl from the identity link when available
When it happens
Trigger: The conversation-create POST returns non-2xx: 401 (bad bot token), 403 (bot cannot message that user — not installed/user blocked), 404 (externalUserId unknown to the tenant/bot), or the tenantId in channelData doesn't match the recipient.
Common situations: Stale identity link: user left the org or their Teams externalUserId changed; missing/wrong providerTenantId so the tenant in the create body is wrong; bot not deployed or messaging endpoint not configured for the tenant; default serviceUrl region mismatch with where the user's tenant lives.
Related errors
- Teams Bot API ${resp.status}: ${await resp.text()}
- Teams Graph API ${resp.status}: ${await resp.text()}
- OIDC Config contents invalid
- Koa context must be supplied to logout.
- Unexpected header format
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/ee1dcb3ddcbc9717.
Report an issue: GitHub.