Skip to content

Send WhatsApp Message

Summary

  • Internal name: SendWhatsAppMessage
  • Category: App Automation
  • Purpose: Send a message through the WhatsApp app (automates the app itself - WhatsApp has no accessible API for a personal account).
  • Task type: Normal

Description

This task opens WhatsApp with the recipient and message already filled in, using the official WhatsApp "click to chat" link (https://api.whatsapp.com/send?phone=...&text=...), then taps the Send button via the accessibility service.

The Send button is located with two selectors tried in order:

  1. A technical resourceId (com.whatsapp:id/send) - language-independent.
  2. If that fails, the localized button label (R.string.whatsapp_send_button_label, e.g. "Send" / "Envoyer") resolved automatically by Android based on the device's system language.

Before attempting anything, the task checks that WhatsApp is actually installed and throws PACKAGE-MANAGER-ERROR-001 immediately if not (instead of crashing on the intent).

This automates a personal account - it is not the official WhatsApp Business Platform API. Sending too fast or too often exposes the number to a ban by Meta. Keep sending rates reasonable for real campaigns.


Input parameters

Parameter Type Required Description Default
SendWhatsAppMessage_msisdn String Yes Recipient phone number, international format without + (e.g. 21624444943) - supports $variable ""
SendWhatsAppMessage_message String Yes Message body to send - supports $variable ""

Output parameters

This task produces no output variables. It returns VoidResult.


Exceptions

Code Exception Name Description
PACKAGE-MANAGER-ERROR-001 Package Not Found WhatsApp (com.whatsapp) is not installed on the device.
SCREEN-AUTOMATOR-ERROR-010 Accessibility Service Not Connected The AndroMate accessibility service is not enabled on the device.
SCREEN-AUTOMATOR-ERROR-011 Action Failed The Send button could not be found/clicked (resourceId and localized label both failed) - usually means the app's UI changed, or the device language isn't yet covered by AndroMate's translations.

Example

{
  "SendWhatsAppMessage": [
    {
      "id": "1",
      "title": "Send promo message",
      "SendWhatsAppMessage_msisdn": "21624444943",
      "SendWhatsAppMessage_message": "Hello from AndroMate!"
    }
  ]
}