MegaAPI icon

MegaAPI

Interact with MegaAPI WhatsApp service

Overview

The "Generate Pairing Code" operation under the "Instance" resource in this node interacts with the MegaAPI WhatsApp service to generate a pairing code. This pairing code is used to link or connect a WhatsApp instance (such as a phone or web client) with the MegaAPI service, enabling further WhatsApp automation and management through the API.

This operation is beneficial when setting up or initializing a new WhatsApp connection via MegaAPI, allowing users to securely pair their WhatsApp account with the service. For example, a user can input their phone number to receive a pairing code that they then use to authenticate and establish the WhatsApp session for subsequent messaging or group management operations.

Properties

Name Meaning
Phone Number The phone number including country code but without "+" sign or spaces. Example: 5561995562618
Informações An informational notice displayed in the node UI (no input required from the user).

Output

The output of this operation is a JSON object containing the generated pairing code details. This typically includes the pairing code string itself and possibly metadata such as expiration time or status. The exact structure depends on the MegaAPI response but generally provides all necessary information to complete the WhatsApp instance pairing process.

No binary data output is expected from this operation.

Dependencies

  • Requires an active MegaAPI WhatsApp service account.
  • Requires credentials configured in n8n with:
    • A host URL for the MegaAPI endpoint.
    • An API authentication token (Bearer token).
  • The node uses HTTP requests with JSON content type to communicate with the MegaAPI service.

Troubleshooting

  • Common Issues:

    • Invalid or incorrectly formatted phone number (must include country code, no "+" or spaces).
    • Expired or invalid API token leading to authorization errors.
    • Network connectivity issues preventing communication with the MegaAPI server.
    • Using an unsupported or incorrect resource/operation combination.
  • Error Messages:

    • "Unknown operation: generatePairingCode": Indicates the operation name was not recognized; ensure the correct resource and operation are selected.
    • Authorization errors usually mention invalid token or unauthorized access; verify API credentials.
    • If the node throws an error about the phone number format, check that it matches the required pattern.
  • Resolutions:

    • Double-check the phone number format.
    • Verify and update API credentials in n8n.
    • Ensure the MegaAPI service is reachable and operational.
    • Confirm the node configuration matches the intended resource and operation.

Links and References

Discussion