/posttoteams.ts Secret
Last active
December 16, 2022 14:54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _postToTeams = async () => { | |
const idToken = await microsoftTeams.authentication.getAuthToken(); | |
const teamsContext = await microsoftTeams.app.getContext(); | |
const teamId = teamsContext.team?.groupId; | |
const channelId = teamsContext.channel?.id; | |
const message = "This message will be posted to Teams using Microsoft Graph"; | |
await fetch(`/PostToTeams?teamId=${teamId}&channelId=${channelId}&message=${message}`, { | |
method: 'POST', | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json', | |
'Authorization': `Bearer ${idToken}` | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment