NaLU AI icon

NaLU AI

Semantic data validation and extraction for chatbots using NaLU AI.

Validate CNPJ (Validate_cnpj)

AI-generated

Summary

Extracts a Brazilian CNPJ (company tax ID) from a user's chatbot reply and validates it (mod 11 check) by sending the question and reply to the NaLU AI API.

Inputs

  • agent_input (required) — The question or statement the chatbot sent to the user (e.g. asking for the company CNPJ). Gives the API context for interpreting the reply.
  • user_input (required) — The user's free-text reply, from which the CNPJ is extracted.
  • language — Conversation language: English (en), Portuguese (Brazil) (pt-BR, default), or Spanish (es).

Output shape

One output item per input item, containing the JSON response from the NaLU AI API (POST https://naluai.dev/v1/extract/cnpj), with pairedItem linking to the input item.

The exact response fields are not defined in the node source; they are passed through as returned by the API. Requires the naluAiApi credential. With Continue On Fail enabled, failed items return {error: message}; otherwise the node throws a NodeOperationError.

Examples

Example 1: Validate a CNPJ a customer typed in a chat flow.

agent_input: 'Qual o CNPJ da empresa?'; user_input: '{{ $json.message }}'; language: pt-BR.

Example 2: Handle a reply with extra text around the number.

user_input: 'Claro, o CNPJ é 11.222.333/0001-81'; the API extracts and validates the CNPJ.

Links

Discussion