Skip to content

Update docs for telegram bot for new config flow - #39341

Merged
MartinHjelmare merged 9 commits into
home-assistant:nextfrom
hanwg:feature/telegram_bot
Jun 3, 2025
Merged

Update docs for telegram bot for new config flow#39341
MartinHjelmare merged 9 commits into
home-assistant:nextfrom
hanwg:feature/telegram_bot

Conversation

@hanwg

@hanwg hanwg commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

Proposed change

Preview: https://deploy-preview-39341--home-assistant-docs.netlify.app/integrations/telegram_bot/

  1. Added introduction to explain the different bot types/platforms
  2. Added prerequisites to explain how to create telegram bots and how to setup webhooks
  3. Added config flow
  4. Added options flow
  5. Added subentry flow
  6. Deleted telegram_broadcast, telegram_polling and telegram_webhooks pages since all these are combined.

Type of change

  • Spelling, grammar or other readability improvements (current branch).
  • Adjusted missing or incorrect information in the current documentation (current branch).
  • Added documentation for a new integration I'm adding to Home Assistant (next branch).
  • Added documentation for a new feature I'm adding to Home Assistant (next branch).
  • Removed stale or deprecated documentation.

Additional information

Checklist

  • This PR uses the correct branch, based on one of the following:
    • I made a change to the existing documentation and used the current branch.
    • I made a change that is related to an upcoming version of Home Assistant and used the next branch.
  • The documentation follows the Home Assistant documentation standards.

Summary by CodeRabbit

  • Documentation
    • Expanded and restructured the Telegram bot integration documentation with detailed setup guidance, platform distinctions (Broadcast, Polling, Webhooks), and step-by-step configuration instructions.
    • Added instructions for whitelisting chat IDs and clarified configuration flow options.
    • Introduced the config_entry_id option for all notification actions, allowing users to specify which bot instance to use.
    • Removed separate documentation pages for Telegram Broadcast, Polling, and Webhooks, consolidating all information into a single, comprehensive guide.
    • Unified Telegram bot related URL redirects to a single integration endpoint for simpler navigation.

@home-assistant home-assistant Bot added in-progress This PR/Issue is currently being worked on needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch next This PR goes into the next branch labels Jun 1, 2025
@home-assistant

home-assistant Bot commented Jun 1, 2025

Copy link
Copy Markdown

It seems that this PR is targeted against an incorrect branch. Documentation updates which apply to our current stable release should target the current branch. Please change the target branch of this PR to current and rebase if needed. If this is documentation for a new feature, please add a link to that PR in your description.

@netlify

netlify Bot commented Jun 1, 2025

Copy link
Copy Markdown

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit 3e9efd2
🔍 Latest deploy log https://app.netlify.com/projects/home-assistant-docs/deploys/683e44079ef9ae00083d9374
😎 Deploy Preview https://deploy-preview-39341--home-assistant-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@home-assistant home-assistant Bot added has-parent This PR has a parent PR in another repo and removed needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch labels Jun 1, 2025
@hanwg
hanwg marked this pull request as ready for review June 1, 2025 11:46
@hanwg

hanwg commented Jun 1, 2025

Copy link
Copy Markdown
Contributor Author

@MartinHjelmare please review the docs, thanks!

@coderabbitai

coderabbitai Bot commented Jun 1, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The documentation for the Telegram bot integration was consolidated and extensively revised. The previously separate documentation files for the broadcast, polling, and webhook platforms were removed, and a single, comprehensive guide was created. This unified documentation introduces a new configuration flow, clarifies platform distinctions, adds detailed setup instructions, and introduces a new config_entry_id attribute for all notification actions.

Changes

