Chat Messages
Chat Messages works with the messages in Microsoft Teams chats: it sends messages to a chat, reads its latest messages, fetches a specific message and replies to an existing one. It also sends direct messages to a person from their email address and reads your direct conversations.
Use it so your flows notify a specific person through Teams, or so an AI agent handles the messages you receive by chat.
When to use it
- You want to notify the assigned salesperson through Teams every time a new client comes in.
- An AI agent needs to read your recent chats with someone and summarise what is pending.
- You want to answer common questions in a group chat automatically.
- You need to send a colleague, by direct message, the document the flow generated.
Configuration
You need a Microsoft Teams credential, which connects by signing in with your Microsoft account. See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The Microsoft Teams credential used to send and read. Messages are sent on behalf of that account. Choosing it loads your chats. |
| Operation (required) | What the component does. See Operations. By default, Send Chat Message. |
| Chat ID | The chat you work with. One-to-one chats show the other person’s name, and group chats show their topic or members. In Send Chat Message, Get Chat Messages, Get Chat Message and Reply to Message. |
| Recipient Email | The person’s email address. In Send Direct Message it is the recipient. In Get Direct Messages it limits the reading to your chats with that person; empty, all your chats are read. |
| Message Text | The text of the message or the reply. In Send Chat Message, Reply to Message and Send Direct Message. |
| Content Type | text (plain text) or html (accepts simple formatting, such as bold text or links). By default, html. In the same operations as Message Text. |
| Message ID | The identifier of the message you read or reply to. In Get Chat Message and Reply to Message. |
| Message Count | How many messages are read. By default, 20. In Get Chat Messages and Get Direct Messages. |
| Attachments | The files attached to the direct message. Connect the output of a component that delivers files, or type a file’s web address. In Send Direct Message. |
Operations
| Operation | What it does |
|---|---|
Send Chat Message | Sends a message to the chosen chat. |
Get Chat Messages | Returns the latest messages in the chat. |
Get Chat Message | Returns a specific message, with its content, its author and its date. |
Reply to Message | Replies to a message in the chat. |
Get Direct Messages | Returns the recent messages in your chats, either all of them or only the ones with the person in Recipient Email, newest first. |
Send Direct Message | Sends a message to a person by their email address. It uses the chat you already have with them or, if there is none, opens a new one. |
Output
The Data output returns one item for each message read, or a single item with the result: the message or reply sent, with its identifier, the chat and the date.
You can connect the result to an agent so it reads the conversation, or to another component that stores the messages. The component can also be connected to an Agent as a tool, so the agent decides when to write or read chats. See Tool Mode.
Example
An estate agency wants each agent to receive through Teams the details of the clients who request a viewing on the website.
- The website form reaches the flow with the client’s details and the assigned agent’s email.
- Add Chat Messages with the
Send Direct Messageoperation and the office’s Microsoft Teams credential. - In Recipient Email, enter the agent’s email, and in Message Text, the client’s name, phone number and the property they are interested in.
Good practices
- If the flow listens to those chats with Teams Webhook, turn on Ignore Own Messages there so it does not react to its own messages.
- Use
Send Direct Messagewhen you only know the person’s email: you don’t need to look up the chat first.
Related components
- Chats: look up your chats and their members.
- Channel Messages: post in Teams channels.
- Teams Webhook: start a flow when a message arrives.