SmileAPI icon

SmileAPI

Interact with SmileAPI WhatsApp

Actions6

Overview

This node integrates with SmileAPI to send WhatsApp messages through a specified WhatsApp instance. It supports sending various types of messages including text, media (images, audio, video, documents, stickers), location data, contact cards, and reactions (emojis) to existing messages.

Common scenarios for this node include automating customer notifications, sending multimedia marketing content, sharing locations or contacts, and reacting to incoming messages in WhatsApp workflows.

For example:

  • Sending a text message alert to a customer.
  • Sharing an image or document via WhatsApp automatically.
  • Sending a location pin to guide users.
  • Reacting with an emoji to acknowledge receipt of a message.

Properties

Name Meaning
Phone Number ID The phone number ID of the WhatsApp instance used to send the message.
Bearer Token Your SmileAPI Bearer Token for authenticating API requests.
Message Type The type of message to send. Options: Audio, Contacts, Document, Image, Location, Reaction, Sticker, Text, Video.
To (Phone Number) Recipient's phone number in international format (e.g., 5511999999999).

Additional properties depending on Message Type:

  • Text

    • Message Text: The text content of the message.
  • Image, Document, Audio, Video, Sticker

    • Media URL: URL of the media file to send.
    • Caption (optional for Image, Document, Video): Text caption for the media.
    • Filename (required for Document): Name of the document file.
  • Location

    • Latitude: Latitude coordinate of the location.
    • Longitude: Longitude coordinate of the location.
    • Location Name (optional): Name/title of the location.
    • Address (optional): Address description of the location.
  • Contacts

    • Formatted Name: Full formatted name of the contact.
    • Phone Number: Contact's phone number with country code.
    • Phone Type: Type of phone number; options are Home or Work.
  • Reaction

    • Message ID: ID of the message to react to.
    • Emoji: Emoji character to use as reaction (default is 👍).

Output

The node outputs JSON data representing the response from the SmileAPI after attempting to send the message. This typically includes details about the sent message or any error information if the request failed.

No binary data output is produced by this node.

Example output JSON structure (simplified):

{
  "messages": [
    {
      "id": "message-id",
      "status": "sent",
      "to": "5511999999999",
      "type": "text",
      "text": {
        "body": "Hello World"
      }
    }
  ]
}

Dependencies

  • Requires a valid SmileAPI account and an associated WhatsApp instance.
  • Requires a SmileAPI Bearer Token for authentication.
  • Network access to https://api.smileapi.com.br to perform API calls.
  • n8n credentials must be configured with the SmileAPI Bearer Token.

Troubleshooting

  • Invalid Bearer Token: If authentication fails, verify that the Bearer Token is correct and has not expired.
  • Incorrect Phone Number ID: Ensure the phone number ID corresponds to an active WhatsApp instance in SmileAPI.
  • Unsupported Message Type Error: Occurs if an unsupported message type is selected; verify the message type property.
  • Missing Required Fields: Each message type requires specific fields (e.g., mediaUrl for images); ensure all required inputs are provided.
  • Network Errors: Check internet connectivity and API endpoint availability.
  • JSON Parsing Errors: Rare but may occur if the API returns malformed responses; retry or check API status.

Links and References

Discussion