Problem
The LINE Messaging API does not expose mention entities in webhook events. As documented in docs/line.md:
@mention gating — LINE does not expose mention entities. In groups, the bot responds to all messages.
This means in LINE group chats, the bot responds to every message, which is disruptive and unexpected for users who are not addressing the bot.
Use Case
In a travel planning group chat, multiple users are discussing a trip together. The bot should stay silent while the group is brainstorming and chatting — only stepping in when explicitly called with @Go醬. For example:
- User A: "I want to go to Japan in June"
- User B: "Me too! Let's do Hokkaido"
- User C: "Lavender season sounds perfect"
- User A:
@Go醬 We've decided on Hokkaido, June 23–25, 6 people. Please create the itinerary.
- Bot: ✅ Responds and creates the itinerary in Notion
Without @mention gating, the bot would interrupt every message in the conversation, breaking the natural group discussion flow and potentially exposing intermediate processing to all group members.
Proposed Solution
Add content-based mention detection in the LINE webhook handler. When a message is received in a group (source.type = "group" or "room"), check if the message text contains the bot's display name or a configurable keyword:
[gateway]
line_group_mention_keyword = "@Go醬" # bot only responds in groups when this keyword is present
# empty string = respond to all messages (current behavior, default)
When set:
- Group messages not containing the keyword → silently ignored (no reply)
- Group messages containing the keyword → processed normally
- DM messages → always processed (keyword not required)
Workaround
Currently, the workaround is to instruct the LLM agent via AGENTS.md to check message content and return a single space " " when not mentioned. This is unreliable as it depends on LLM compliance and still results in a visible (though empty) response.
Related
Problem
The LINE Messaging API does not expose mention entities in webhook events. As documented in
docs/line.md:This means in LINE group chats, the bot responds to every message, which is disruptive and unexpected for users who are not addressing the bot.
Use Case
In a travel planning group chat, multiple users are discussing a trip together. The bot should stay silent while the group is brainstorming and chatting — only stepping in when explicitly called with
@Go醬. For example:@Go醬We've decided on Hokkaido, June 23–25, 6 people. Please create the itinerary.Without @mention gating, the bot would interrupt every message in the conversation, breaking the natural group discussion flow and potentially exposing intermediate processing to all group members.
Proposed Solution
Add content-based mention detection in the LINE webhook handler. When a message is received in a group (
source.type = "group"or"room"), check if the message text contains the bot's display name or a configurable keyword:When set:
Workaround
Currently, the workaround is to instruct the LLM agent via
AGENTS.mdto check message content and return a single space" "when not mentioned. This is unreliable as it depends on LLM compliance and still results in a visible (though empty) response.Related