WhatsApp chatbot that works with an Evolution API server to provide task management to a WhatsApp Community.
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.
 
 
 
borja (aider) 60ed1d1f82 fix: update test expectations for command logging 2 months ago
src fix: skip debug logs in test environment 2 months ago
tests/unit fix: update test expectations for command logging 2 months ago
.env.example añado la variable de cuanto tiempo entre api calls de fetchAllGroups 3 months ago
.gitignore Webhook test pass and db is added to gitignore 3 months ago
Dockerfile feat: add debugging tools and startup delay for container 3 months ago
README.md añade un todo 3 months ago
bun.lock añade bun lock y package.json 3 months ago
captain-definition feat: add CapRover deployment files and env var validation 3 months ago
index.ts feat: initialize database before starting server 3 months ago
package.json añade bun lock y package.json 3 months ago
startup.sh feat: add debugging tools and startup delay for container 3 months ago
tsconfig.json Initial commit 3 months ago

README.md

Task WhatsApp Chatbot

Future Steps

Core Principles

  1. Trust-but-Verify Approach: Leverage WhatsApp's message metadata to minimize API calls while maintaining security
  2. Progressive Validation: Verify users naturally through interactions rather than upfront checks
  3. 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

  1. Rotating Group Check:
    • Verify 1-2 groups per sync cycle
    • Prioritize recently active groups
  2. User Reconciliation:
    • Add newly discovered users
    • Update last_confirmed for active users
  3. 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