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

# Cloud Humans as a data source

> Bring your Cloud Chat support conversations (WhatsApp and other channels), messages, contacts, CSAT answers, campaigns, agents, teams, inboxes and labels from Cloud Humans to Nekt.

Cloud Humans is a customer service platform that combines an AI agent (ClaudIA) with human agents in **Cloud Chat**, an omnichannel inbox for WhatsApp, web chat, e-mail and other channels. This connector reads your Cloud Chat account through the Cloud Humans API and brings your support conversations and every message in them, your contacts, the satisfaction survey (CSAT) answers, your campaigns, and the agents, teams, inboxes and labels that make them analyzable.

> [!NOTE]
>
> The connector only reads data. It never creates, changes or deletes anything in Cloud Humans, and it never sends messages or campaigns.

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

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

### 1. Add account access

Choose how the connector signs in (**Authentication Method**). What you can sync depends on it:

| | API credential (recommended for contacts and conversations) | User e-mail and password |
| :- | :- | :- |
| Conversations and messages | Yes | Yes (an administrator sees every inbox; an agent only its own) |
| Contacts | Yes | Administrators only |
| CSAT answers and campaigns | No | Administrators and supervisors |
| Agents, teams, inboxes and labels | No | Yes |

**API credential.** An administrator creates it in Cloud Chat under **Settings > API and integrations > API credentials > New credential**, with the **Conversations, read** and **Contacts, read** accesses. Copy the **Client ID** and the **Client Secret** at the end of the flow: the secret is shown only once. Cloud Chat also shows the **instance** next to the Client ID. Cloud Humans limits API credentials to contacts and conversations; the other tables need a user.

**User e-mail and password.** Use a Cloud Chat user that is an **administrator** of the account, ideally one created only for Nekt. The user must have a permanent password and **must not have two-step verification (SMS code)** turned on, because a scheduled sync cannot type the code.

The following configurations are available:

* **Authentication Method**: API credential or User e-mail and password.
* **Client ID** and **Client Secret**: the values of the API credential (API credential only).
* **E-mail** and **Password**: the sign-in of the Cloud Chat user (User e-mail and password only).
* **Account ID**: the number of your Cloud Chat account, the one after `/accounts/` in the browser address bar when you are in Cloud Chat (for example, `1234`).
* **Cloud Chat Instance**: the Cloud Chat instance that holds your account, a short number such as `1`. Cloud Chat shows it next to the Client ID of an API credential; you can also read it on the [Find your credentials](https://docs.cloudhumans.com/api-reference/cloudchat/credentials) page of the Cloud Humans documentation.
* **Start Date**: earliest date read on the first sync: conversations changed since then (with all their messages) and CSAT answers given since then.
* **Re-read Window (days)**: (Default: 1, advanced) each sync re-reads the conversations changed, and the CSAT answers given, in this many days before the previous sync. This keeps the WhatsApp delivery and read status of recent messages up to date. Larger values make syncs longer.

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. Select **Conversations** together with **Messages**: messages are read through their conversations.

> 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.md), 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.

# Streams and Fields

## Available streams

The table below lists every stream, its **slug** (the exact identifier to pass when creating the source via API), how it syncs and who can read it.

| Stream | Slug | Description | Needs |
| - | - | - | - |
| Conversations | `conversations` | Support conversations (WhatsApp and other channels) with status, assignee, team, inbox, contact and labels. Incremental on the last change. | API credential or any user |
| Messages | `messages` | Every message of each conversation: text, direction, sender and WhatsApp delivery status. Read through Conversations. | Same as Conversations |
| Contacts | `contacts` | Your customers: name, e-mail, phone and custom attributes. Read in full on every sync. | API credential or an administrator |
| CSAT Responses | `csat_responses` | Satisfaction survey answers: score, comment, rated agent and conversation. Incremental on the answer time. | Administrator or supervisor |
| Campaigns | `campaigns` | Campaigns (WhatsApp templates, e-mail, widget) with status, inbox, audience size and dates. Read in full on every sync. | Administrator or supervisor |
| Agents | `agents` | Human and AI agents with role, availability, teams and inboxes. | Any user |
| Teams | `teams` | Teams conversations are assigned to. | Any user |
| Inboxes | `inboxes` | Inboxes (channels such as a WhatsApp number) with their settings. | Any user |
| Labels | `labels` | Labels you can apply to conversations. | Any user |

