WhatsApp Bot - Completion & Goodbye Flow
How conversations end and the goodbye message logic.
Flow Diagram
flowchart TD
SERVICE_COMPLETE([Service Completed]) --> CHECK_TYPE{Completion Type}
CHECK_TYPE -->|"doctor_consultation"| SKIP_GOODBYE
CHECK_TYPE -->|"customer_service"| SKIP_GOODBYE
CHECK_TYPE -->|Other services| AWAITING_CLOSURE
SKIP_GOODBYE[Mark as Completed Immediately] --> END
AWAITING_CLOSURE[Set status: awaiting_closure] --> WAIT_20S[Wait 20 seconds]
WAIT_20S --> SEND_HOPE[/"Hope that helped! 😊
Need anything else?
Yes / No"/]
SEND_HOPE --> USER_RESPONSE{User Response}
USER_RESPONSE -->|"Thanks/No/Merci/Non"| YOURE_WELCOME[/"You're welcome! 🙏
Have a great day!"/]
YOURE_WELCOME --> MARK_COMPLETE[Mark as Completed]
USER_RESPONSE -->|"Yes/Oui"| NEW_CONVERSATION[Create New Conversation]
NEW_CONVERSATION --> MAIN_MENU[Show Main Menu]
USER_RESPONSE -->|Timeout| MARK_COMPLETE
MARK_COMPLETE --> END([Conversation Ended])
Skip Goodbye Services
These completion reasons skip the "Hope that helped" message:
| Completion Reason | Why Skip |
|---|---|
doctor_consultation |
User redirected to doctor profile |
customer_service |
User has contact info |
Awaiting Closure Flow
For all other services:
- Service completes → Status:
awaiting_closure - Wait 20 seconds → Grace period
- Send "Hope that helped" → Ask if need more help
- User responds or timeout → Mark completed
Thanks Keywords
Words that trigger "You're welcome" response:
| English | French |
|---|---|
| thanks | merci |
| thank you | merci beaucoup |
| no | non |
| no thanks | non merci |
| nope | - |