docs(examples): add runnable examples directory with 8 end-to-end bots#195
docs(examples): add runnable examples directory with 8 end-to-end bots#195victalejo wants to merge 3 commits into
Conversation
- Created .env.example for configuration in examples. - Implemented Echo bot example with FastAPI. - Added Menu with buttons and section lists example. - Developed Conversation with listeners example for multi-turn interactions. - Introduced Flow: newsletter signup example with encryption setup. - Created Templates: create + send example for marketing templates. - Implemented Media handling example for receiving and sending media. - Added Full async bot example using pywa_async for asynchronous operations. - Developed Flask alternative for the echo bot example. - Updated main README.md to include all examples and setup instructions. - Added shared requirements.txt for all examples.
for more information, see https://pre-commit.ci
|
Hi @victalejo! First of all, thank you so much for putting this together. I really love the clear examples you've built, and this is a massively important contribution. I am actually planning to add a Here is what we need to tweak:
from pywa.utils import start_ngrok_tunnel
from pywa import WhatsApp
callback_url = start_ngrok_tunnel(
auth_token="your_ngrok_auth_token",
domain="subdomain.ngrok-free.app",
)
wa = WhatsApp(callback_url=callback_url, ...)
(e.g., Defining the button/component inline right where it is passed to the action/layout). Thank you again for your time and effort on this! These examples are going to make the onboarding experience so much better for new developers using the CLI. Let me know if you run into any issues with the new syntax or need a hand with anything. |
|
I went ahead and updated the base branch for this PR to target dev instead of main (which is our standard workflow for new features). To make things easier and keep everything perfectly synced, I also merged the latest dev branch directly into your fork. This means your branch now has all the latest changes and utilities we discussed above Thanks again for this awesome contribution! |
Summary
Adds a new
examples/directory with 8 self-contained, runnable PyWa bots covering the main features of the library. Each example is a single-filemain.pyplus a focused README — readable in one sitting, copy-pasteable into a new project.Today the README has good snippets, but new users still have to assemble a working webhook + tunnel +
.envsetup before anything runs. These examples close that gap.What's included
Button,SectionList, typedCallbackDatawait_for_reply/wait_for_click, timeouts, cancelersFlowJSON,FlowButton,on_flow_completion, RSA encryption setuppywa_asyncwithasync defhandlers + concurrenthttpxPlus:
examples/README.md— index, prerequisites, quick-start, troubleshooting.examples/.env.example— every env var any example needs.examples/requirements.txt— singlepip install -rfor all 8.Conventions
main.pyper example, env vars viapython-dotenv(no hardcoded secrets).