> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Funil de Vendas as a data source

> Bring data from Funil de Vendas to your Lakehouse.

Funil de Vendas is a Brazilian sales CRM: teams use it to manage their sales pipelines, follow each opportunity from the first contact to the win or loss, and schedule activities such as calls, meetings and WhatsApp messages. The connector extracts the opportunities of every pipeline, with their contact, company, owner, sales channel, products, logbook and click identifiers (Facebook, Google Ads and TikTok), the activities, and the configuration lists of the account, so you can cross your sales results with your marketing data in your Lakehouse.

## Configuring Funil de Vendas as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the Funil de Vendas option from the list of connectors.

Click **Next** and you'll be prompted to add your access.

### 1. Add account access

The Funil de Vendas API signs in with the **e-mail of a Funil de Vendas user** plus either **that user's password** (the same one used at [app.funildevendas.com.br](https://app.funildevendas.com.br)) or the account's **integration key** (Configurações > Integrações, available to the administrator), which Funil de Vendas documents as an alternative for API access.

<Warning>
  The connector only sees what this user sees in the CRM. The account administrator sees every pipeline and opportunity; a manager only sees their team's, and a seller only their own. Use the administrator's login (or a dedicated user with the same visibility) so that no opportunity is left out.
</Warning>

The following configurations are available:

* **E-mail**: the e-mail of the Funil de Vendas user. Required.

* **Password or integration key**: the password of that user. Required. If Funil de Vendas does not accept the password, use the account's integration key instead. If the password is changed in Funil de Vendas, update it here too, or the next run will fail with an access error.

* **Start Date**: only opportunities **created** and activities **updated** on or after this date are extracted. We recommend setting it to the oldest date you need: Funil de Vendas can only list opportunities by creation date, so every run reads all opportunities again from this date. Leave it empty to extract the whole history (since 2010), at the cost of slower runs.

* **API time zone** (advanced): the time zone of the dates and times Funil de Vendas sends, as an IANA name. The default, `America/Sao_Paulo` (Brasília time), fits Brazilian accounts. The connector converts every date and time to UTC.

Once you're done, click **Next**.

### 2. Select streams

Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis. You can select entire groups of streams or pick specific ones.

> Tip: The stream can be found more easily by typing its name.

<Info>
  Opportunity Products and Opportunity Logbook come from the same request as Opportunities, so selecting them costs no extra extraction time.
</Info>

Select the streams and click **Next**.

### 3. Configure data streams

Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data) and the type of sync.

