Perfex CRM

Interagir com o Perfex CRM via WON API

Overview

This node integrates with the Perfex CRM system via the WON API, allowing users to manage various resources such as clients, contacts, leads, projects, tasks, and invoices. Specifically, for the Fatura (Invoice) resource with the Criar (Create) operation, the node enables creating a new invoice record in the Perfex CRM.

Typical use cases include automating invoice creation based on data from other systems or workflows, such as generating invoices after a sale is completed or when a project milestone is reached. For example, you can use this node to create an invoice with details like client ID, invoice number, dates, currency, totals, status, related project, and line items.

Properties

Name Meaning
Dados da Fatura Collection of fields representing the invoice data to be created:
- ID do Cliente The ID of the client to whom the invoice belongs
- Número Invoice number
- Data Invoice date (format YYYY-MM-DD)
- Data de Vencimento Due date of the invoice (format YYYY-MM-DD)
- Moeda Currency ID used for the invoice
- Subtotal Subtotal amount of the invoice
- Total Total amount of the invoice
- Status Status ID of the invoice
- ID do Projeto Project ID associated with the invoice
- Itens JSON string representing the invoice items (line items), must be valid JSON array

Output

The node outputs JSON data representing the response from the Perfex CRM API after creating the invoice. This typically includes all details of the newly created invoice as returned by the API, such as its unique ID, timestamps, and any computed fields.

No binary data output is produced by this node.

Example output structure (simplified):

{
  "id": "123",
  "clientid": "456",
  "number": "INV-2024-001",
  "date": "2024-06-01",
  "duedate": "2024-06-15",
  "currency": 1,
  "subtotal": 1000,
  "total": 1100,
  "status": 2,
  "project_id": "789",
  "items": [
    {
      "description": "Service A",
      "quantity": 1,
      "rate": 1000
    }
  ],
  ...
}

Dependencies

  • Requires an API token credential for authenticating with the Perfex CRM WON API.
  • The node uses Axios HTTP client internally to communicate with the API endpoint.
  • The base URL and API token must be configured in the node credentials.
  • The API expects dates in YYYY-MM-DD format and JSON strings for complex fields like invoice items.

Troubleshooting

  • Invalid JSON in Items: If the "Itens" field contains invalid JSON, the node will throw an error stating "Items deve ser um JSON válido". Ensure the JSON string is correctly formatted.
  • Date Format Errors: Dates must be in YYYY-MM-DD format. Otherwise, errors like "Data deve estar no formato YYYY-MM-DD" or "Data de vencimento deve estar no formato YYYY-MM-DD" will occur.
  • Authentication Errors: If the API token is missing or invalid, the node throws "Erro de autenticação: Token inválido ou não fornecido".
  • Resource Not Found: If the referenced client, project, or other linked entities do not exist, a "Recurso não encontrado" error may appear.
  • Invalid Data: The API may return validation errors with messages starting with "Dados inválidos", indicating required fields are missing or have incorrect values.
  • Connection Issues: Network problems result in "Erro de conexão com o servidor".

To resolve these issues:

  • Validate JSON syntax before inputting it.
  • Use correct date formats.
  • Verify API token and permissions.
  • Confirm that referenced IDs exist in the CRM.
  • Check network connectivity.

Links and References


This summary focuses on the "Fatura" resource with the "Criar" operation as requested.

Discussion