Turn flagged Mattermost messages into Plane work items
A Mattermost + Plane agent flow
Bug reports and feature asks land in a Mattermost channel, get a thumbs-up, and scroll away. Anything not captured as a tracked item is gone by the next standup. This flow reads recent messages from a channel with get_channel_messages, finds the ones your team marks for triage (a keyword, an emoji reaction, a thread tag), and opens a Plane work item for each with create_work_item, carrying the message text, the author, and a link back to the thread. Mattermost returns messages when the agent asks, so it reads on a schedule, and a message it has already turned into a work item is skipped.
The flow
get_channel_messagesGet recent messages from a channel.
create_work_itemCreates a new work item.
Step by step
- Decide the channel and the signal
Name the Mattermost channel and the convention that marks a message for triage, for example messages starting with '/bug' or carrying a specific reaction. Point the agent at one Plane project.
- Read recent messages
The agent calls get_channel_messages for the channel since its last run and reads each message's text, author, timestamp, and ID.
- Create the work item
For each flagged message the agent calls create_work_item in the Plane project with a title drawn from the message, a description quoting it, and a link to the Mattermost thread.
- Track the last message seen
Store the timestamp or ID of the last message processed. On the next pass the agent reads only newer messages, so it doesn't re-file the same report.
Tell your agent
Every five minutes, get recent messages from the Mattermost channel 'support'. For each message starting with '/bug', create a Plane work item in the Triage project titled from the message text, with a description quoting the full message and a link to the thread. Track the last message you processed and don't re-file ones already turned into work items.
Setup
This flow needs both servers connected to your agent. Follow each install guide:
Worth knowing
- get_channel_messages takes a channel ID. Resolve it once with get_channel_by_name and make sure the bot account has joined the channel, or the read returns nothing.
- Reactions aren't on the message body returned by get_channel_messages; reading them needs get_reactions per message. A keyword convention in the text is simpler to detect than an emoji.
- create_work_item needs the Plane project ID. Resolve it with list_projects up front so items land in the right place, and decide a default state and priority for filed bugs.
Questions
- Can it capture the whole thread, not just the first message?
- Yes. The agent reads the parent with get_channel_messages, then pulls replies with get_thread and includes them in the work item description, so the full context travels into Plane.
- How does it avoid filing the same message twice?
- By tracking the last message ID it processed per channel. Each run reads only messages newer than that mark, so a message becomes exactly one work item.