Skip to main content

Teams

tc.teams.notify(message)​

Sends a Teams message through the platform bot. Recipients the project isn't granted yet come back under pending (with an access request) instead of failing the whole call.

tc.teams.notify(m: {
to: string | string[]
text?: string
card?: Record<string, unknown>
request?: RequestLike
as?: 'user' | 'project'
}): Promise<{
delivered: { to: string; recipients: number; names: string[] }[]
pending: { to: string; code: string; message: string; request: AccessRequestRef | null }[]
}>
ParameterTypeDescription
tostring | string[]A person's email, a group name, role:<app role> of this app, or a list of these
textstringPlain text
cardobjectAn Adaptive Card (JSON)
requestRequestLikeServer: the incoming request

Returns what was delivered (with how many people each target reached) and what is pending approval.

Errors: ACCESS_PENDING, ACCESS_DENIED when nothing could be delivered; UNAUTHENTICATED, NO_REQUEST. See Errors.

const r = await tc.teams.notify({ to: 'role:approver', text: `New purchase request: ${title}` })
if (r.pending.length) toast(r.pending[0].message) // e.g. waiting for IT to approve
Was this page helpful?