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

# Digisac as a data source

> Bring data from Digisac to your Lakehouse.

Digisac is a Brazilian multichannel customer-service platform that centralizes WhatsApp, Telegram, Instagram, Facebook, e-mail and other channels into a single service desk, with departments, chatbots, campaigns, satisfaction surveys and a sales funnel. The connector extracts the service history — tickets, messages and contacts — along with the account configuration and the sales funnel, so you can analyse your customer service in your Lakehouse.

Every Digisac account runs on its own address, so the connector asks for the URL of your platform in addition to the access token.

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

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

### 1. Add account access

Digisac authenticates with a **personal access token**, sent as a Bearer token. To generate one, open the **user menu** in Digisac, go to **Conta > API > Tokens de acesso pessoal** and click **Gerar token**. Give the token a name, choose an expiration period and click **Gerar token** again.

<Warning>Digisac only shows the token once, in the window that opens right after it is generated. Copy it before closing that window — it cannot be retrieved afterwards, and a new token has to be generated instead.</Warning>

<Warning>The expiration period is your choice: 30, 90 or 180 days, 1 year, or **Não expirar**. Pick **Não expirar** — with any other option the source stops extracting on the expiry date and the token has to be replaced by hand.</Warning>

<Note>The token inherits the permissions of the user who created it. Generate it from a user with **administrator** permissions so the sync can reach every module — an operator token is denied access to part of the platform.</Note>

The following configurations are available:

* **Digisac URL**: the address of your Digisac platform, the same one you use to log in — for example `https://mycompany.digisac.chat`. Required.

* **Access token**: the personal access token copied from **Conta > API > Tokens de acesso pessoal**. Required.

* **Initial sync date**: the earliest date from which records will be synced. It applies only to the streams replicated incrementally — Contacts, Messages, Tickets, Campaigns and Sales Opportunities. Leave it empty to extract the full history.

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.

<Note>**Messages** is by far the largest stream on a Digisac account — it holds every message exchanged on every channel. The first extraction reads the whole history, so it takes considerably longer than the others; the runs after it only read what changed.</Note>

