DinastiAPI AI icon

DinastiAPI AI

Send WhatsApp messages using DinastiAPI - optimized for AI workflows

Overview

The node "DinastiAPI AI" integrates with the DinastiAPI service to interact with WhatsApp messaging and user data. Specifically, the Get Avatar operation allows users to download profile pictures (avatars) from WhatsApp entities such as individual users, groups, newsletters, or LIDs. It supports fetching either a thumbnail preview or the full avatar image.

This operation is useful in scenarios where you want to display or process WhatsApp profile pictures within your workflows, for example:

  • Displaying user avatars in a CRM system.
  • Archiving group or newsletter profile images.
  • Using avatars as part of an AI analysis or chatbot response.

You can also choose to save the avatar image as binary data within the workflow for further processing or storage.

Properties

Name Meaning
Target The identifier to get the avatar from. Can be a phone number, Group ID (@g.us), Newsletter ID (@newsletter), or LID (@lid).
Preview Boolean flag to specify whether to retrieve a thumbnail preview (true) or the full picture (false).
Save as Binary Boolean flag indicating whether to save the avatar image as binary data in the output.
Binary Property Name The name of the binary property where the avatar image will be stored if "Save as Binary" is enabled. Defaults to "avatar".
Optimize Response (Tool mode only) Whether to optimize the API response to reduce token usage and improve AI processing.
Max Response Length (Tool mode only) Maximum number of characters in the response; longer responses will be truncated.
Include Only Essential Fields (Tool mode only) Whether to include only essential fields in the response to reduce noise.
Response Format (Tool mode only) How to format the response for optimal AI agent understanding. Options are: Optimized (clean, structured), Raw (complete raw API response), or Summary (brief key info).

Output

  • The main output is a JSON object containing the API response with avatar information.
  • If "Save as Binary" is enabled and an avatar URL is available, the node downloads the avatar image and outputs it as binary data under the specified binary property name. This binary data includes:
    • Base64-encoded image data.
    • MIME type (typically image/jpeg).
    • A generated filename based on the target identifier.
  • If no avatar is found or the user has no avatar, the JSON output will contain an error message indicating this.
  • When tool mode optimizations are enabled, the response may be truncated or simplified to improve AI processing efficiency.

Dependencies

  • Requires an active connection to the DinastiAPI service with a valid API authentication credential.
  • The node uses HTTP requests to the DinastiAPI endpoints to fetch avatar data and optionally download the avatar image.
  • No additional environment variables are explicitly required beyond the API credential configuration.

Troubleshooting

  • Binary Property Not Found Error: If you select to use binary data but the specified binary property does not exist in the input, the node will throw an error like Binary property "X" not found. Ensure that the binary property name matches the actual binary data property from previous nodes.
  • No Avatar Found: If the target user or group has no avatar, the node returns a JSON error message stating "No avatar found or user has no avatar".
  • Invalid Target Format: The target must be a valid phone number or ID string. Incorrect formatting may cause the API request to fail.
  • API Request Failures: Network issues or invalid API credentials will cause errors. Verify your API key and network connectivity.
  • Large Responses in Tool Mode: When optimizing responses for AI, large datasets are truncated to avoid excessive token usage. This is expected behavior.

Links and References

  • DinastiAPI GitHub Repository – Official documentation and source code for the DinastiAPI service.
  • WhatsApp Identifiers:
    • Phone numbers in international format without +.
    • Group IDs end with @g.us.
    • Newsletter IDs end with @newsletter.
    • LID identifiers end with @lid.

This summary covers the static analysis of the execute() method for the "Get Avatar" operation of the DinastiAPI AI node, focusing on its inputs, outputs, and behavior.

Discussion