* **Layer**: choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
* **Folder**: a folder can be created inside the selected layer to group all tables being created from this new data source.
* **Table name**: we suggest a name, but feel free to customize it. You have the option to add a **prefix** to all tables at once and make this process faster!
* **Sync Type**: Activities supports INCREMENTAL. Every other stream is FULL\_TABLE, because Funil de Vendas can only list opportunities by creation date: each run reads all of them again, so stage changes, wins and losses of old opportunities are always up to date. Read more about Sync Types [here](https://docs.nekt.com/get-started/core-concepts/types-of-sync).

Once you are done configuring, click **Next**.

### 4. Configure data source

Describe your data source for easy identification within your organization, not exceeding 140 characters.

To define your [Trigger](https://docs.nekt.com/get-started/core-concepts/triggers), consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times).

Optionally, you can define some additional settings:

* Configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource [here](https://docs.nekt.com/get-started/core-concepts/resource-control).
* Determine when to execute an **Additional [Full Sync](https://docs.nekt.com/get-started/core-concepts/types-of-sync#additional-full-sync)**. This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while.

<Note>
  The Activities stream asks Funil de Vendas for the activities **updated** since the previous run. This filter is documented but had not been confirmed with a real account when the connector was released, and Funil de Vendas does not report deleted activities either. Check after the first runs that activities edited in the CRM show up in the table, and schedule a **weekly additional full sync** of Activities until you have confirmed it.
</Note>

Once you are ready, click **Next** to finalize the setup.

### 5. Check your new source

You can view your new source on the [Sources](https://app.nekt.ai/sources) page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.

<Warning>
  For you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you need at least one successful source run.
</Warning>

# Streams and Fields

Below you'll find all available data streams from Funil de Vendas and their corresponding fields. API reference: [Funil de Vendas APIs](https://www.funildevendas.com.br/categoria/apis/).

Funil de Vendas sends dates and times without a time zone. The connector reads them in the **API time zone** of the source (Brasília by default) and stores them in **UTC**: a sale created at 10:00 in Brasília appears as 13:00 UTC.

Good to know:

* An opportunity moved to another pipeline while a sync is running may be missing from that run's table; it is back on the next run.
* Opportunities marked to reopen in the future ("Futuras") are only listed once their date arrives.
* Logbook entries are identified by the opportunity and their position in its logbook, because Funil de Vendas does not document their code as unique.

## Sales

<AccordionGroup>
  <Accordion title="Opportunities">
    Every opportunity of every sales pipeline the configured user can see, open, won and lost, with its contact, company, owner, step, sales channel and click identifiers (`fbclid`, `gclid`, `tiktok`). Read in full on every run.

    Table: `opportunities` · Primary key: `code` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `code` | Integer | Unique code of the opportunity. |
    | `title` | String | Title of the opportunity. |
    | `status` | Integer | Status code of the opportunity: 0 = open, 1 = won, 2 = lost. |
    | `status_name` | String | Status of the opportunity as text (open, won, lost), derived from status. |
    | `answer` | String | Answer picked when the opportunity was won or lost (win or loss reason). |
    | `value` | Number | Value of the opportunity. |
    | `estimed_value` | Number | Estimated value of the opportunity (field name as spelled by the API). |
    | `created_at` | Datetime | Date and time the opportunity was created (UTC). |
    | `updated_at` | Datetime | Date and time of the last update of the opportunity (UTC). |
    | `closing_expectation` | Datetime | Expected closing date of the opportunity; null when not set. |
    | `closed_at` | Datetime | Date and time the opportunity was won or lost; null while it is open. |
    | `fbclid` | String | Facebook/Meta click identifier (fbclid) captured with the lead. |
    | `gclid` | String | Google Ads click identifier (gclid) captured with the lead. |
    | `tiktok` | String | TikTok click identifier captured with the lead. |
    | `pipeline_code` | Integer | Code of the sales pipeline (funnel) the opportunity is in. |
    | `pipeline_name` | String | Name of the sales pipeline (funnel) the opportunity is in. |
    | `step_code` | Integer | Code of the pipeline step the opportunity is in. |
    | `step_name` | String | Name of the pipeline step the opportunity is in. |
    | `sales_channel_code` | Integer | Code of the sales channel the opportunity came from. |
    | `sales_channel_name` | String | Name of the sales channel the opportunity came from (lead source). |
    | `owner_vendor_code` | Integer | Code of the user (seller) who owns the opportunity. |
    | `owner_vendor_name` | String | Name of the user (seller) who owns the opportunity. |
    | `owner_vendor_email` | String | E-mail of the user (seller) who owns the opportunity. |
    | `owner_vendor_internal_code` | String | Internal code of the owner user, when the account sets one. |
    | `shared_vendors` | String (JSON) | Users the opportunity is shared with (JSON array of objects with code and name). |
    | `contact_code` | Integer | Code of the contact (person) of the opportunity. |
    | `contact_name` | String | Name of the contact. |
    | `contact_email` | String | E-mail of the contact. |
    | `contact_phone` | String | Phone number of the contact. |
    | `contact_smartphone` | String | Mobile phone number of the contact. |
    | `contact_role` | String | Job title (role) of the contact. |
    | `contact_document` | String | CPF (Brazilian individual taxpayer number) of the contact. |
    | `contact_additional_emails` | Array of strings | Additional e-mail addresses of the contact. |
    | `contact_additional_phones` | Array of strings | Additional phone numbers of the contact. |
    | `contact_custom_fields` | String (JSON) | Custom fields of the contact (JSON object of field name to value). |
    | `company_code` | Integer | Code of the company (organization) of the contact. |
    | `company_name` | String | Name of the company. |
    | `company_segment` | String | Segment of the company. |
    | `company_document` | String | CNPJ (Brazilian company taxpayer number) of the company. |
    | `company_state_document` | String | State registration (IE) of the company. |
    | `company_address` | String | Address of the company. |
    | `company_latitude` | Number | Latitude of the company address. |
    | `company_longitude` | Number | Longitude of the company address. |
    | `company_custom_fields` | String (JSON) | Custom fields of the company (JSON object of field name to value). |
    | `products` | String (JSON) | Products of the opportunity (JSON array; also available one per row in opportunity\_products). |
    | `custom_fields` | String (JSON) | Custom fields of the opportunity (JSON object of field name to value). |
  </Accordion>

  <Accordion title="Opportunity Products">
    One row per product line of each opportunity, expanded from the opportunity data with no extra request.

    Table: `opportunity_products` · Primary key: `opportunity_code`, `position` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `opportunity_code` | Integer | Code of the opportunity the product line belongs to. |
    | `position` | Integer | Position of the product line in the opportunity, starting at 1. |
    | `code` | Integer | Code of the product. |
    | `internal_code` | String | Internal code of the product, when the account sets one. |
    | `name` | String | Name of the product. |
    | `price` | Number | Price of the product. |
    | `cost_per_unit` | Number | Cost per unit of the product. |
    | `value_per_unit` | Number | Value per unit of the product in this opportunity. |
    | `quantity` | Number | Quantity of the product in this opportunity. |
  </Accordion>

  <Accordion title="Opportunity Logbook">
    One row per logbook (diário de bordo) entry of each opportunity: notes written by users and system logs such as step changes. Expanded from the opportunity data with no extra request.

    Table: `opportunity_logbook` · Primary key: `opportunity_code`, `position` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `opportunity_code` | Integer | Code of the opportunity the entry belongs to. |
    | `position` | Integer | Position of the entry in the opportunity's logbook, starting at 1. |
    | `code` | Integer | Code of the logbook entry. |
    | `type` | Integer | Type of the entry: 1 = note written by a user, 2 = system log. |
    | `type_name` | String | Type of the entry as text (note, system\_log), derived from type. |
    | `text` | String | Content of the logbook entry. |
    | `created_at` | Datetime | Date and time the entry was created (UTC). |
  </Accordion>

  <Accordion title="Activities">
    Calls, meetings, e-mails and other activities scheduled in the CRM, linked or not to an opportunity. Each run reads the activities updated since the previous one.

    Table: `activities` · Primary key: `code` · Sync: Incremental (by `updated_at`)

    | Field | Type | Description |
    | :- | :- | :- |
    | `code` | Integer | Unique code of the activity. |
    | `opportunity_code` | Integer | Code of the opportunity the activity is linked to; null when it has none. |
    | `kind_code` | Integer | Code of the activity type (see the activity\_types stream). |
    | `kind_name` | String | Name of the activity type, when the API sends it. |
    | `title` | String | Title of the activity. |
    | `annotation` | String | Notes or description of the activity. |
    | `date` | Date | Date the activity is scheduled for. |
    | `start_time` | String | Start time of the activity (HH:mm). |
    | `end_time` | String | End time of the activity (HH:mm). |
    | `status` | Integer | Status code of the activity, as returned by the API. |
    | `created_at` | Datetime | Date and time the activity was created (UTC). |
    | `updated_at` | Datetime | Date and time of the last update of the activity (UTC), used as the incremental replication key. |
    | `owner_code` | Integer | Code of the user responsible for the activity. |
    | `owner_email` | String | E-mail of the user responsible for the activity. |
    | `file` | String (JSON) | File attached to the activity, when there is one (JSON object). |
  </Accordion>
</AccordionGroup>

## Configuration

<AccordionGroup>
  <Accordion title="Pipelines">
    Sales pipelines (funnels) visible to the configured user.

    Table: `pipelines` · Primary key: `code` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `code` | Integer | Unique code of the sales pipeline (funnel). |
    | `name` | String | Name of the sales pipeline (funnel). |
  </Accordion>

  <Accordion title="Pipeline Steps">
    Steps of each sales pipeline, in the order the pipeline shows them.

    Table: `pipeline_steps` · Primary key: `pipeline_code`, `code` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `pipeline_code` | Integer | Code of the sales pipeline the step belongs to. |
    | `code` | Integer | Unique code of the pipeline step (etapa). |
    | `name` | String | Name of the pipeline step. |
    | `position` | Integer | Position of the step in the pipeline, starting at 1, in the order the API lists them. |
  </Accordion>

  <Accordion title="Users">
    Users (sellers and managers) of the CRM.

    Table: `users` · Primary key: `code` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `code` | Integer | Unique code of the CRM user (seller / vendor). |
    | `name` | String | Name of the user in the CRM. |
    | `label` | String | Label of the user as returned by the API: the user's e-mail address. |
  </Accordion>

  <Accordion title="Sales Channels">
    Sales channels: the lead sources an opportunity can come from.

    Table: `sales_channels` · Primary key: `code` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `code` | Integer | Unique code of the sales channel. |
    | `name` | String | Name of the sales channel (lead source, e.g. GOOGLE). |
  </Accordion>

  <Accordion title="Segments">
    Company segments.

    Table: `segments` · Primary key: `code` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `code` | Integer | Unique code of the segment. |
    | `name` | String | Name of the company segment. |
  </Accordion>

  <Accordion title="Gain Responses">
    Answers that can be picked when an opportunity is marked as won.

    Table: `gain_responses` · Primary key: `code` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `code` | Integer | Unique code of the win answer. |
    | `name` | String | Text of the answer picked when an opportunity is marked as won. |
  </Accordion>

  <Accordion title="Loss Responses">
    Answers (loss reasons) that can be picked when an opportunity is marked as lost.

    Table: `loss_responses` · Primary key: `code` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `code` | Integer | Unique code of the loss answer. |
    | `name` | String | Text of the answer (loss reason) picked when an opportunity is marked as lost. |
  </Accordion>

  <Accordion title="Activity Types">
    Types of activity configured in the account, such as calls, meetings and WhatsApp.

    Table: `activity_types` · Primary key: `code` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `code` | Integer | Unique code of the activity type. |
    | `name` | String | Name of the activity type (e.g. LIGAÇÃO, REUNIÃO, WHATSAPP). |
    | `description` | String | Description of the activity type, when the API sends one. |
  </Accordion>

  <Accordion title="Custom Fields">
    Custom fields configured for contacts, companies and opportunities. Their values are in the `custom_fields` columns of Opportunities.

    Table: `custom_fields` · Primary key: `module`, `key` · Sync: Full table

    | Field | Type | Description |
    | :- | :- | :- |
    | `module` | String | Module the custom field belongs to, as named by the API: contact, enterprise (company) or opportunity. |
    | `key` | String | Name of the custom field, as it appears in the custom\_fields columns. |
    | `type` | String | Type of the field: Texto, Texto área, Número, Lista, Data, Moeda or Link. |
    | `options` | Array of strings | Allowed values when the field type is Lista (list). |
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.