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 }[]
}>
| Parameter | Type | Description |
|---|---|---|
to | string | string[] | A person's email, a group name, role:<app role> of this app, or a list of these |
text | string | Plain text |
card | object | An Adaptive Card (JSON) |
request | RequestLike | Server: 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.
- JavaScript
- Python
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
tc.teams.notify(to="role:approver", text="New purchase request", request=request)
Was this page helpful?