Asaas icon

Asaas

Integração com a API do Asaas para pagamentos e cobranças

Overview

This node integrates with the Asaas API to manage webhooks, specifically allowing users to create, retrieve, update, list, and delete webhook configurations. The "Webhook - Create" operation enables setting up a webhook that listens for specific events related to payments, customers, subscriptions, transfers, and more within the Asaas platform.

Common scenarios where this node is beneficial include:

  • Automatically receiving notifications about payment status changes (e.g., payment received, overdue).
  • Tracking customer lifecycle events such as creation, updates, or deletion.
  • Monitoring subscription events like creation, cancellation, or updates.
  • Handling transfer-related events for financial reconciliation or alerting.

Practical example:

  • A business wants to automate order fulfillment when a payment is received. Using this node, they can create a webhook that triggers on the "Cobrança Recebida" (Payment Received) event, sending data to their system URL to process the order automatically.

Properties

Name Meaning
Nome * Identifier name for the webhook.
URL * The endpoint URL that will receive webhook notifications. Example: https://your-site.com/webhook.
Email * Email address to receive failure notifications related to the webhook.
Eventos * Events that trigger the webhook. Options include:
- Assinatura Atualizada (Subscription Updated)
- Assinatura Cancelada (Subscription Cancelled)
- Assinatura Criada (Subscription Created)
- Cliente Atualizado (Customer Updated)
- Cliente Criado (Customer Created)
- Cliente Removido (Customer Deleted)
- Cliente Restaurado (Customer Restored)
- Cobrança Aguardando Risco (Payment Awaiting Risk Analysis)
- Cobrança Aprovada Na Análise De Risco (Payment Approved by Risk Analysis)
- Cobrança Atualizada (Payment Updated)
- Cobrança Criada (Payment Created)
- Cobrança Recebida (Payment Received)
- Cobrança Removida (Payment Deleted)
- Cobrança Reprovada Na Análise De Risco (Payment Reproved by Risk Analysis)
- Cobrança Restaurada (Payment Restored)
- Cobrança Vencida (Payment Overdue)
- Transferência Cancelada (Transfer Cancelled)
- Transferência Criada (Transfer Created)
- Transferência Em Processamento (Transfer In Progress)
- Transferência Falhada (Transfer Failed)
- Transferência Pendente (Transfer Pending)
- Transferência Realizada (Transfer Done)
Enviar Tipo Type of webhook delivery:
- Sequencial (SEQUENTIALLY): Sends webhooks in sequence.
- Não Sequencial (NON_SEQUENTIALLY): Sends webhooks without specific order.
Versão Da API API version used for the webhook:
- Versão 2 (Version 2, older)
- Versão 3 (Version 3, current default)
Ativo Boolean flag indicating whether the webhook is active (true) or not (false).
Interromper Em Falha Boolean flag indicating whether to interrupt webhook processing on failure (true) or continue (false).
Token De Autenticação Optional authentication token sent with the webhook for security purposes.

Output

The node outputs JSON data representing the webhook object returned by the Asaas API after the create operation. This includes all configured properties of the webhook such as its ID, name, URL, subscribed events, status, and other metadata.

No binary data output is involved in this operation.

Example output JSON structure (simplified):

{
  "id": "webhook_000123456",
  "name": "My Webhook",
  "url": "https://your-site.com/webhook",
  "email": "your-email@example.com",
  "events": [
    "PAYMENT_RECEIVED",
    "SUBSCRIPTION_CREATED"
  ],
  "sendType": "SEQUENTIALLY",
  "apiVersion": 3,
  "enabled": true,
  "interrupted": false,
  "authToken": "optional-auth-token",
  "createdAt": "2024-01-01T12:00:00Z",
  "updatedAt": "2024-01-01T12:00:00Z"
}

Dependencies

  • Requires an API key credential for authenticating with the Asaas API.
  • The node uses the Asaas REST API endpoints, which differ based on environment (sandbox or production).
  • No additional external dependencies beyond standard HTTP requests.
  • Proper configuration of the API key and environment in n8n credentials is necessary.

Troubleshooting

  • Package Availability: The node checks if the npm package is available; if removed, it throws an error advising removal of the node from the installation.
  • Invalid or Missing Required Fields: Errors occur if required fields like name, url, email, or events are missing or invalid.
  • API Authentication Failures: If the API key is incorrect or missing, the request will fail with authentication errors.
  • Webhook Delivery Failures: If the target URL is unreachable or returns errors, webhook notifications may fail. The configured email receives failure alerts.
  • Event Subscription Issues: Selecting unsupported or misspelled events will cause API errors.
  • Interruption Behavior: Setting "Interromper Em Falha" to true will stop webhook processing on failure, which might halt workflows unexpectedly.

To resolve common errors:

  • Verify all required input fields are correctly filled.
  • Ensure the API key credential is valid and has proper permissions.
  • Confirm the webhook URL is accessible and responds correctly.
  • Check event names against the provided options.
  • Review email address correctness for failure notifications.

Links and References

Discussion