Convert flagged Matrix room messages into Asana tasks
A Matrix + Asana agent flow
Decisions and action items get made in a Matrix room and then dissolve into the scrollback. Two days later someone asks who owned the thing, and the answer is buried three hundred messages up. Give the room a memory by routing the explicit asks into Asana. The agent reads recent messages from the room with get-room-messages, picks the ones tagged with an agreed convention, a leading 'TODO:' or a reaction emoji, and creates Asana tasks from them with create_tasks. Matrix returns messages on request; the agent polls the room and a message it has already turned into a task is left alone. The work that was a sentence in chat becomes a tracked item with an owner.
The flow
get-room-messagesRetrieve recent messages from a room.
create_tasksCreates up to 50 tasks with assignments, dates, and custom fields.
Step by step
- Read recent messages
On each poll the agent calls get-room-messages for the target room, reading the latest batch with sender, body, and event id. The event id is what it dedupes on.
- Select the action items
The agent keeps only messages matching your convention, a TODO prefix or a specific tag, and remembers the last event id it processed so the next poll starts where this one ended.
- Create the tasks
create_tasks adds each selected message to the chosen Asana project, the message body as the task name, the sender noted, and the Matrix event id written into the notes for traceability. Up to 50 at once if a burst arrived.
Tell your agent
Every three minutes, read recent messages from our Matrix planning room, and for each new message starting with 'TODO:', create an Asana task in the Team Backlog with the message text and the sender. Store the Matrix event id in the notes and remember the last event id you handled.
Setup
This flow needs both servers connected to your agent. Follow each install guide:
Worth knowing
- get-room-messages returns a recent window, not an infinite history, so the agent must poll often enough that no flagged message scrolls out of the window between runs. Track the last event id to avoid gaps and re-reads.
- Reactions aren't part of the message body. If your flag is an emoji reaction rather than text, the agent needs the room's reaction events, which is a different read; a text prefix is the simpler convention.
- create_tasks won't know who in Asana the Matrix sender is. Either leave tasks unassigned for a lead to distribute, or keep a mapping from Matrix user id to Asana user and set the assignee explicitly.
Questions
- Can it capture a whole thread, not just one message?
- get-room-messages returns individual events. To pull a threaded discussion the agent would gather the related events and concatenate them into the task description, which means reading more of the room and stitching the thread together itself.
- Will it double-create if the same TODO is edited?
- An edit in Matrix is a separate event referencing the original. Dedupe on the original event id, and have the agent treat edits as updates to the existing Asana task via update_tasks rather than new tasks.