> ## 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.

# Dinamize as a data source

> Bring data from Dinamize to Nekt.

Dinamize is an email marketing platform that provides comprehensive tools for managing email campaigns, contact lists, and marketing automation. It enables businesses to create, send, and track email campaigns, manage subscriber lists, segment contacts, and analyze marketing performance through detailed transaction and engagement data.

## Configuring Dinamize 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 Dinamize option from the list of connectors.

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

### 1. Add account access

You'll need to provide your Dinamize credentials to access your data.

The following configurations are required:

* **User**: Your Dinamize username (Nome do usuário)
* **Password**: Your Dinamize password (Senha do usuário)
* **Client Code**: Your Dinamize client code (Código do cliente)

The following configuration is optional:

* **Start Date**: (Optional) The earliest date from which records will be synced. If not provided, all available data will be synced. This is particularly useful for streams with replication keys to limit the initial sync window.

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.

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**: you can choose between INCREMENTAL and FULL\_TABLE.
  * Incremental: every time the extraction happens, we'll get only the new data - which is good if, for example, you want to keep every record ever fetched.
  * Full table: every time the extraction happens, we'll get the current state of the data - which is good if, for example, you don't want to have deleted data in your catalog.

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/runs/scheduling-and-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.

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 Dinamize and their corresponding fields:

<AccordionGroup>
  <Accordion title="Contacts">
    Stream for managing contact information, including email addresses, names, custom fields, and contact preferences.

    **Identifiers:**

    * `code` - Unique identifier for the contact (primary key)
    * `external_code` - External code of the contact

    **Contact Information:**

    * `email` - Contact email address
    * `name` - Contact name
    * `custom_fields` - Custom fields object (cmp4, cmp5, cmp6...)

    **Dates:**

    * `insert_date` - Registration date (replication key)
    * `rest_date` - Rest date (contacts will not receive emails until the end of the specified day)
  </Accordion>

  <Accordion title="Contact Lists">
    Stream for managing contact lists, which group contacts for campaign targeting and segmentation.

    **Identifiers:**

    * `code` - Unique identifier for the contact list (primary key)
    * `user_code` - User code of the contact list owner

    **List Information:**

    * `title` - Contact list title
    * `type` - Key field for duplicate verification - EM (email) | CE (external code)
    * `status` - Contact list status - LI (released) | EA (under review) | BL (blocked)

    **Metrics:**

    * `total_contacts` - Total number of contacts
    * `total_valid` - Total number of valid contacts

    **Dates:**

    * `insert_date` - Registration date (replication key)
    * `rest_date` - Rest date (contacts in the list will not receive emails until the end of the specified day)
  </Accordion>

  <Accordion title="Actions">
    Stream for managing email sends (envios), including campaign dispatches, scheduling, and send statistics.

    **Identifiers:**

    * `code` - Unique identifier for the send (primary key)
    * `campaign_code` - Campaign code
    * `contact-list_code` - Contact list code
    * `contact-list_title` - Contact list title
    * `filter_code` - Filter code
    * `message_code` - Message code

    **Send Information:**

    * `title` - Send title
    * `subject` - Email subject
    * `sender_name` - Sender name
    * `sender_email` - Sender email
    * `reply_to` - Reply-to email
    * `message_type` - Message type (CAD, URL)
    * `url` - Message URL (if send type is 'URL')
    * `action_mark` - Verification code to confirm 'URL'
    * `action_type` - Send type (PT - Point, IC - Incremental)
    * `status` - Send status (PD - Pending, AG - Scheduled, EN - Sending, EP - Partially sending, FN - Finished)

    **Metrics:**

    * `total_contacts` - Total contacts separated for the send
    * `total_sent` - Total sent

    **Dates:**

    * `date_create` - Registration date (replication key)
    * `date_start` - Start date
    * `date_end` - End date
  </Accordion>

  <Accordion title="Campaigns">
    Stream for managing email marketing campaigns.

    **Identifiers:**

    * `code` - Unique identifier for the campaign (primary key)

    **Campaign Information:**

    * `title` - Campaign title

    **Dates:**

    * `insert_date` - Registration date (replication key)
  </Accordion>

  <Accordion title="Messages">
    Stream for managing email message templates and content.

    **Identifiers:**

    * `code` - Unique identifier for the message (primary key)

    **Message Information:**

    * `title` - Message title

    **Dates:**

    * `insert_date` - Registration date (replication key)
  </Accordion>

  <Accordion title="Transactions">
    Stream for tracking consumption/usage transactions, providing billing and usage data for email sends and platform usage.

    **Identifiers:**

    * `action_code` - Send code (part of composite primary key)
    * `dt_transaction` - Transaction date (part of composite primary key, replication key)

    **Transaction Information:**

    * `description` - Consumption description
    * `value` - Transaction value
  </Accordion>

  <Accordion title="Fields">
    Stream for managing custom fields that can be associated with contacts for segmentation and personalization.

    **Identifiers:**

    * `code` - Unique identifier for the field (primary key)
    * `code_name` - Internal name for reference in other API calls
    * `field-group_code` - Field group code
    * `field-group_name` - Field group title

    **Field Information:**

    * `title` - Field title
    * `type` - Field type (LV - List of Values, DH - Date/time, DT - Date, VC - Short text, TXT - Long text, INT - Integer, FLT - Decimal, PHN - Phone number, DVC - Application token)
    * `is_required` - Whether the field is required
    * `is_uniquevalue` - For 'List of Values' type fields, whether it's unique (true) or multiple (false)
    * `is_searchable` - Field applicability

    **Dates:**

    * `insert_date` - Registration date (replication key)
  </Accordion>

  <Accordion title="Field Groups">
    Stream for managing field groups that organize custom fields into logical categories.

    **Identifiers:**

    * `code` - Unique identifier for the field group (primary key)

    **Group Information:**

    * `title` - Field group title

    **Dates:**

    * `insert_date` - Registration date (replication key)
  </Accordion>

  <Accordion title="Filters">
    Stream for managing segmentation filters used to create dynamic contact lists and target specific contact groups.

    **Identifiers:**

    * `code` - Unique identifier for the filter (primary key)

    **Filter Information:**

    * `title` - Filter title
    * `type` - Operator between rules (AND, OR)

    **Dates:**

    * `insert_date` - Registration date (replication key)
  </Accordion>

  <Accordion title="List of Values">
    Stream for managing predefined value lists used in fields of type "List of Values".

    **Identifiers:**

    * `code` - Unique identifier for the value in the list of values (primary key)

    **Value Information:**

    * `value` - The value
  </Accordion>

  <Accordion title="Optout Emails">
    Stream for tracking email opt-outs and unsubscribes, including the reason and origin of the opt-out request.

    **Identifiers:**

    * `email` - Contact email (primary key)

    **Optout Information:**

    * `reason_description` - Opt-out reason
    * `origin` - Opt-out origin (C - Manually included, P - Requested by email owner, D - Spam complaint)

    **Dates:**

    * `request_date` - Opt-out request date (replication key)
  </Accordion>

  <Accordion title="Users">
    Stream for managing user accounts and user information.

    **Identifiers:**

    * `code` - Unique identifier for the user (primary key)

    **User Information:**

    * `email` - User email
    * `name` - User name
    * `language` - Language
    * `timezone` - Timezone

    **Dates:**

    * `insert_date` - Registration date (replication key)
  </Accordion>

  <Accordion title="Teams">
    Stream for managing teams and organizational hierarchy.

    **Identifiers:**

    * `code` - Unique identifier for the team (primary key)
    * `top_team` - Parent team code

    **Team Information:**

    * `name` - Team name
  </Accordion>