## Fields by stream

All dates are in UTC. Nested values are flattened into columns (`contact_id`, `sender_type`...) or kept as JSON text (`custom_attributes`).

> [accordion] Conversations
>
> Primary key: `id`. Replication key: `updated_at`.
>
> * `id` - Conversation number: the one shown in the Cloud Chat URL and in webhooks, unique within the account
> * `uuid` - Canonical, globally unique id of the conversation (the cloudChatId of the ClaudIA API)
> * `status` - Lifecycle status: open, resolved, pending, snoozed or proactive (opened by an outbound message, such as a campaign)
> * `priority` - Priority set on the conversation: low, medium, high or urgent; null when none is set
> * `assignee_id` - Id of the agent currently assigned (see the agents table); null while unassigned
> * `inbox_id` - Id of the inbox (channel) the conversation lives in, such as a WhatsApp number (see the inboxes table)
> * `team_id` - Id of the team the conversation is assigned to (see the teams table); null when none
> * `contact_id` - Id of the customer (contact) on the other side of the conversation (see the contacts table)
> * `contact_name` - Display name of the contact when the conversation was read
> * `labels` - Labels applied to the conversation, exactly as shown in Cloud Chat
> * `custom_attributes` - Custom conversation attributes configured in the account, keyed by attribute key
> * `snoozed_until` - When a snoozed conversation reopens; null outside the snoozed status
> * `waiting_since` - Since when the conversation has been waiting for the next reply (basis of SLA and wait-time reports); null when nothing is waited on
> * `created_at` - When the conversation was created (UTC)
> * `updated_at` - When the conversation last changed (UTC); used as the incremental replication key
> * `last_activity_at` - When the last message or activity happened in the conversation (UTC)
> * `extra_fields` - Fields the API returned that the connector does not map to a column yet, as JSON with their original names

> [accordion] Messages
>
> Primary key: `id`. Replication key: `conversation_updated_at`.
>
> * `id` - Message id, unique within the Cloud Chat instance
> * `uuid` - Canonical, globally unique id of the message (the messageId of the ClaudIA API)
> * `conversation_id` - Number of the conversation the message belongs to (see the conversations table)
> * `conversation_uuid` - Canonical id of the conversation the message belongs to
> * `content` - Text of the message; null on some activity or attachment-only messages
> * `message_type` - Who originated it: incoming (from the contact), outgoing (agent or bot), activity (system event such as a status or assignment change) or template (outbound template, e.g. WhatsApp)
> * `content_type` - How Cloud Chat renders the body: text for most messages, or an interactive/bot type (input\_select, cards, form, article, input\_csat, ...)
> * `private` - True for a private note, visible only to agents and never sent to the contact
> * `status` - Delivery status on the channel: sent, delivered, read or failed; null on types that do not track delivery
> * `sender_type` - Kind of sender: contact, user (agent or administrator) or agent\_bot; null on activity messages
> * `sender_id` - Id of the sender (contact id, agent id or bot id depending on sender\_type); null for activity messages and hidden platform admins
> * `sender_name` - Display name of the sender (masked for hidden platform admins)
> * `created_at` - When the message was created (UTC)
> * `conversation_updated_at` - updated\_at of the conversation when its messages were read; used as the incremental replication key
> * `extra_fields` - Fields the API returned that the connector does not map to a column yet, as JSON with their original names

> [accordion] Contacts
>
> Primary key: `id`. Full table.
>
> * `id` - Contact id, the same contact\_id used by conversations, messages and CSAT answers
> * `name` - Display name, often the one the channel reported (such as the WhatsApp profile name); empty when unknown
> * `email` - E-mail address of the contact; null when none
> * `phone_number` - Phone number in E.164 format; null when none
> * `identifier` - Id your own systems use for this contact, when set through an integration
> * `custom_attributes` - Custom contact attributes configured in the account, keyed by attribute key
> * `created_at` - When the contact was created (UTC)
> * `last_activity_at` - When the contact last had activity (UTC); null when never
> * `extra_fields` - Fields the API returned that the connector does not map to a column yet, as JSON with their original names

