JIVAS action wrapper for WhatsApp API communications using the WPPConnect API. This action provides a wrapper for WhatsApp API communications using the WPPConnect API. As a core action, it simplifies and streamlines interactions with WhatsApp. The package is a singleton and requires the Jivas library version ^2.1.0.
- Name:
jivas/wppconnect_action - Author: V75 Inc.
- Architype:
WPPConnectAction
- Title: WPPConnect Action
- Group: core
- Type: action
- Singleton: true
- Jivas:
~2.1.0 - PulseAction:
~0.1.0 - WPPConnect Server:
~2.8.5
Below is detailed guidance on how to configure and use the WPPConnect Action.
The WPPConnect Action provides an abstraction layer for interacting with WhatsApp via the WPPConnect API. It supports multiple configurations for various use cases, including:
- Webhook registration for message handling.
- Message broadcasting to multiple recipients.
- Integration with WPPConnect for sending text, media, and location messages.
The WPPConnect Action includes advanced mechanisms to optimize message delivery:
- Automatic Interval Adjustment: Dynamically modifies send intervals based on success rates to ensure efficient delivery.
- Variable Batch Sizes: Alternates batch sizes between defined minimum and maximum values for flexibility.
- Random Jitter: Introduces slight randomness to sending intervals to prevent detection of predictable patterns.
These features enhance reliability and minimize disruptions during high-volume messaging operations.
To use the WPPConnect Action, you need to set up the following configuration parameters. These specify connection and behavioral details.
| Parameter | Type | Description | Default |
|---|---|---|---|
api_url |
string | WPPConnect Server URL (e.g., "https://your-wppconnect-server.com") |
"" |
api_is_wwebjs |
bool | Use the whatsapp-web.js version of WPPConnectAPI when set to True |
False |
secret_key |
string | WPPConnect Server Secret Key for authentication. | "" |
token |
string | WPPConnect Server API Key for this session. | "" |
session |
string | WPPConnect Server Instance ID. | "" |
base_url |
string | JIVAS Base URL (your application's base URL). | "" |
webhook_url |
string | JIVAS webhook endpoint for receiving WPPConnect messages. | "" |
request_timeout |
float | Length of time (in seconds) this action waits for the API to complete a request. | 10.0 |
chunk_length |
int | Maximum length of message to send. Longer texts are split into subsequent messages. | 1024 |
use_pushname |
bool | Use the WhatsApp push name as the user name when set to True. |
True |
ignore_newsletters |
bool | Ignore newsletter messages when set to True. |
True |
ignore_forwards |
bool | Ignore forwarded messages when set to True. |
True |
poll_manager_action |
str | Action name to manage poll entries. | PollManagerInteractAction |
- Parameter Settings: Ensure all parameters are configured based on your WPPConnect Server and JIVAS deployment requirements.
- Webhook URL: The
webhook_urlmust be a publicly accessible endpoint to enable event-driven communication from WPPConnect. - Auto Callback: This when sending or broadcasting messages in batches, this action will trigger your supplied callback upon completion.
- Validation: Validate your API keys, tokens, and webhook URLs before deploying in production.
- Chunk Length: Adjust
chunk_lengthif you have use cases that involve very long text messages. - Message Filtering: Use
ignore_newslettersandignore_forwardsto filter out less relevant messages and avoid unnecessary processing.
These guidelines help optimize performance and ensure compliance with WhatsApp's messaging policies.
Endpoint: /action/walker/wppconnect_action/broadcast_message
Method: POST
{
"agent_id": "<AGENT_ID>",
"module_root": "actions.jivas.wppconnect_action",
"args": {
"message": {
"message_type": "TEXT|MEDIA|MULTI",
...
},
"ignore_list": ["session_id_1", ...]
}
}Endpoint: /action/walker/wppconnect_action/send_messages
Method: POST
{
"agent_id": "<AGENT_ID>",
"module_root": "actions.jivas.wppconnect_action",
"args": {
"messages": [
// Array of message objects
],
"callback_url": "https://your-callback.url"
}
}{
"messages": [
{
"to": "session_id",
"message": {
"message_type": "TEXT",
"content": "Batch message"
}
}
],
"callback_url": "https://example.com/status"
}Returns a job ID string for tracking.
Your callback will receive a JSON payload with the following structure automatically upon job completion:
{
"status": "success|partial|error",
"job_id": "<UUID>",
"processed_count": 10,
"failed_count": 2,
"pending_count": 0
}{
"message": {
"message_type": "TEXT",
"content": "Hello World"
}
}{
"message": {
"message_type": "MEDIA",
"mime": "image/jpeg",
"content": "Check this!",
"data": {
"url": "https://example.com/image.jpg",
"file_name": "image.jpg"
}
}
}{
"message": {
"message_type": "MEDIA",
"mime": "jivas/poll",
"data": {
"name": "What's your favorite color?",
"choices": ["Red", "Green", "Blue"],
"options": {"selectableCount": 1},
"duration_minutes": 1440,
"id": "color_poll_q1"
}
}
}{
"message": {
"message_type": "MULTI",
"content": [
// Array of TEXT/MEDIA messages
]
}
}- π Report Issues: Submit bugs found or log feature requests for the
wppconnect_actionproject. - π‘ Submit Pull Requests: Review open PRs, and submit your own PRs.
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your GitHub account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/TrueSelph/wppconnect_action
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.' - Push to GitHub: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
This project is protected under the Apache License 2.0. See LICENSE for more information.