</AccordionGroup>

# Use Cases for Data Analysis

This guide outlines valuable business intelligence use cases when consolidating Dinamize data, along with ready-to-use SQL queries that you can run on [Explorer](https://app.nekt.ai/explorer).

### 1. Campaign Performance Overview

Analyze email campaign performance by tracking send statistics, delivery rates, and engagement metrics across all campaigns.

**Business Value:**

* Identify which campaigns have the highest delivery rates
* Track send volumes over time
* Monitor campaign status distribution
* Analyze send patterns by campaign type

<Accordion title="SQL query">
  <Tabs>
    <Tab title="AWS">
      ```sql theme={null}
      SELECT
         a.campaign_code,
         a.title AS action_title,
         a.action_type,
         a.status,
         a.contact-list_title,
         CAST(a.total_contacts AS INTEGER) AS total_contacts,
         CAST(a.total_sent AS INTEGER) AS total_sent,
         CASE 
            WHEN CAST(a.total_contacts AS INTEGER) > 0 
            THEN CAST(a.total_sent AS INTEGER) * 100.0 / CAST(a.total_contacts AS INTEGER)
            ELSE 0 
         END AS send_rate,
         a.date_create,
         a.date_start,
         a.date_end
      FROM
         nekt_raw.dinamize_actions a
      WHERE
         a.date_create >= CURRENT_DATE - INTERVAL '30' DAY
      ORDER BY
         a.date_create DESC
      ```
    </Tab>

    <Tab title="GCP">
      ```sql theme={null}
      SELECT
         a.campaign_code,
         a.title AS action_title,
         a.action_type,
         a.status,
         a.contact-list_title,
         CAST(a.total_contacts AS INT64) AS total_contacts,
         CAST(a.total_sent AS INT64) AS total_sent,
         SAFE_DIVIDE(
            CAST(a.total_sent AS INT64),
            CAST(a.total_contacts AS INT64)
         ) * 100 AS send_rate,
         a.date_create,
         a.date_start,
         a.date_end
      FROM
         `nekt_raw.dinamize_actions` a
      WHERE
         DATE(a.date_create) >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
      ORDER BY
         a.date_create DESC
      ```
    </Tab>
  </Tabs>
</Accordion>

<Accordion title="Sample Result">
  | campaign\_code | action\_title      | action\_type | status | contact-list\_title    | total\_contacts | total\_sent | send\_rate | date\_create        | date\_start         | date\_end           |
  | -------------- | ------------------ | ------------ | ------ | ---------------------- | --------------- | ----------- | ---------- | ------------------- | ------------------- | ------------------- |
  | CAM001         | Welcome Campaign   | PT           | FN     | Newsletter Subscribers | 1000            | 985         | 98.5       | 2024-11-15 10:00:00 | 2024-11-15 10:00:00 | 2024-11-15 12:00:00 |
  | CAM002         | Monthly Newsletter | IC           | EN     | Customer Base          | 5000            | 3200        | 64.0       | 2024-11-20 08:00:00 | 2024-11-20 08:00:00 | NULL                |
</Accordion>

### 2. Contact List Analysis

Analyze contact list health, growth, and composition to understand your subscriber base.

**Business Value:**

* Track contact list growth over time
* Monitor list status and health
* Identify lists with high valid contact rates
* Understand list ownership and distribution

<Accordion title="SQL query">
  <Tabs>
    <Tab title="AWS">
      ```sql theme={null}
      SELECT
         cl.code,
         cl.title,
         cl.type,
         cl.status,
         cl.user_code,
         CAST(cl.total_contacts AS INTEGER) AS total_contacts,
         CAST(cl.total_valid AS INTEGER) AS total_valid,
         CASE 
            WHEN CAST(cl.total_contacts AS INTEGER) > 0 
            THEN CAST(cl.total_valid AS INTEGER) * 100.0 / CAST(cl.total_contacts AS INTEGER)
            ELSE 0 
         END AS validity_rate,
         cl.insert_date,
         u.name AS owner_name
      FROM
         nekt_raw.dinamize_contact_lists cl
         LEFT JOIN nekt_raw.dinamize_users u ON cl.user_code = u.code
      WHERE
         cl.status = 'LI'
      ORDER BY
         CAST(cl.total_contacts AS INTEGER) DESC
      ```
    </Tab>

    <Tab title="GCP">
      ```sql theme={null}
      SELECT
         cl.code,
         cl.title,
         cl.type,
         cl.status,
         cl.user_code,
         CAST(cl.total_contacts AS INT64) AS total_contacts,
         CAST(cl.total_valid AS INT64) AS total_valid,
         SAFE_DIVIDE(
            CAST(cl.total_valid AS INT64),
            CAST(cl.total_contacts AS INT64)
         ) * 100 AS validity_rate,
         cl.insert_date,
         u.name AS owner_name
      FROM
         `nekt_raw.dinamize_contact_lists` cl
         LEFT JOIN `nekt_raw.dinamize_users` u ON cl.user_code = u.code
      WHERE
         cl.status = 'LI'
      ORDER BY
         CAST(cl.total_contacts AS INT64) DESC
      ```
    </Tab>
  </Tabs>
</Accordion>

<Accordion title="Sample Result">
  | code    | title                  | type | status | user\_code | total\_contacts | total\_valid | validity\_rate | insert\_date        | owner\_name  |
  | ------- | ---------------------- | ---- | ------ | ---------- | --------------- | ------------ | -------------- | ------------------- | ------------ |
  | LIST001 | Newsletter Subscribers | EM   | LI     | USR001     | 5000            | 4850         | 97.0           | 2024-01-15 10:00:00 | João Silva   |
  | LIST002 | Customer Base          | CE   | LI     | USR002     | 3200            | 3100         | 96.9           | 2024-02-20 14:30:00 | Maria Santos |
</Accordion>

### 3. Transaction and Consumption Analysis

Analyze platform usage and consumption patterns to understand costs and usage trends.

**Business Value:**

* Track platform usage and consumption over time
* Identify high-consumption periods
* Monitor transaction values and trends
* Correlate usage with campaign activity

<Accordion title="SQL query">
  <Tabs>
    <Tab title="AWS">
      ```sql theme={null}
      SELECT
         DATE(t.dt_transaction) AS transaction_date,
         COUNT(*) AS transaction_count,
         SUM(CAST(t.value AS DECIMAL(10,2))) AS total_value,
         AVG(CAST(t.value AS DECIMAL(10,2))) AS avg_value,
         COUNT(DISTINCT t.action_code) AS unique_actions
      FROM
         nekt_raw.dinamize_transactions t
      WHERE
         DATE(t.dt_transaction) >= CURRENT_DATE - INTERVAL '30' DAY
      GROUP BY
         DATE(t.dt_transaction)
      ORDER BY
         transaction_date DESC
      ```
    </Tab>

    <Tab title="GCP">
      ```sql theme={null}
      SELECT
         DATE(t.dt_transaction) AS transaction_date,
         COUNT(*) AS transaction_count,
         SUM(CAST(t.value AS FLOAT64)) AS total_value,
         AVG(CAST(t.value AS FLOAT64)) AS avg_value,
         COUNT(DISTINCT t.action_code) AS unique_actions
      FROM
         `nekt_raw.dinamize_transactions` t
      WHERE
         DATE(t.dt_transaction) >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
      GROUP BY
         DATE(t.dt_transaction)
      ORDER BY
         transaction_date DESC
      ```
    </Tab>
  </Tabs>
</Accordion>

<Accordion title="Sample Result">
  | transaction\_date | transaction\_count | total\_value | avg\_value | unique\_actions |
  | ----------------- | ------------------ | ------------ | ---------- | --------------- |
  | 2024-11-27        | 45                 | 1250.50      | 27.79      | 12              |
  | 2024-11-26        | 38                 | 980.00       | 25.79      | 10              |
  | 2024-11-25        | 52                 | 1450.75      | 27.90      | 15              |
</Accordion>

### 4. Opt-out Analysis

Track and analyze email opt-outs to understand subscriber churn and identify patterns in unsubscribes.

**Business Value:**

* Monitor opt-out trends over time
* Identify common opt-out reasons
* Track opt-out origins (manual, user request, spam complaint)
* Correlate opt-outs with campaign sends

<Accordion title="SQL query">
  <Tabs>
    <Tab title="AWS">
      ```sql theme={null}
      SELECT
         DATE(o.request_date) AS optout_date,
         o.origin,
         o.reason_description,
         COUNT(*) AS optout_count,
         COUNT(DISTINCT o.email) AS unique_emails
      FROM
         nekt_raw.dinamize_optout_emails o
      WHERE
         DATE(o.request_date) >= CURRENT_DATE - INTERVAL '30' DAY
      GROUP BY
         DATE(o.request_date),
         o.origin,
         o.reason_description
      ORDER BY
         optout_date DESC,
         optout_count DESC
      ```
    </Tab>

    <Tab title="GCP">
      ```sql theme={null}
      SELECT
         DATE(o.request_date) AS optout_date,
         o.origin,
         o.reason_description,
         COUNT(*) AS optout_count,
         COUNT(DISTINCT o.email) AS unique_emails
      FROM
         `nekt_raw.dinamize_optout_emails` o
      WHERE
         DATE(o.request_date) >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
      GROUP BY
         DATE(o.request_date),
         o.origin,
         o.reason_description
      ORDER BY
         optout_date DESC,
         optout_count DESC
      ```
    </Tab>
  </Tabs>
</Accordion>

## Implementation Notes

### Data Quality Considerations

* Most streams use incremental replication based on date fields (`insert_date`, `date_create`, `dt_transaction`, `request_date`)
* The `start_date` configuration parameter can be used to limit the initial sync window for streams with replication keys
* Some fields like `total_contacts`, `total_sent`, and `value` are stored as strings and may need casting to numeric types in queries
* The `custom_fields` field in contacts is an object type and may contain dynamic fields (cmp4, cmp5, cmp6, etc.)
* Contact lists and contacts support a `rest_date` field that prevents emails from being sent until the end of the specified day

### API Limits & Performance

* The API uses POST requests with pagination
* Rate limiting is handled automatically with retry logic (error code 240024)
* For faster extractions, select only the streams necessary for your analysis
* Streams with replication keys (incremental sync) will only fetch new records since the last sync or the configured start date
* The `teams` and `list_of_values` streams are full table syncs (no replication key)

## Skills for agents

<Snippet file="agent-skills-intro.mdx" />

<Card title="Download Dinamize skills file" icon="wand-magic-sparkles" href="/sources/dinamize.md">
  Dinamize connector documentation as plain markdown, for use in AI agent contexts.
</Card>
