docs: update for bot API overhaul (whatsapp-rust#852) - #322
Conversation
- Rewrite quickstart to use prelude::*, on_message/on_qr_code typed registrars, single-dep Cargo.toml, and bot.run().await (no double-await) - Update installation to document single-dependency consumption and move UreqHttpClient import from transport to http module - Update receiving-messages guide to show typed registrars as the primary pattern and on_message for filtering - Update sending-messages guide to document ctx.reply/reply_quoting, wa::Message::text/text_with_context, and Client::send_text helpers - Add changelog entry 2026-06-11-bot-api-overhaul with full breaking change table and migration guide https://claude.ai/code/session_012JLxpJvMsHwZymEZWpbaP7
📝 WalkthroughWalkthroughThis PR updates all documentation to reflect a breaking bot API overhaul, including consolidated dependencies, typed event handlers, simplified lifecycle management, and messaging convenience helpers. Installation guidance simplifies to a single dependency, quickstart examples demonstrate the new builder and handler patterns throughout, and all guides consistently use the updated API surface. ChangesBot API Overhaul Documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa29e856cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Drop broken #bothandle anchor; link to /api/bot instead (no BotHandle heading exists in api/bot.mdx yet) - Replace .await? with if-let-Err in on_message examples — the handler closure returns () so ? would be a compile error for users copying it https://claude.ai/code/session_012JLxpJvMsHwZymEZWpbaP7
There was a problem hiding this comment.
3 issues found and verified against the latest diff
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
- quickstart: on_message handler now actually replies to "ping" with "pong" - installation: add tokio to git-revision install example - changelog: add tokio to migration "after" Cargo.toml snippet https://claude.ai/code/session_012JLxpJvMsHwZymEZWpbaP7
There was a problem hiding this comment.
🧹 Nitpick comments (3)
changelog/2026-06-11-bot-api-overhaul.mdx (3)
6-6: 💤 Low valueConsider using second person and active voice.
The phrase "Every consumer will need a migration" uses third person. Documentation guidelines prefer second person with active voice. Consider: "You will need to migrate your code, but the migration is mechanical."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@changelog/2026-06-11-bot-api-overhaul.mdx` at line 6, Replace the third-person passive sentence "Every consumer will need a migration" in changelog/2026-06-11-bot-api-overhaul.mdx with a second-person, active-voice phrasing (e.g., "You will need to migrate your code, but the migration is mechanical.") — locate the exact sentence in the PR description paragraph and update it to use "you" and active voice while preserving the rest of the sentence and the note about migrations being mechanical.Source: Coding guidelines
75-75: ⚡ Quick winUse code formatting for method name.
The method name
with_event_handlershould be formatted with backticks for consistency with other code references in the documentation.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@changelog/2026-06-11-bot-api-overhaul.mdx` at line 75, The documentation line mentions with_event_handler but doesn't use code formatting; update the sentence to wrap the method name `with_event_handler` in backticks (keeping `on_event` / `on_event_for` already formatted) so it reads: "`on_event` / `on_event_for` are unchanged as catch-alls. `with_event_handler` registers a struct-based `EventHandler` directly on the bus for stateful handlers (eliminates the clone-dance that closure captures force on consumers)." Ensure only the method name is changed to use backticks without altering surrounding text.Source: Coding guidelines
159-159: ⚡ Quick winUse code formatting for filename in heading.
As per coding guidelines, file names should use code formatting. The heading references
Cargo.tomlwhich should be formatted as code:`Cargo.toml`🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@changelog/2026-06-11-bot-api-overhaul.mdx` at line 159, Heading text "Builder dependencies — drop sibling crates from Cargo.toml" must use code formatting for the filename; update the heading to wrap Cargo.toml in backticks (e.g., "Builder dependencies — drop sibling crates from `Cargo.toml`") so the filename appears as inline code in the changelog; locate the heading string in changelog/2026-06-11-bot-api-overhaul.mdx and replace the plain filename with the backticked version.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@changelog/2026-06-11-bot-api-overhaul.mdx`:
- Line 6: Replace the third-person passive sentence "Every consumer will need a
migration" in changelog/2026-06-11-bot-api-overhaul.mdx with a second-person,
active-voice phrasing (e.g., "You will need to migrate your code, but the
migration is mechanical.") — locate the exact sentence in the PR description
paragraph and update it to use "you" and active voice while preserving the rest
of the sentence and the note about migrations being mechanical.
- Line 75: The documentation line mentions with_event_handler but doesn't use
code formatting; update the sentence to wrap the method name
`with_event_handler` in backticks (keeping `on_event` / `on_event_for` already
formatted) so it reads: "`on_event` / `on_event_for` are unchanged as
catch-alls. `with_event_handler` registers a struct-based `EventHandler`
directly on the bus for stateful handlers (eliminates the clone-dance that
closure captures force on consumers)." Ensure only the method name is changed to
use backticks without altering surrounding text.
- Line 159: Heading text "Builder dependencies — drop sibling crates from
Cargo.toml" must use code formatting for the filename; update the heading to
wrap Cargo.toml in backticks (e.g., "Builder dependencies — drop sibling crates
from `Cargo.toml`") so the filename appears as inline code in the changelog;
locate the heading string in changelog/2026-06-11-bot-api-overhaul.mdx and
replace the plain filename with the backticked version.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 648b3c1a-a0ab-412f-8ee6-1ab15bbabdff
📒 Files selected for processing (6)
changelog/2026-06-11-bot-api-overhaul.mdxdocs.jsonguides/receiving-messages.mdxguides/sending-messages.mdxinstallation.mdxquickstart.mdx
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
- Use second-person voice ("You will need to migrate") per CodeRabbit suggestion
- Add tokio `signal` feature to migration Cargo.toml snippet so the ctrl_c example compiles
https://claude.ai/code/session_012JLxpJvMsHwZymEZWpbaP7
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d206aad151
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ```toml Cargo.toml | ||
| [dependencies] | ||
| whatsapp-rust = "0.6" | ||
| tokio = { version = "1", features = ["macros", "rt-multi-thread"] } |
There was a problem hiding this comment.
Enable Tokio signal for the background example
If readers follow this Quickstart dependency block and then copy the new background-operation example below, tokio::signal::ctrl_c() will not compile because Tokio's signal module is gated behind the signal feature. Add "signal" here or avoid using tokio::signal in the page's runnable examples.
Useful? React with 👍 / 👎.
Summary
Updates the documentation to match the breaking API changes in whatsapp-rust#852.
quickstart.mdx— Full rewrite: single-depCargo.toml,use whatsapp_rust::prelude::*, typed event registrars (on_message,on_qr_code),ctx.reply("pong"),bot.run().await(single await, no?),bot.spawn()+handle.shutdown()patterninstallation.mdx— Documents single-dependency consumption; sibling crates are re-exported so onlywhatsapp-rust+tokioare needed;UreqHttpClientpath changed fromtransporttohttpguides/receiving-messages.mdx— Updated event subscription section to show typed registrars as the primary pattern; updated filtering example to useon_messageguides/sending-messages.mdx— New "Text message shortcuts" section documentingctx.reply,ctx.reply_quoting,client.send_text, andwa::Message::text/text_with_contextchangelog/2026-06-11-bot-api-overhaul.mdx— New changelog entry with full breaking-change table, migration guide, and all new featuresTest plan
quickstart.mdxcompile against the new APIinstallation.mdxCargo.toml snippets reflect the new single-dep setupbot.run().await?.await?patterns remain in the edited fileshttps://claude.ai/code/session_012JLxpJvMsHwZymEZWpbaP7
Generated by Claude Code
Summary by cubic
Updates the docs for the bot API overhaul: simpler lifecycle, typed handlers, single-dependency setup, and new messaging helpers. Quickstart, installation, guides, and changelog reflect the breaking changes; examples compile with
tokio(includingsignalfor the ctrl+c sample).New Features
use whatsapp_rust::prelude::*, typed handlers (.on_message/.on_qr_code),ctx.reply(...), andbot.run().awaitorspawn()+handle.shutdown(); builder defaults note that only the backend is required. The example now replies “pong” to “ping”.whatsapp-rust+tokio), movedUreqHttpClienttowhatsapp_rust::http, and addedtokioto the git-revision example.ctx.reply,ctx.reply_quoting,client.send_text, andwa::Message::text/text_with_context./api/botinstead of a broken anchor; handler examples useif let Err(e)instead of?. Changelog entry adds a full breaking-change table and migration guidance.Migration
bot.run().await?.await?withbot.run().await, or usebot.spawn()andhandle.shutdown().awaitfor background runs.Cargo.toml; use onlywhatsapp-rust(re-exportswacore,wacore_binary,waproto) plustokio.UreqHttpClientfromwhatsapp_rust::http, nottransport.on_message,on_qr_code, etc.); multiple handlers now accumulate instead of replacing.tokio’ssignalfeature inCargo.toml.Written for commit d206aad. Summary will update on new commits.
Summary by CodeRabbit
New Features
on_message,on_qr_code,on_pair_code,on_connected,on_logged_out) for cleaner handler registration.ctx.reply,ctx.reply_quoting,client.send_text).Bot::spawn()for background operation with graceful shutdown controls.Documentation