File(s) Change Summary
source/_integrations/telegram_bot.markdown Expanded and restructured documentation; added config flow flag, platform distinctions, setup guides, chat ID allowlisting, and config_entry_id for all actions.
source/_integrations/telegram_broadcast.markdown Deleted file; content merged into unified Telegram bot documentation.
source/_integrations/telegram_polling.markdown Deleted file; content merged into unified Telegram bot documentation.
source/_integrations/telegram_webhooks.markdown Deleted file; content merged into unified Telegram bot documentation.
source/_redirects Consolidated Telegram bot related URL redirects to unify under /integrations/telegram_bot.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomeAssistant
    participant TelegramBot
    participant TelegramAPI

    User->>HomeAssistant: Start Telegram Bot integration setup
    HomeAssistant->>User: Prompt for platform selection (Broadcast, Polling, Webhooks)
    User->>HomeAssistant: Provide API key, platform, and options
    HomeAssistant->>TelegramAPI: Register bot (setWebhook if Webhooks)
    TelegramAPI-->>HomeAssistant: Confirmation
    HomeAssistant->>User: Prompt to whitelist chat IDs
    User->>HomeAssistant: Add chat IDs
    HomeAssistant->>User: Integration setup complete

    Note over HomeAssistant,TelegramBot: On notification action
    User->>HomeAssistant: Call action (e.g., send_message) with optional config_entry_id
    HomeAssistant->>TelegramBot: Route action to specified bot instance
    TelegramBot->>TelegramAPI: Send message or perform action
    TelegramAPI-->>TelegramBot: Response
    TelegramBot-->>HomeAssistant: Action result
Loading

📜 Recent 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

📥 Commits

Reviewing files that changed from the base of the PR and between 42c16de and 3e9efd2.

📒 Files selected for processing (1)
  • source/_redirects (2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
`*/**(html|markdown|md)`: - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure t...

*/**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'
  • source/_redirects
`*/**(html|markdown|md)`: - Use bold to mark UI strings. - If "" are used to mark UI strings, replace them by bold.

*/**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.
  • source/_redirects
`*/**(html|markdown|md)`: - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"

*/**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"

  • source/_redirects
`*/**(html|markdown|md)`: - Use sentence-style capitalization also in headings.

*/**(html|markdown|md): - Use sentence-style capitalization also in headings.

  • source/_redirects
`*/**(html|markdown|md)`: do not comment on HTML used for icons

*/**(html|markdown|md): do not comment on HTML used for icons

  • source/_redirects
`*/**(html|markdown|md)`: Avoid flagging inline HTML for embedding videos in future reviews for this repository.

*/**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

  • source/_redirects
🔇 Additional comments (2)
source/_redirects (2)

155-157: LGTM! Component redirects correctly consolidated.

The component-level redirects for the three Telegram bot platforms (broadcast, polling, webhooks) are correctly updated to point to the unified /integrations/telegram_bot endpoint. The redirect syntax follows the established pattern in the file.


210-212: LGTM! Integration redirects correctly consolidated.

The integration-level redirects for the three Telegram bot platforms are properly updated to point to the unified /integrations/telegram_bot endpoint. This completes the consolidation by ensuring both old component and integration URLs redirect to the new unified documentation.


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MartinHjelmare MartinHjelmare changed the title updated docs for telegram bot for new config flow Update docs for telegram bot for new config flow Jun 2, 2025
Comment thread source/_integrations/telegram_bot.markdown Outdated
Comment thread source/_integrations/telegram_bot.markdown Outdated
Comment thread source/_integrations/telegram_bot.markdown Outdated
Comment thread source/_integrations/telegram_bot.markdown Outdated
Comment thread source/_integrations/telegram_bot.markdown Outdated
Comment thread source/_integrations/telegram_bot.markdown Outdated
@home-assistant
home-assistant Bot marked this pull request as draft June 2, 2025 06:34
@home-assistant

home-assistant Bot commented Jun 2, 2025

Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant Bot added the parent-merged The parent PR has been merged already label Jun 2, 2025
@hanwg
hanwg marked this pull request as ready for review June 2, 2025 12:50
@home-assistant
home-assistant Bot requested a review from MartinHjelmare June 2, 2025 12:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
source/_integrations/telegram_bot.markdown (1)

148-154: Consistent config_entry_id addition across actions
You’ve added the config_entry_id row in each action table. Ensure the phrasing and table alignment remain identical for every entry.

Also applies to: 174-181, 199-206, 225-233, 250-256, 275-283, 301-309, 320-328, 338-346, 353-358, 366-370, 378-382, 389-392, 399-401

🧹 Nitpick comments (6)
source/_integrations/telegram_bot.markdown (6)

15-16: Clarify introduction wording
The new sentence explains what this integration does, but consider tightening the phrasing. For example:
“Use this integration to send, edit, and receive messages via a Telegram Bot in Home Assistant.”


36-45: Prerequisites section completeness
The “Create Telegram bot” and webhook connectivity subsections cover the needed steps. Consider adding a note about bot permissions (e.g., enabling privacy mode) if relevant.


100-108: Document Subentries for allowlisting chat IDs
The new “Allowlisting chat IDs via Subentries” section is helpful. Consider adding a link to the community forum or example automation for retrieving IDs, beyond just the upstream /integrations/telegram anchor.


110-113: Allowlist configuration table formatting
The table for Chat ID looks good. You may want to explicitly note whether negative IDs (groups) are supported here, as in other docs.


115-119: Introduce new config_entry_id attribute
Great overview of the notification actions and mention of config_entry_id. Perhaps call out that it defaults to the first entry when only one bot is configured.


125-134: Enhance config_entry_id description in send_message
The new row is necessary, but clarify default behavior. For example:

-| `config_entry_id`          | yes      | The config entry representing the Telegram bot to send the message. Required if you have multiple Telegram bots.|
+| `config_entry_id`          | yes      | The config entry representing the Telegram bot to use. Required when multiple bots are configured; defaults to the first entry when only one is present.|
📜 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

📥 Commits

Reviewing files that changed from the base of the PR and between adc051d and 42c16de.

📒 Files selected for processing (1)
  • source/_integrations/telegram_bot.markdown (17 hunks)
🔇 Additional comments (8)
source/_integrations/telegram_bot.markdown (8)

8-8: Add ha_config_flow metadata flag
The ha_config_flow: true line correctly signals support for the new config flow. Ensure this aligns with the integration manifest in the core PR and that the flag is properly documented in the metadata reference.


17-21: Consolidate platform introduction
Good call on adding a unified “Introduction – Telegram bot platforms” section. You might merge lines 19–20 into a single sentence for brevity. Otherwise, this reads clearly.


22-35: Review platform sub‐sections for consistency
The Broadcast, Polling, and Webhooks descriptions are clear. Double-check that the level-3 headings (###) match the style guide and that each module’s prerequisites are linked (e.g., link to polling docs if available).


50-69: Verify reverse proxy and direct HTTPS instructions
The reverse proxy and direct exposure steps look correct. Please ensure the IP and proxy examples align with the HTTP integration docs, and confirm that use_x_forwarded_for guidance reflects the current defaults.


70-79: Use of config_flow.md include
Great use of the standard integrations/config_flow.md include. This ensures consistency across integrations. No further action needed here.


81-89: Webhooks configuration snippet
The additional configuration options for webhooks (URL, trusted networks) are clear. Verify that the indentation and parameter order match other integrations’ examples.


91-98: Options flow for default parse mode
Including parse mode in the options flow is a nice touch. Confirm that the allowed values (markdown, markdownv2, html) match the API client’s implementation.


759-765: Standard removal instructions
The “Removing the integration” section correctly points to the standard removal include. This aligns with other integrations and needs no extra steps.

@MartinHjelmare MartinHjelmare left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MartinHjelmare MartinHjelmare left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot: We should probably add redirects for the deleted pages to the main telegram bot page.

Here's an example:

/energy /home-energy-management

@home-assistant
home-assistant Bot marked this pull request as draft June 2, 2025 18:35
@hanwg

hanwg commented Jun 3, 2025

Copy link
Copy Markdown
Contributor Author

added the redirects.
Thanks for your support!

@hanwg
hanwg marked this pull request as ready for review June 3, 2025 00:44
@home-assistant
home-assistant Bot requested a review from MartinHjelmare June 3, 2025 00:44

@MartinHjelmare MartinHjelmare left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@MartinHjelmare
MartinHjelmare merged commit bf5a1cd into home-assistant:next Jun 3, 2025
@home-assistant home-assistant Bot removed parent-merged The parent PR has been merged already in-progress This PR/Issue is currently being worked on labels Jun 3, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

has-parent This PR has a parent PR in another repo next This PR goes into the next branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants