Skip to content

Conversation

@rakshabesafe
Copy link
Owner

This commit introduces an auto-reply feature for chat messages.

New API Endpoints:

  • POST /chat/autoreply: Allows you to set an auto-reply message for a specific phone number. The request body requires 'Phone' and 'Body'. It stores the rule per user.
  • DELETE /chat/autoreply: Allows you to remove an auto-reply rule for a specific phone number. The request body requires 'Phone'.

Core Logic:

  • Database: A new 'autoreplies' table is added via migrations to store user_id, phone_number, and reply_body.
  • Message Handling: Incoming messages are checked against active auto-reply rules for the recipient user and the sender's phone number. If a rule matches, the predefined reply_body is sent back.
  • Loop Prevention: Auto-replies are not sent to messages originating from the bot itself (IsFromMe check).

Documentation:

  • API.md and the Swagger specification (static/api/spec.yml) have been updated to include the new endpoints, request/response formats, and error codes.

This commit introduces an auto-reply feature for chat messages.

New API Endpoints:
- POST /chat/autoreply: Allows you to set an auto-reply message for a specific phone number. The request body requires 'Phone' and 'Body'. It stores the rule per user.
- DELETE /chat/autoreply: Allows you to remove an auto-reply rule for a specific phone number. The request body requires 'Phone'.

Core Logic:
- Database: A new 'autoreplies' table is added via migrations to store user_id, phone_number, and reply_body.
- Message Handling: Incoming messages are checked against active auto-reply rules for the recipient user and the sender's phone number. If a rule matches, the predefined reply_body is sent back.
- Loop Prevention: Auto-replies are not sent to messages originating from the bot itself (IsFromMe check).

Documentation:
- API.md and the Swagger specification (static/api/spec.yml) have been updated to include the new endpoints, request/response formats, and error codes.
@rakshabesafe rakshabesafe merged commit 83015fc into main May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants