-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Update Telegram bot events #39983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Update Telegram bot events #39983
Conversation
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe Telegram bot integration documentation was updated to reflect changes in event data structures for Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Telegram Bot
participant Integration
User->>Telegram Bot: Sends command/text/callback
Telegram Bot->>Integration: Forwards event with event data
Note right of Integration: Event data includes:<br/>- id (message ID, for command/text)<br/>- bot {config_entry_id, id, first_name, last_name, username}<br/>- (no chat field in telegram_text)
Integration-->>Telegram Bot: Processes event with new structure
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
source/_integrations/telegram_bot.markdown (2)
446-452
: Bot sub-object looks good – minor ordering nitpick onlyGreat to see the new
bot
metadata block 👍.
For readability, consider grouping the scalar keys (command
,args
,from_first
, …) first and placing the two nested objects (bot
,message
if present) last – this matches the other HA event docs and keeps flat keys together.Purely cosmetic, so feel free to ignore if you prefer the current order.
461-471
: Consistent field ordering across events
telegram_text
now has theid
andbot
fields but the ordering differs slightly from thetelegram_command
example. Harmonising the order of keys across all three event samples will make copy-pasting and diffing easier for users.No functional impact – documentation polish only.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (1)
source/_integrations/telegram_bot.markdown
(3 hunks)
🔇 Additional comments (1)
source/_integrations/telegram_bot.markdown (1)
484-489
: Good addition ofbot
metadata for callbacksThe new
bot
block fortelegram_callback
completes the triad of updated event samples. Looks accurate and matches the core PR.
id: "<message id>" | ||
chat_id: "<origin chat id>" | ||
chat: "<chat info>" | ||
date: "<message timestamp>" | ||
message_thread_id: "<message thread id>" | ||
bot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chat
field contradicts PR objective – please remove
The PR description explicitly states the chat
field should be removed because it “does not exist”, yet it is still documented here for the telegram_command
event.
Keeping it will re-introduce the very inconsistency this PR is trying to solve.
-chat: "<chat info>"
Remove the bullet (and any references elsewhere) to stay aligned with the core implementation.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
id: "<message id>" | |
chat_id: "<origin chat id>" | |
chat: "<chat info>" | |
date: "<message timestamp>" | |
message_thread_id: "<message thread id>" | |
bot: | |
id: "<message id>" | |
chat_id: "<origin chat id>" | |
date: "<message timestamp>" | |
message_thread_id: "<message thread id>" | |
bot: |
🤖 Prompt for AI Agents
In source/_integrations/telegram_bot.markdown around lines 441 to 446, the
`chat` field is documented for the `telegram_command` event despite the PR
objective to remove it as it does not exist. Remove the `chat` field bullet and
any other references to `chat` in this section to maintain consistency with the
core implementation and the PR description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @hanwg 👍
Proposed change
Add
bot
info in all events.This is necessary to determine which bot triggered the event for setups that have multiple bots.
Removed the
chat
field since this field does not exist (docs is incorrect).Type of change
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
current
branch.next
branch.Summary by CodeRabbit
id
) and a detailedbot
object for relevant events.chat
field from thetelegram_text
event data.