> [accordion] CSAT Responses
>
> Primary key: `id`. Replication key: `created_at`.
>
> * `id` - Id of the CSAT answer
> * `conversation_id` - Number of the rated conversation (see the conversations table)
> * `conversation_uuid` - Canonical id of the rated conversation
> * `rating` - Score the customer gave, from 1 (worst) to 5 (best)
> * `feedback` - Comment the customer wrote with the score; null when none
> * `assignee_id` - Agent the answer is credited to: the one assigned when the survey went out (see the agents table); null when unassigned
> * `contact_id` - Contact who answered (see the contacts table)
> * `inbox_id` - Inbox of the rated conversation (see the inboxes table)
> * `team_id` - Team the conversation was assigned to when this answer was read; null when none
> * `created_at` - When the customer answered (UTC); used as the incremental replication key
> * `extra_fields` - Fields the API returned that the connector does not map to a column yet, as JSON with their original names

> [accordion] Campaigns
>
> Primary key: `id`. Full table.
>
> * `id` - Campaign id, sequential within the account (the number Cloud Chat shows)
> * `title` - Internal name of the campaign
> * `message` - Template name on a WhatsApp campaign; message body on e-mail and widget campaigns
> * `campaign_status` - Lifecycle status (active, completed, running, draft, partially\_completed, failed...). Not a delivery report: on WhatsApp, completed is set before the audience is resolved
> * `campaign_type` - one\_off (sent once) or ongoing (fires on a trigger)
> * `subject` - Subject line of an e-mail campaign; null on other channels
> * `inbox_id` - Inbox that sends the campaign (see the inboxes table)
> * `email_campaign_sender_id` - Verified sender of an e-mail campaign; null on WhatsApp and widget
> * `sender_id` - User the campaign is attributed to (see the agents table)
> * `conversation_label_id` - Label applied to the conversations the campaign opens (see the labels table)
> * `team_id` - Team the conversations opened by the campaign are assigned to (see the teams table)
> * `recipients_count` - Raw audience size recorded on the campaign, before the reachability check; not what was delivered
> * `scheduled_at` - When the campaign is due out (UTC)
> * `started_at` - When dispatch began (UTC). Always null on WhatsApp campaigns
> * `completed_at` - When the campaign reached a terminal status (UTC); null while open
> * `created_at` - When the campaign was created (UTC)
> * `updated_at` - When the campaign last changed (UTC)
> * `extra_fields` - Fields the API returned that the connector does not map to a column yet, as JSON with their original names

> [accordion] Agents
>
> Primary key: `id`. Full table.
>
> * `id` - Agent id, the one conversations (assignee\_id), messages (sender\_id) and CSAT answers refer to
> * `name` - Name of the agent as shown in this account
> * `display_name` - Name that belongs to this account only, when there is one; null means name comes from the user's global record
> * `email` - Login e-mail of the agent
> * `role` - Role in the account: agent, administrator, supervisor, assistant or cx\_engineer
> * `availability_status` - Availability when read: online, offline or busy
> * `auto_offline` - Whether the agent goes offline automatically after a period of inactivity
> * `assignment_limit` - Per-agent limit of conversations assigned at once; null when the account default applies
> * `is_ai_agent` - True for an AI agent (such as ClaudIA), false for a human
> * `team_ids` - Ids of the teams the agent belongs to (see the teams table)
> * `inbox_ids` - Ids of the inboxes the agent is a member of (see the inboxes table)
> * `created_at` - When the agent was added (UTC)
> * `updated_at` - When the agent last changed (UTC)
> * `extra_fields` - Fields the API returned that the connector does not map to a column yet, as JSON with their original names

> [accordion] Teams
>
> Primary key: `id`. Full table.
>
> * `id` - Team id, the one conversations and CSAT answers refer to as team\_id
> * `name` - Name of the team
> * `description` - Description of the team
> * `allow_auto_assign` - Whether conversations are assigned automatically to the team's agents
> * `working_hours_enabled` - Whether the team has working hours configured
> * `out_of_office_message` - Message sent outside working hours
> * `timezone` - Time zone of the team's working hours
> * `system_managed` - True for a team provisioned by the Cloud Humans platform itself
> * `created_at` - When the team was created (UTC)
> * `updated_at` - When the team last changed (UTC)
> * `extra_fields` - Fields the API returned that the connector does not map to a column yet, as JSON with their original names

> [accordion] Inboxes
>
> Primary key: `id`. Full table.
>
> * `id` - Inbox id, the one conversations, CSAT answers and campaigns refer to as inbox\_id
> * `name` - Name of the inbox
> * `channel_type` - Channel class of the inbox, such as Channel::Whatsapp, Channel::WebWidget, Channel::Api or Channel::Email
> * `greeting_enabled` - Whether a greeting message is sent on new conversations
> * `greeting_message` - Greeting message sent on new conversations
> * `working_hours_enabled` - Whether the inbox has working hours configured
> * `out_of_office_message` - Message sent outside working hours
> * `timezone` - Time zone of the inbox's working hours
> * `csat_survey_enabled` - Whether a CSAT survey is sent when a conversation is resolved
> * `enable_auto_assignment` - Whether conversations are assigned to agents automatically
> * `allow_messages_after_resolved` - Whether the contact can keep writing after the conversation is resolved
> * `lock_to_single_conversation` - Whether a contact is kept in a single conversation in this inbox
> * `created_at` - When the inbox was created (UTC)
> * `updated_at` - When the inbox last changed (UTC)
> * `extra_fields` - Fields the API returned that the connector does not map to a column yet, as JSON with their original names

> [accordion] Labels
>
> Primary key: `id`. Full table.
>
> * `id` - Label id
> * `title` - Label text, exactly as it appears in the labels column of conversations
> * `description` - Description of the label
> * `color` - Hex color of the label chip in Cloud Chat
> * `show_on_sidebar` - Whether the label appears in the conversation sidebar filter
> * `created_at` - When the label was created (UTC)
> * `updated_at` - When the label last changed (UTC)
> * `extra_fields` - Fields the API returned that the connector does not map to a column yet, as JSON with their original names

# Data Model

```mermaid theme={null}
graph TD;
    Messages("Messages") -- "conversation_id" --> Conversations("Conversations");
    CSAT("CSAT Responses") -- "conversation_id" --> Conversations;
    Conversations -- "contact_id" --> Contacts("Contacts");
    Conversations -- "assignee_id" --> Agents("Agents");
    Conversations -- "team_id" --> Teams("Teams");
    Conversations -- "inbox_id" --> Inboxes("Inboxes");
    Conversations -- "labels (title)" --> Labels("Labels");
    CSAT -- "assignee_id" --> Agents;
    Campaigns("Campaigns") -- "inbox_id" --> Inboxes;
    Campaigns -- "sender_id" --> Agents;
```

# Use Cases for Data Analysis

