CodeChat - WhatsApp Free Api icon

CodeChat - WhatsApp Free Api

Rest api for communication with WhatsApp

Overview

This node enables sending interactive button messages via WhatsApp using a free WhatsApp API service. It is designed to send messages that include up to three customizable buttons, allowing recipients to interact directly within the chat interface. This functionality is useful for scenarios such as customer support, marketing campaigns, surveys, or any situation where quick user responses are needed.

For example, a business can send a message with buttons like "Confirm", "Reschedule", and "Cancel" to streamline appointment management. Another use case could be sending product options or quick replies to guide users through a decision-making process.

Properties

Name Meaning
Recipient The phone number of the message recipient, including country code (e.g., 5531900000000).
Delay Optional delay in milliseconds before sending the message (e.g., 1200 ms).
Presence Status indicator while sending the message; options: Available, Composing, Empty, Paused, Recording, Unavailable, or false (no status).
Button Title The main title text displayed on the button message (required).
Button Description A description text shown below the button title (required).
Button Footer Text Optional footer text displayed at the bottom of the button message.
Buttons JSON array defining up to three buttons, each with displayText (button label) and buttonId (identifier). Example: [{"displayText": "Yes", "buttonId": "btn1"}, {"displayText": "No", "buttonId": "btn2"}] (required).
Media Message Optional embedded media attached to the button message, including:
- Media Type Type of media: Image, Document, or Video (required if media is used).
- File Name Filename for base64-encoded files (optional).
- Media URL or base64 string of the media content (required if media is used).

Output

The node outputs a JSON object representing the response from the WhatsApp API after attempting to send the button message. This typically includes confirmation details such as message ID, status, timestamps, or error information if the request failed.

If media is included, the output confirms successful attachment and delivery metadata related to the media content.

No binary data output is indicated by the source code.

Dependencies

  • Requires an API key credential for authenticating with the WhatsApp API service.
  • The node uses a base URL configured in credentials to send HTTP POST requests to the endpoint /message/sendButtons/{instanceName}/.
  • Proper configuration of the API base URL and authentication token is necessary in n8n credentials.

Troubleshooting

  • Common Issues:

    • Invalid or missing recipient phone number format (must include country code).
    • Exceeding the maximum of three buttons will likely cause errors.
    • Incorrectly formatted JSON for the buttons array may result in request failures.
    • Missing required fields such as Button Title, Description, or Buttons array.
    • Media attachment errors if media type or content is invalid or missing.
  • Error Messages:

    • API errors returned in the response will be passed through; these might indicate authentication failure, invalid parameters, or rate limiting.
    • Network or timeout errors if the API base URL or credentials are misconfigured.
  • Resolution Tips:

    • Verify phone numbers include country codes without extra characters.
    • Ensure JSON syntax for buttons is correct and contains no more than three entries.
    • Confirm all required properties are set before execution.
    • Check API credentials and base URL settings in n8n.
    • Use the Delay property to avoid hitting rate limits if sending many messages rapidly.

Links and References

Discussion