You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
2 months ago | |
---|---|---|
src | 2 months ago | |
tests/unit | 2 months ago | |
.env.example | 3 months ago | |
.gitignore | 3 months ago | |
Dockerfile | 3 months ago | |
README.md | 3 months ago | |
bun.lock | 3 months ago | |
captain-definition | 3 months ago | |
index.ts | 3 months ago | |
package.json | 3 months ago | |
startup.sh | 3 months ago | |
tsconfig.json | 3 months ago |
README.md
Task WhatsApp Chatbot
Future Steps
Core Principles
- Trust-but-Verify Approach: Leverage WhatsApp's message metadata to minimize API calls while maintaining security
- Progressive Validation: Verify users naturally through interactions rather than upfront checks
- Background Reconciliation: Use periodic syncs to maintain data accuracy without impacting real-time performance
Message Processing Flow
graph TD
A[Webhook Received] --> B{Valid Payload?}
B -->|No| C[Ignore]
B -->|Yes| D{From Known Group?}
D -->|Yes| E[Update User Last Seen]
D -->|No| F{Private Chat + Known User?}
F -->|No| C
F -->|Yes| E
E --> G{/tarea Command?}
G -->|No| C
G -->|Yes| H{New User?}
H -->|Yes| I[Add to DB]
H -->|No| J[Process Command]
Alias for actions
- I want that, when an user sends
/tarea
to the bot, with no extra arguments, it should show all the pending tasks for the user in a private message (the same behaviour as calling/tarea mostrar
Periodic Sync Strategy
- Rotating Group Check:
- Verify 1-2 groups per sync cycle
- Prioritize recently active groups
- User Reconciliation:
- Add newly discovered users
- Update
last_confirmed
for active users
- Optimizations:
- Cache active group IDs in memory
- Batch database writes
- Exponential backoff for API failures
Security Considerations
- Reject messages from:
- Non-community groups
- Unknown private chats
- Implement rate limiting
- Maintain audit logs of verification events