# HubSpot

Attify reads HubSpot through its API, read-only, with OAuth or an API token, for customer support and sales meetings. It is the customer's own system, so what Attify reads there is connected data: the strongest provenance, and what a vendor verification rests on.

## As a help desk, for customer support

| Stored            | HubSpot                                                                     |
|-------------------|-----------------------------------------------------------------------------|
| id                | ticket `id` (`hs_object_id`)                                                |
| started_at        | `createdate`                                                                |
| updated_at        | `hs_lastmodifieddate`, the sync cursor                                      |
| customer          | the first thread's `associatedContactId`                                    |
| channel           | `source_type` (CHAT, EMAIL, FORM, PHONE), lowercased                        |
| claim             | `hs_customer_agent_ticket_status`, read as HubSpot sets it: RESOLVED claims |
|                   | a resolution; HANDED_OFF and ESCALATED claim none; PENDING or NONE is no    |
|                   | outcome (no claim). The Customer Agent never took part: no vendor claim, so |
|                   | the reconstructed claim applies                                             |
| messages          | thread messages of type MESSAGE, oldest first (`text`); a ticket with no    |
|                   | thread opens with its `content`. Comments, assignments, status changes and  |
|                   | failed sends are left out, and so are system (`S-`) and app (`I-`) senders: |
|                   | neither the Customer Agent nor a person                                     |
| messages[].role   | `direction` INCOMING: the customer; OUTGOING: support                       |
| messages[].author | the sender's actor id: `L-` (the Customer Agent): "ai"; `A-` (a user):      |
|                   | "human"                                                                     |
| reopens           | `hs_ticket_reopened_at` (the latest reopen HubSpot records); others are     |
|                   | inferred from the conversation                                              |
| merged_from       | `hs_merged_object_ids` (a merge gives the ticket a new id and lists both    |
|                   | old ones; stored copies of those are contacts of the merged ticket)         |
| rating            | `hs_last_csat_rating` at `hs_last_csat_date` (HubSpot does not publish its  |
|                   | CSAT scale, so it is stored but not read as satisfied or not), else         |
|                   | `hs_feedback_last_ces_rating` (1 to 7, effort, not satisfaction). Neither   |
|                   | asks whether the issue was resolved, so neither confirms a resolution       |

## As a crm or calendar, for sales meetings

| Stored            | HubSpot                                                                     |
|-------------------|-----------------------------------------------------------------------------|
| event id          | the meeting's object id                                                     |
| started_at        | `hs_createdate` (else the record's `createdAt`)                             |
| updated_at        | `hs_lastmodifieddate`                                                       |
| start, end        | `hs_meeting_start_time` (else `hs_timestamp`), `hs_meeting_end_time`        |
| status            | cancelled when `hs_meeting_outcome` is canceled; otherwise booked           |
| cancelled_at      | when the outcome's history set canceled                                     |
| attendance        | outcome completed: attended, no show: no_show (source "outcome"); by_app    |
|                   | when the outcome's latest change came from an app or an agent               |
| created_by, ai    | the record source (`hs_object_source`, by value or option label): Custom    |
|                   | Agent, Customer Agent, HubSpot AI: an app, ai true; Integration, API,       |
|                   | Marketplace, Salesforce sync: an app (the source id), ai null; Meetings (a  |
|                   | scheduling page): the invitee, ai null; CRM UI, mobile, the sales           |
|                   | extension: the user `hs_created_by_user_id`, ai false; otherwise unknown.   |
|                   | The meeting source (`hs_meeting_source`) is read when the record source     |
|                   | says nothing recognized                                                     |
| organizer         | the owner's (`hubspot_owner_id`) email, from the owners API                 |
| attendees         | the associated contacts' emails, response none                              |
| links             | `url:<hs_meeting_external_url>`                                             |
| contacts, ...     | associated contacts, companies and deals (associations v4)                  |
| title             | `hs_meeting_title`                                                          |
| person            | `email` and `hs_additional_emails`; company: the primary associated         |
|                   | company (else `associatedcompanyid`); customer_since: Became a Customer     |
|                   | Date (or the date it entered the Customer stage); lifecycle:                |
|                   | `lifecyclestage`; origin: the original traffic source (its offline          |
|                   | drill-down, else the record source): search, social, referrals, direct      |
|                   | traffic, forms, chat: inbound; the CRM, sales tools, integrations, imports: |
|                   | outbound; merged: Merged Contact IDs                                        |
| company           | `domain` and `hs_additional_domains`; customer_since as a person's          |
| deal              | the primary associated company, the associated contacts; closed_at:         |
|                   | `closedate` once `hs_is_closed`; won: `hs_is_closed_won`; created_by as an  |
|                   | event's                                                                     |
