Magnet Customer icon

Magnet Customer

Consume Magnet Customer API

Overview

This node integrates with the Magnet Customer API to update lead records in a CRM system. It allows users to modify various details of an existing lead, such as contact information, demographics, address, and custom fields. This is useful for keeping lead data current and accurate, which can improve sales and marketing efforts.

Common scenarios include:

  • Updating lead contact details after receiving new information.
  • Correcting or enriching lead demographic data like gender or birthdate.
  • Adding or modifying custom fields specific to business needs.
  • Changing lead lifecycle status or source metadata.

For example, a sales team could use this node to update a lead's phone numbers and email after a call, ensuring the CRM reflects the latest contact info.

Properties

Name Meaning
Authentication Method to authenticate API requests: either "API Token" or "OAuth2".
Contact ID (leadId) The unique identifier of the lead record to update.
Fullname The full name of the lead contact.
E-Mail The email address of the lead contact.
Phones (phoneCollection) A collection of phone numbers to associate with the lead. Multiple phone entries can be added, each with a number string.
Gender The gender of the contact. Options are "Male" (M) or "Woman" (F).
Birthdate The birthdate of the contact, specified as a date/time.
Work The work or occupation of the contact.
Marital Status The marital status of the contact.
Document (CPF/CNPJ) The document number of the contact, e.g., CPF or CNPJ identifiers.
Legal Type The legal type of the contact: "Physical" or "Legal".
State The state where the contact resides.
City The city where the contact resides.
Address The street address of the contact.
Address Number The number portion of the address.
Complement Address Additional address information, such as apartment or suite number.
Neighborhood The neighborhood of the contact.
CEP The postal code (CEP) of the contact.
Owners The owners associated with the contact.
Custom Fields (customFieldCollection) A collection of custom fields to set on the lead. Each custom field requires a property name or ID and a value. This allows setting additional data not predefined in the standard fields.
Encode Custom Fields Boolean flag indicating whether custom fields should be automatically encoded from names/values to their corresponding IDs. Useful when the API expects IDs instead of names for custom fields and options.

Note: Several hidden properties related to life cycle and source are preset internally and not exposed for user input.

Output

The node outputs JSON data representing the updated lead record(s) returned by the Magnet Customer API. The structure typically includes all lead fields after the update, reflecting the new values.

If multiple leads are processed, the output is an array of JSON objects, each corresponding to one lead update result.

No binary data output is produced by this node.

Dependencies

  • Requires access to the Magnet Customer API.
  • Requires authentication via either an API token or OAuth2 credentials configured in n8n.
  • The node uses internal helper functions to make HTTP requests to the API endpoints.
  • Custom fields require loading available custom field definitions from the API to map names to IDs if encoding is enabled.

Troubleshooting

  • Invalid Lead ID: If the provided lead ID does not exist, the API will return an error. Verify the lead ID is correct.
  • Authentication Errors: Ensure that the API token or OAuth2 credentials are valid and have sufficient permissions.
  • Custom Field Encoding Issues: If custom fields are not encoded properly, the API may reject the request. Enable "Encode Custom Fields" if you want automatic conversion from names to IDs.
  • Missing Required Fields: Some fields like fullname and leadId are required; omitting them will cause errors.
  • API Rate Limits: Frequent updates may hit API rate limits; handle errors accordingly or add delays.

Links and References

Discussion