See llms.txt for all machine-readable content.

Back to Templates

Onboard Brazilian suppliers by CNPJ with Google Forms, BrasilAPI and Gmail

Quick overview

This workflow monitors a Google Forms response sheet to validate and look up Brazilian supplier CNPJs via BrasilAPI, assigns a risk score, and then approves, rejects, or requests buyer approval by Gmail while maintaining approved and rejected supplier logs in Google Sheets.

How it works

  1. Triggers when a new row is added to the Google Sheets spreadsheet linked to your Google Form.
  2. Normalizes the CNPJ from the form and validates its check digits, routing invalid entries to rejection logging.
  3. Loads the existing Suppliers list from Google Sheets and stops duplicates from being processed again.
  4. Looks up the CNPJ on BrasilAPI to fetch the Receita CNPJ record, and routes 404/not-found or API failures to a manual buyer review email.
  5. Scores supplier risk from the Receita data and form inputs (for example status, company age, CNAE, MEI/Simples flags, share capital, and mismatches in name/UF/email) and categorizes the request as approved, review, or rejected.
  6. For review cases, sends a Gmail approval email to the buyer and treats no response within 3 days as a decline.
  7. Writes approved suppliers to the Suppliers sheet (append or update) and emails the requester the outcome, while rejected/duplicate/invalid cases are appended to the Rejected sheet and the requester is notified when a final decision exists.
  8. Every Monday at 07:00, rechecks active suppliers against BrasilAPI, updates their status in Google Sheets (including blocking those no longer ATIVA), and emails the buyer a summary of status changes or check failures.

Setup

  1. Connect Google Sheets Trigger and Google Sheets with access to the Google Form response spreadsheet and the supplier tracking spreadsheet.
  2. Connect a Gmail account that can send approval emails to the buyer and notifications to the requester.
  3. Replace YOUR_FORM_RESPONSES_SHEET_ID in the trigger and YOUR_SHEET_ID in all Google Sheets nodes, and ensure the target tabs are named Suppliers and Rejected with the expected header columns.
  4. Update the field mappings in the form-to-data step to match your Google Form response column names (including Timestamp and the collected requester email column).
  5. Set buyerEmail and the scoring thresholds (accepted CNAE prefixes, minimum age and capital, review and reject scores) in the Config node, replace [email protected] in the "Alert: workflow failed" and "Weekly alert: status changed" Gmail nodes, and set the workflow timezone so the Monday recheck runs at the intended local time.