Microsoft Teams
GenAIScript provides APIs to post a message, with file attachments, to a given Microsoft Teams channel and itβs SharePoint File share.
- using the CLI, posting the result of the AI generation
genaiscript run ... --teams-message
- using the API, posting a message with attachments
const channel = await host.teamsChannel()await channel.postMessage("Hello, World!")
Authentication
GenAIScript uses the Azure authentication client to interact with the Microsoft Graph. Login to your account using the Azure CLI.
az login
Configuration
To use the Microsoft Teams integration with the CLI, you need to provide a link url to a Teams channel.
GENAISCRIPT_TEAMS_CHANNEL_URL=https://teams.microsoft.com/l/...
API
The API works by create a client for the channel, then calling postMessage
.
const channel = await host.teamsChannel()await channel.postMessage("Hello, World!")
You can also attach files to the message. The files will be uploaded to the SharePoint Files folder.
await channel.postMessage("Hello, World!", { files: [{ filename: "file.txt" }],})
Add a description to the file to populate this metdata. The description can be in markdown and will be rendered to Teams HTML as much as possible.
await channel.postMessage("Cool video!", { files: [ { filename: "video.mp4", description: `Titledescription`, }, ],})
For videos, GenAIScript will split the description into a subject/message to populate both entries in Microsoft Stream.