Run these queries on [Explorer](https://app.nekt.ai/explorer). Replace the table names with the ones you chose for this source.

### 1. WhatsApp support volume and first response time

```sql theme={null}
WITH first_messages AS (
  SELECT
    conversation_id,
    MIN(CASE WHEN message_type = 'incoming' THEN created_at END) AS first_customer_message,
    MIN(CASE WHEN message_type = 'outgoing' AND private = false THEN created_at END) AS first_reply
  FROM cloud_humans_messages
  GROUP BY conversation_id
)
SELECT
  DATE_TRUNC('week', c.created_at) AS week,
  i.name AS inbox,
  COUNT(*) AS conversations,
  AVG(DATE_DIFF('minute', f.first_customer_message, f.first_reply)) AS avg_first_response_minutes
FROM cloud_humans_conversations c
JOIN cloud_humans_inboxes i ON i.id = c.inbox_id
LEFT JOIN first_messages f ON f.conversation_id = c.id
WHERE i.channel_type = 'Channel::Whatsapp'
GROUP BY 1, 2
ORDER BY 1 DESC, 2
```

### 2. CSAT by agent

```sql theme={null}
SELECT
  a.name AS agent,
  COUNT(*) AS answers,
  AVG(r.rating) AS average_score,
  AVG(CASE WHEN r.rating >= 4 THEN 1.0 ELSE 0.0 END) AS satisfaction_rate
FROM cloud_humans_csat_responses r
LEFT JOIN cloud_humans_agents a ON a.id = r.assignee_id
GROUP BY 1
ORDER BY answers DESC
```

### 3. Campaign template sends and their delivery status

Campaign messages are sent as WhatsApp **template** messages in the conversations the campaign opens. The API does not link a message to a campaign, so match them by the template name (the campaign `message`), the inbox and the date.

```sql theme={null}
SELECT
  DATE_TRUNC('day', m.created_at) AS day,
  c.inbox_id,
  m.status,
  COUNT(*) AS template_messages
FROM cloud_humans_messages m
JOIN cloud_humans_conversations c ON c.id = m.conversation_id
WHERE m.message_type = 'template'
GROUP BY 1, 2, 3
ORDER BY 1 DESC
```

## Implementation Notes

* **Full sync of Messages.** If you run a full sync of the Messages table alone, the connector reads every conversation since the Start Date for it, so the table is rebuilt in full.
* **Conversations** are read by the time of their last change, so a conversation that is reopened, reassigned, relabelled or resolved after an earlier sync comes again with its current state, together with all its messages. Each sync also re-reads the **Re-read Window** before the previous one.
* **Message status, edits and deletions.** Cloud Chat updates the WhatsApp status of a message (sent, delivered, read, failed), and edits or deletes a message, without marking its conversation as changed. These changes are picked up only while the conversation is inside the **Re-read Window** (1 day by default); later ones are not, so read rates of older campaign messages go stale. If you need them, raise the Re-read Window (up to 30 days): syncs get longer, because every message of the conversations changed in that window is read again.
* **CSAT answers** are read by the time the customer answered, so an answer that arrives days after the conversation closed is picked up by the next sync. `team_id` is the team the conversation is assigned to when the answer is read; `assignee_id` is the agent assigned when the survey went out. An answer edited later (score or comment) keeps its answer time, so the edit is picked up only within the Re-read Window.
* **Campaigns.** Cloud Humans has no list of campaigns, so the connector looks campaigns up by their sequential number, stepping over deleted ones and looking further ahead after a long run of deleted numbers. If a sync finds no campaign at all, it warns you. The campaign status is not a delivery report: on WhatsApp, `completed` is set before the audience is resolved and `started_at` is always empty. For the per-recipient sends, use the template messages (see the use case above).
* **Full table streams.** Contacts, campaigns, agents, teams, inboxes and labels are read in full on every sync. If one that had records suddenly comes back empty, that stream fails instead of emptying your table; run a full sync of the source if the data really was removed in Cloud Chat.
* **Permissions.** Before reading anything, the connector checks which selected tables the credential or user may read. Tables it cannot read are skipped with a warning that names them and says how to get access; the other tables still load.
* **Deleted records.** Cloud Humans does not report deleted records. Full table streams drop them on the next sync; deleted conversations and messages stay in their tables.
* **Rate limits.** Cloud Humans limits requests per user or per API credential, shared with any other integration that uses the same login. The connector slows down before reaching the limit, so a first sync with a long history can take a while.
* **Fields.** Any field Cloud Humans adds that the connector does not map yet is kept in the **extra\_fields** column of the table, as JSON with the original field names.
* **Data Export.** Cloud Humans also offers a [Data Export](https://docs.cloudhumans.com/data-export/overview) of raw tables to a storage bucket, including outbound and campaign delivery events. This connector does not use it.

## Troubleshooting

| Error or symptom | What it means | What to do |
| :- | :- | :- |
| "rejected the API credential" | Wrong Client ID or Client Secret, or the credential was deactivated. | Create a new credential in Cloud Chat and update the source. |
| "two-step verification (SMS code)" | The user has two-step verification turned on. | Use an API credential, or a dedicated user without two-step verification. |
| "password ... is temporary" | First access or a reset password. | Sign in to Cloud Chat once with the user, set a permanent password and update the source. |
| "not found for account ... on instance ..." | The Account ID or the Cloud Chat Instance is wrong, or the credential/user has no access to that account. | Check both values and the user's membership. |
| Tables skipped with "refused access" | The credential or the user's role cannot read them (API credentials only read contacts and conversations). | Use an administrator user, or deselect those tables. |
| Fewer conversations than in Cloud Chat | The user is an agent, which only sees the conversations of its own inboxes. | Use an administrator user or an API credential. |


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