<Info>Some streams depend on modules that may not be enabled on your plan — WhatsApp Templates requires an official WhatsApp Business API connection, and Sales Funnels, Sales Opportunities and the satisfaction surveys require those modules to be active. When a module is unavailable the stream is skipped with a warning in the run log instead of failing the extraction.</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**: Contacts, Messages, Tickets, Campaigns and Sales Opportunities support INCREMENTAL; the remaining streams are full table. 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.

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 Digisac and their corresponding fields. API reference: [Digisac API documentation](https://documenter.getpostman.com/view/24605757/2sA3BhfaDg).

<AccordionGroup>
  <Accordion title="Survey Answers">
    Answers contacts gave to the satisfaction surveys (`GET /api/v1/answers`) — one row per answered survey, carrying the NPS or CSAT score itself.

    Primary key: `id`

    | Field          | Type     | Description                                                             |
    | :------------- | :------- | :---------------------------------------------------------------------- |
    | `id`           | String   | Unique identifier of the answer.                                        |
    | `value`        | String   | Score or option the contact answered with.                              |
    | `questionId`   | String   | Identifier of the survey that was answered.                             |
    | `contactId`    | String   | Identifier of the contact who answered.                                 |
    | `ticketId`     | String   | Identifier of the ticket the survey was sent for.                       |
    | `userId`       | String   | Identifier of the agent who handled the rated service.                  |
    | `departmentId` | String   | Identifier of the department that handled the rated service.            |
    | `serviceId`    | String   | Identifier of the connection the survey was sent on.                    |
    | `accountId`    | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt`    | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt`    | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt`    | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Bots">
    Chatbots configured on the account (`GET /api/v1/bots`). Only the bot's identification is extracted; the conversation flow itself stays in the platform.

    Primary key: `id`

    | Field        | Type     | Description                                                                                                   |
    | :----------- | :------- | :------------------------------------------------------------------------------------------------------------ |
    | `id`         | String   | Unique identifier of the bot.                                                                                 |
    | `name`       | String   | Name of the bot.                                                                                              |
    | `settings`   | String   | Bot settings as a JSON object; `botCreatedVersion` identifies which builder version the bot was created with. |
    | `archivedAt` | Datetime | Timestamp when the bot was archived, or null while active.                                                    |
    | `accountId`  | String   | Identifier of the Digisac account the record belongs to.                                                      |
    | `createdAt`  | Datetime | Timestamp when the record was created in Digisac.                                                             |
    | `updatedAt`  | Datetime | Timestamp when the record was last updated in Digisac.                                                        |
    | `deletedAt`  | Datetime | Timestamp when the record was soft-deleted, or null while it is active.                                       |
  </Accordion>

  <Accordion title="Campaigns">
    Mass-message campaigns sent from the account (`GET /api/v1/campaigns`).

    Primary key: `id`

    Replication key: `createdAt` (incremental sync).

    | Field         | Type     | Description                                                             |
    | :------------ | :------- | :---------------------------------------------------------------------- |
    | `id`          | String   | Unique identifier of the campaign.                                      |
    | `name`        | String   | Name of the campaign.                                                   |
    | `status`      | String   | Current status of the campaign, such as scheduled or sent.              |
    | `scheduledAt` | Datetime | Timestamp the campaign was scheduled to go out.                         |
    | `serviceId`   | String   | Identifier of the connection used to send the campaign.                 |
    | `createdById` | String   | Identifier of the user who created the campaign.                        |
    | `sentById`    | String   | Identifier of the user who triggered the send.                          |
    | `accountId`   | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt`   | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt`   | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt`   | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Sales Opportunities">
    Opportunities on the sales funnels (`GET /api/v1/cards`). Read one funnel at a time, as a child of Sales Funnels.

    Primary key: `id`

    Replication key: `updatedAt` (incremental sync).

    | Field                 | Type     | Description                                                             |
    | :-------------------- | :------- | :---------------------------------------------------------------------- |
    | `id`                  | String   | Unique identifier of the opportunity.                                   |
    | `title`               | String   | Title of the opportunity.                                               |
    | `description`         | String   | Free-text description of the opportunity.                               |
    | `value`               | Number   | Monetary value attached to the opportunity.                             |
    | `order`               | Integer  | Position of the opportunity within its funnel stage.                    |
    | `pipelineId`          | String   | Identifier of the funnel the opportunity belongs to.                    |
    | `pipelineStageId`     | String   | Identifier of the funnel stage the opportunity sits in.                 |
    | `contactId`           | String   | Identifier of the contact the opportunity refers to.                    |
    | `ownerId`             | String   | Identifier of the user responsible for the opportunity.                 |
    | `statusId`            | String   | Identifier of the outcome status, such as won or lost.                  |
    | `reasonId`            | String   | Identifier of the reason recorded for the outcome.                      |
    | `organization`        | String   | Organization recorded on the opportunity.                               |
    | `organizationSegment` | String   | Market segment recorded for the organization.                           |
    | `originChannel`       | String   | Channel the opportunity originated from.                                |
    | `originCampaign`      | String   | Campaign the opportunity originated from.                               |
    | `accountId`           | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt`           | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt`           | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt`           | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Contacts">
    People and groups the account exchanges messages with (`GET /api/v1/contacts`). A contact is a number, e-mail address or Telegram user on one specific connection, so the same person reached through two connections is two contacts — `personId` is what ties them together.

    Primary key: `id`

    Replication key: `updatedAt` (incremental sync).

    | Field                  | Type     | Description                                                                                                                                           |
    | :--------------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `id`                   | String   | Unique identifier of the contact.                                                                                                                     |
    | `name`                 | String   | Name of the contact as resolved by Digisac — the name saved on the platform when there is one, otherwise the name published by the messaging channel. |
    | `internalName`         | String   | Name given to the contact inside Digisac by the team.                                                                                                 |
    | `alternativeName`      | String   | Name published by the messaging channel itself, such as the WhatsApp profile name or the formatted phone number.                                      |
    | `data`                 | String   | Channel-specific identification of the contact, as a JSON object. For WhatsApp connections it carries the phone number in the `number` key.           |
    | `note`                 | String   | Free-text note the team recorded about the contact.                                                                                                   |
    | `status`               | String   | Presence reported by the messaging channel, such as online or offline.                                                                                |
    | `serviceId`            | String   | Identifier of the connection (WhatsApp, Telegram, e-mail…) this contact belongs to.                                                                   |
    | `personId`             | String   | Identifier of the person this contact was grouped under, linking the same individual across connections.                                              |
    | `defaultDepartmentId`  | String   | Department that receives this contact's tickets by default.                                                                                           |
    | `defaultUserId`        | String   | Agent who receives this contact's tickets by default.                                                                                                 |
    | `lastMessageId`        | String   | Identifier of the most recent message exchanged.                                                                                                      |
    | `lastMessage`          | String   | Most recent message exchanged with the contact, as a JSON object. Only populated when the API is asked to include it.                                 |
    | `lastMessageAt`        | Datetime | Timestamp of the most recent message in either direction.                                                                                             |
    | `lastContactMessageAt` | Datetime | Timestamp of the most recent message sent by the contact.                                                                                             |
    | `unread`               | Integer  | Number of unread messages from this contact.                                                                                                          |
    | `unsubscribed`         | Boolean  | Whether the contact opted out of receiving campaign messages.                                                                                         |
    | `isMe`                 | Boolean  | Whether the contact is the account's own connection number.                                                                                           |
    | `isGroup`              | Boolean  | Whether the contact is a group conversation.                                                                                                          |
    | `isBroadcast`          | Boolean  | Whether the contact is a broadcast list.                                                                                                              |
    | `isSilenced`           | Boolean  | Whether notifications from this contact are muted.                                                                                                    |
    | `isMyContact`          | Boolean  | Whether the contact is saved in the address book of the connected device.                                                                             |
    | `hadChat`              | Boolean  | Whether any conversation ever took place with this contact.                                                                                           |
    | `visible`              | Boolean  | Whether the contact is shown in the platform's chat list. Hidden contacts are usually system or service entries.                                      |
    | `accountId`            | String   | Identifier of the Digisac account the record belongs to.                                                                                              |
    | `createdAt`            | Datetime | Timestamp when the record was created in Digisac.                                                                                                     |
    | `updatedAt`            | Datetime | Timestamp when the record was last updated in Digisac.                                                                                                |
    | `deletedAt`            | Datetime | Timestamp when the record was soft-deleted, or null while it is active.                                                                               |
  </Accordion>

  <Accordion title="Custom Fields">
    Definitions of the extra fields the account added to contact records (`GET /api/v1/custom-fields`). This stream carries the field definitions, not their values.

    Primary key: `id`

    | Field       | Type     | Description                                                             |
    | :---------- | :------- | :---------------------------------------------------------------------- |
    | `id`        | String   | Unique identifier of the custom field.                                  |
    | `name`      | String   | Label of the custom field.                                              |
    | `type`      | String   | Data type of the field, such as text.                                   |
    | `allowed`   | String   | Kind of record the field can be attached to, such as contacts.          |
    | `accountId` | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt` | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt` | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt` | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Departments">
    Departments that tickets are routed to, such as Support or Sales (`GET /api/v1/departments`).

    Primary key: `id`

    | Field            | Type     | Description                                                             |
    | :--------------- | :------- | :---------------------------------------------------------------------- |
    | `id`             | String   | Unique identifier of the department.                                    |
    | `name`           | String   | Name of the department.                                                 |
    | `distributionId` | String   | Identifier of the ticket-distribution rule applied to the department.   |
    | `archivedAt`     | Datetime | Timestamp when the department was archived, or null while active.       |
    | `accountId`      | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt`      | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt`      | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt`      | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Ticket Distribution Rules">
    Rules that spread incoming tickets across the agents of a department (`GET /api/v1/distribution`).

    Primary key: `id`

    | Field                         | Type     | Description                                                                    |
    | :---------------------------- | :------- | :----------------------------------------------------------------------------- |
    | `id`                          | String   | Unique identifier of the distribution rule.                                    |
    | `name`                        | String   | Name of the distribution rule.                                                 |
    | `maxNum`                      | Integer  | Maximum number of simultaneous tickets per agent.                              |
    | `timeToRedistribute`          | Integer  | Minutes a ticket waits in an offline agent's queue before being redistributed. |
    | `distributeQueue`             | Boolean  | Whether tickets are handed out from a queue rather than assigned directly.     |
    | `redistributeAll`             | Boolean  | Whether every ticket is redistributed, not only new ones.                      |
    | `redistributeAssignedTickets` | Boolean  | Whether unanswered assigned tickets are redistributed.                         |
    | `accountId`                   | String   | Identifier of the Digisac account the record belongs to.                       |
    | `createdAt`                   | Datetime | Timestamp when the record was created in Digisac.                              |
    | `updatedAt`                   | Datetime | Timestamp when the record was last updated in Digisac.                         |
    | `deletedAt`                   | Datetime | Timestamp when the record was soft-deleted, or null while it is active.        |
  </Accordion>

  <Accordion title="Holidays">
    Dates the chatbot treats as non-working days (`GET /api/v1/holiday`).

    Primary key: `id`

    | Field       | Type     | Description                                                             |
    | :---------- | :------- | :---------------------------------------------------------------------- |
    | `id`        | String   | Unique identifier of the holiday.                                       |
    | `name`      | String   | Name of the holiday.                                                    |
    | `from`      | Datetime | Timestamp the holiday period starts at.                                 |
    | `to`        | Datetime | Timestamp the holiday period ends at.                                   |
    | `message`   | String   | Message sent to contacts who write during the holiday.                  |
    | `accountId` | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt` | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt` | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt` | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Interactive Messages">
    Reusable interactive messages — button and list menus sent to contacts (`GET /api/v1/interactive-messages`).

    Primary key: `id`

    | Field         | Type     | Description                                                                                                         |
    | :------------ | :------- | :------------------------------------------------------------------------------------------------------------------ |
    | `id`          | String   | Unique identifier of the interactive message.                                                                       |
    | `name`        | String   | Name identifying the interactive message internally.                                                                |
    | `interactive` | String   | Definition of the interactive content — type, header, body, footer and the buttons or list rows — as a JSON object. |
    | `file`        | String   | File attached to the interactive message, as a JSON object.                                                         |
    | `accountId`   | String   | Identifier of the Digisac account the record belongs to.                                                            |
    | `createdAt`   | Datetime | Timestamp when the record was created in Digisac.                                                                   |
    | `updatedAt`   | Datetime | Timestamp when the record was last updated in Digisac.                                                              |
    | `deletedAt`   | Datetime | Timestamp when the record was soft-deleted, or null while it is active.                                             |
  </Accordion>

  <Accordion title="Messages">
    Every message exchanged on the account, in both directions (`GET /api/v1/messages`). Not every record is a chat message: Digisac writes system entries onto the same timeline (`type` = `ticket` when a ticket opens or closes, for example), which is why `text` is frequently null.

    Primary key: `id`

    Replication key: `updatedAt` (incremental sync).

    | Field                | Type     | Description                                                                                                                                                                                       |
    | :------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
    | `id`                 | String   | Unique identifier of the message.                                                                                                                                                                 |
    | `type`               | String   | Kind of entry: `chat` for a message exchanged with the contact, `comment` for an internal note, and `ticket` for the system entries Digisac writes when a ticket opens, closes or is transferred. |
    | `text`               | String   | Text of the message. Null for attachments without a caption and for the system entries.                                                                                                           |
    | `timestamp`          | Datetime | Timestamp of the message on the conversation timeline — this is the one to use for conversation analysis, since `createdAt` records when Digisac stored it.                                       |
    | `isFromMe`           | Boolean  | Whether the message was sent by the account (an agent or a bot) rather than received from the contact.                                                                                            |
    | `isFromBot`          | Boolean  | Whether the message was produced by a chatbot.                                                                                                                                                    |
    | `isFromSync`         | Boolean  | Whether the message was imported from the connected device's history rather than sent or received through Digisac.                                                                                |
    | `sent`               | Boolean  | Whether the message was successfully handed to the channel.                                                                                                                                       |
    | `visible`            | Boolean  | Whether the message is shown in the conversation.                                                                                                                                                 |
    | `obfuscated`         | Boolean  | Whether the message content was masked for privacy in the interface.                                                                                                                              |
    | `origin`             | String   | What produced the message, such as `user`, `bot`, `ticket` or `campaign`.                                                                                                                         |
    | `data`               | String   | Channel-specific metadata of the message, as a JSON object. For WhatsApp it carries the delivery receipt in the `ack` key; for system entries it describes the event, for example `ticketClose`.  |
    | `files`              | String   | Attachments sent with the message, as a JSON array of objects.                                                                                                                                    |
    | `quotedMessage`      | String   | Message this one replies to, as a JSON object.                                                                                                                                                    |
    | `quotedMessageId`    | String   | Identifier of the message this one replies to.                                                                                                                                                    |
    | `contactId`          | String   | Identifier of the contact the conversation belongs to.                                                                                                                                            |
    | `serviceId`          | String   | Identifier of the connection that carried the message.                                                                                                                                            |
    | `fromId`             | String   | Identifier of the contact that sent the message, when it came from outside.                                                                                                                       |
    | `toId`               | String   | Identifier of the recipient contact, when applicable.                                                                                                                                             |
    | `userId`             | String   | Identifier of the agent who sent the message.                                                                                                                                                     |
    | `botId`              | String   | Identifier of the chatbot that produced the message.                                                                                                                                              |
    | `campaignId`         | String   | Identifier of the campaign that produced the message.                                                                                                                                             |
    | `ticketId`           | String   | Identifier of the ticket the message belongs to.                                                                                                                                                  |
    | `ticketUserId`       | String   | Agent assigned to the ticket at the moment the message was written.                                                                                                                               |
    | `ticketDepartmentId` | String   | Department the ticket belonged to at the moment the message was written.                                                                                                                          |
    | `accountId`          | String   | Identifier of the Digisac account the record belongs to.                                                                                                                                          |
    | `createdAt`          | Datetime | Timestamp when the record was created in Digisac.                                                                                                                                                 |
    | `updatedAt`          | Datetime | Timestamp when the record was last updated in Digisac.                                                                                                                                            |
    | `deletedAt`          | Datetime | Timestamp when the record was soft-deleted, or null while it is active.                                                                                                                           |
  </Accordion>

  <Accordion title="Organizations">
    Organizations — groupings of people used to scope third-party access (`GET /api/v1/organizations`).

    Primary key: `id`

    | Field       | Type     | Description                                                             |
    | :---------- | :------- | :---------------------------------------------------------------------- |
    | `id`        | String   | Unique identifier of the organization.                                  |
    | `name`      | String   | Name of the organization.                                               |
    | `accountId` | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt` | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt` | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt` | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="People">
    People — the grouping that ties a contact's several channels together (`GET /api/v1/people`).

    Primary key: `id`

    | Field       | Type     | Description                                                             |
    | :---------- | :------- | :---------------------------------------------------------------------- |
    | `id`        | String   | Unique identifier of the person.                                        |
    | `name`      | String   | Full name of the person.                                                |
    | `document`  | String   | Identification document recorded for the person, such as CPF.           |
    | `accountId` | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt` | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt` | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt` | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Sales Funnels">
    Sales funnels configured on the account (`GET /api/v1/pipelines`).

    Primary key: `id`

    | Field       | Type     | Description                                                                   |
    | :---------- | :------- | :---------------------------------------------------------------------------- |
    | `id`        | String   | Unique identifier of the sales funnel.                                        |
    | `name`      | String   | Name of the sales funnel.                                                     |
    | `type`      | String   | Kind of funnel, such as sales.                                                |
    | `goBack`    | Boolean  | Whether opportunities may be moved back to a previous stage, or only forward. |
    | `stages`    | String   | Stages that make up the funnel, as a JSON array of objects.                   |
    | `accountId` | String   | Identifier of the Digisac account the record belongs to.                      |
    | `createdAt` | Datetime | Timestamp when the record was created in Digisac.                             |
    | `updatedAt` | Datetime | Timestamp when the record was last updated in Digisac.                        |
    | `deletedAt` | Datetime | Timestamp when the record was soft-deleted, or null while it is active.       |
  </Accordion>

  <Accordion title="Satisfaction Surveys">
    Satisfaction surveys (NPS/CSAT) configured to run at the end of a service (`GET /api/v1/questions`). This stream carries the survey definitions; the scores are in Survey Answers.

    Primary key: `id`

    | Field             | Type     | Description                                                             |
    | :---------------- | :------- | :---------------------------------------------------------------------- |
    | `id`              | String   | Unique identifier of the survey.                                        |
    | `name`            | String   | Name of the survey.                                                     |
    | `type`            | String   | Kind of survey, either NPS or CSAT.                                     |
    | `questionMessage` | String   | Question sent to the contact.                                           |
    | `successMessage`  | String   | Message sent after a valid answer is received.                          |
    | `invalidMessage`  | String   | Message sent when the contact answers with something invalid.           |
    | `duration`        | Integer  | How long the survey stays open for an answer.                           |
    | `tries`           | Integer  | How many times the survey is re-sent after an invalid answer.           |
    | `accountId`       | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt`       | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt`       | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt`       | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Quick Replies">
    Canned replies agents can insert into a conversation (`GET /api/v1/quick-replies`).

    Primary key: `id`

    | Field       | Type     | Description                                                             |
    | :---------- | :------- | :---------------------------------------------------------------------- |
    | `id`        | String   | Unique identifier of the quick reply.                                   |
    | `text`      | String   | Body of the quick reply.                                                |
    | `accountId` | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt` | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt` | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt` | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Roles">
    Access profiles that define what a user may do on the platform (`GET /api/v1/roles`).

    Primary key: `id`

    | Field         | Type     | Description                                                             |
    | :------------ | :------- | :---------------------------------------------------------------------- |
    | `id`          | String   | Unique identifier of the role.                                          |
    | `name`        | String   | Internal name of the role.                                              |
    | `displayName` | String   | Name of the role as shown in the interface.                             |
    | `isAdmin`     | Boolean  | Whether the role grants administrative access.                          |
    | `accountId`   | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt`   | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt`   | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt`   | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Schedules">
    Scheduled actions — future ticket openings and agent notifications (`GET /api/v1/schedule`).

    Primary key: `id`

    | Field            | Type     | Description                                                             |
    | :--------------- | :------- | :---------------------------------------------------------------------- |
    | `id`             | String   | Unique identifier of the scheduled action.                              |
    | `scheduledAt`    | Datetime | Timestamp the action is scheduled to run at.                            |
    | `message`        | String   | Message to be sent when the schedule runs.                              |
    | `notes`          | String   | Internal note recorded with the schedule.                               |
    | `openTicket`     | Boolean  | Whether a ticket is opened when the schedule runs.                      |
    | `notificateUser` | Boolean  | Whether the assigned agent is notified when it runs.                    |
    | `contactId`      | String   | Identifier of the contact the schedule refers to.                       |
    | `departmentId`   | String   | Identifier of the department the schedule is aimed at.                  |
    | `userId`         | String   | Identifier of the agent the schedule is aimed at.                       |
    | `files`          | String   | Files to be sent with the message, as a JSON array.                     |
    | `accountId`      | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt`      | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt`      | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt`      | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Connections">
    Connections — the messaging channels plugged into the account (`GET /api/v1/services`). One record per WhatsApp number, Telegram bot, e-mail box or other channel; every contact and message points at one of these through `serviceId`.

    Primary key: `id`

    | Field                 | Type     | Description                                                             |
    | :-------------------- | :------- | :---------------------------------------------------------------------- |
    | `id`                  | String   | Unique identifier of the connection.                                    |
    | `name`                | String   | Name of the connection.                                                 |
    | `type`                | String   | Channel of the connection, such as whatsapp, telegram or email.         |
    | `botId`               | String   | Identifier of the chatbot answering on this connection.                 |
    | `defaultDepartmentId` | String   | Department that receives tickets opened on this connection by default.  |
    | `archivedAt`          | Datetime | Timestamp when the connection was archived, or null while active.       |
    | `accountId`           | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt`           | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt`           | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt`           | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Tags">
    Labels used to classify contacts (`GET /api/v1/tags`).

    Primary key: `id`

    | Field             | Type     | Description                                                             |
    | :---------------- | :------- | :---------------------------------------------------------------------- |
    | `id`              | String   | Unique identifier of the tag.                                           |
    | `label`           | String   | Display name of the tag.                                                |
    | `backgroundColor` | String   | Hexadecimal color the tag is drawn with in the interface.               |
    | `accountId`       | String   | Identifier of the Digisac account the record belongs to.                |
    | `createdAt`       | Datetime | Timestamp when the record was created in Digisac.                       |
    | `updatedAt`       | Datetime | Timestamp when the record was last updated in Digisac.                  |
    | `deletedAt`       | Datetime | Timestamp when the record was soft-deleted, or null while it is active. |
  </Accordion>

  <Accordion title="Closing Subjects">
    Closing subjects agents pick when they end a ticket (`GET /api/v1/ticket-topics`).

    Primary key: `id`

    | Field        | Type     | Description                                                                       |
    | :----------- | :------- | :-------------------------------------------------------------------------------- |
    | `id`         | String   | Unique identifier of the closing subject.                                         |
    | `name`       | String   | Name of the closing subject.                                                      |
    | `archivedAt` | Datetime | Timestamp when the subject was archived, or null while it is available to agents. |
    | `accountId`  | String   | Identifier of the Digisac account the record belongs to.                          |
    | `createdAt`  | Datetime | Timestamp when the record was created in Digisac.                                 |
    | `updatedAt`  | Datetime | Timestamp when the record was last updated in Digisac.                            |
    | `deletedAt`  | Datetime | Timestamp when the record was soft-deleted, or null while it is active.           |
  </Accordion>

  <Accordion title="Tickets">
    Service tickets (`GET /api/v1/tickets`) — one per conversation an agent handled with a contact. A ticket opens when a conversation starts and closes when an agent ends the service, so this is the stream that carries handling time, routing and closing subject.

    Primary key: `id`

    Replication key: `updatedAt` (incremental sync).

    | Field            | Type     | Description                                                                                |
    | :--------------- | :------- | :----------------------------------------------------------------------------------------- |
    | `id`             | String   | Unique identifier of the ticket.                                                           |
    | `protocol`       | String   | Protocol number shown to the contact and used to look the service up in the platform.      |
    | `isOpen`         | Boolean  | Whether the ticket is still open. Closed tickets keep an `endedAt`.                        |
    | `origin`         | String   | What opened the ticket, such as a message from the contact, an agent, a bot or a campaign. |
    | `startedAt`      | Datetime | Timestamp when the service started.                                                        |
    | `endedAt`        | Datetime | Timestamp when the service was closed, or null while it is open.                           |
    | `contactId`      | String   | Identifier of the contact being served.                                                    |
    | `userId`         | String   | Identifier of the agent the ticket is assigned to.                                         |
    | `departmentId`   | String   | Identifier of the department handling the ticket.                                          |
    | `botId`          | String   | Identifier of the chatbot that handled the ticket.                                         |
    | `serviceId`      | String   | Identifier of the connection the conversation arrived on.                                  |
    | `firstMessageId` | String   | Identifier of the message that opened the ticket.                                          |
    | `lastMessageId`  | String   | Identifier of the last message on the ticket.                                              |
    | `accountId`      | String   | Identifier of the Digisac account the record belongs to.                                   |
    | `createdAt`      | Datetime | Timestamp when the record was created in Digisac.                                          |
    | `updatedAt`      | Datetime | Timestamp when the record was last updated in Digisac.                                     |
    | `deletedAt`      | Datetime | Timestamp when the record was soft-deleted, or null while it is active.                    |
  </Accordion>

  <Accordion title="Users">
    Agents and administrators who log in to the platform (`GET /api/v1/users`).

    Primary key: `id`

    | Field                  | Type     | Description                                                                 |
    | :--------------------- | :------- | :-------------------------------------------------------------------------- |
    | `id`                   | String   | Unique identifier of the user.                                              |
    | `name`                 | String   | Full name of the user.                                                      |
    | `email`                | String   | Login e-mail of the user.                                                   |
    | `phoneNumber`          | String   | Phone number recorded for the user.                                         |
    | `status`               | String   | Availability of the agent on the platform, such as online, away or offline. |
    | `active`               | Boolean  | Whether the user account is active.                                         |
    | `isSuperAdmin`         | Boolean  | Whether the user has full administrative access.                            |
    | `isFirstLogin`         | Boolean  | Whether the user has yet to log in for the first time.                      |
    | `isActiveInternalChat` | Boolean  | Whether the user has the internal chat enabled.                             |
    | `language`             | String   | Interface language chosen by the user, such as pt-BR.                       |
    | `timetableId`          | String   | Identifier of the working-hours schedule assigned to the user.              |
    | `archivedAt`           | Datetime | Timestamp when the user was archived, or null while still in use.           |
    | `data`                 | String   | Additional user settings, as a JSON object.                                 |
    | `accountId`            | String   | Identifier of the Digisac account the record belongs to.                    |
    | `createdAt`            | Datetime | Timestamp when the record was created in Digisac.                           |
    | `updatedAt`            | Datetime | Timestamp when the record was last updated in Digisac.                      |
    | `deletedAt`            | Datetime | Timestamp when the record was soft-deleted, or null while it is active.     |
  </Accordion>

  <Accordion title="WhatsApp Templates">
    WhatsApp message templates (HSM) approved for the official connection (`GET /api/v1/whatsapp-business-templates`). Only accounts with a WhatsApp Business API connection have templates.

    Primary key: `id`

    | Field          | Type     | Description                                                                             |
    | :------------- | :------- | :-------------------------------------------------------------------------------------- |
    | `id`           | String   | Unique identifier of the template.                                                      |
    | `name`         | String   | Name of the template as registered with WhatsApp.                                       |
    | `internalName` | String   | Name shown for the template inside Digisac.                                             |
    | `components`   | String   | Header, body, footer and buttons that make up the template, as a JSON array of objects. |
    | `messageType`  | String   | Kind of template content, such as text\_only.                                           |
    | `language`     | String   | Language the template was approved in, such as pt\_BR.                                  |
    | `category`     | String   | Category the template was submitted under, such as MARKETING or UTILITY.                |
    | `status`       | String   | Approval status returned by WhatsApp.                                                   |
    | `namespace`    | String   | WhatsApp namespace the template belongs to.                                             |
    | `serviceId`    | String   | Identifier of the connection the template belongs to.                                   |
    | `accountId`    | String   | Identifier of the Digisac account the record belongs to.                                |
    | `createdAt`    | Datetime | Timestamp when the record was created in Digisac.                                       |
    | `updatedAt`    | Datetime | Timestamp when the record was last updated in Digisac.                                  |
    | `deletedAt`    | Datetime | Timestamp when the record was soft-deleted, or null while it is active.                 |
  </Accordion>
</AccordionGroup>
