> For the complete documentation index, see [llms.txt](https://help.daasity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.daasity.com/core-concepts/data-integrations/setup-guides/digital-integrations/gorgias/integration-specifications.md).

# Integration Specifications

This page will help you learn about how Daasity replicates data from Gorgias, limitations to the data we can extract and where the data is stored in the Gorgias schema.

## Integration Overview

Gorgias is a customer support platform used by merchants to centralize customer interactions and automate responses to repetitive questions. The Daasity integration with Gorgias extracts data from the most important endpoints needed to analyze how customers interact with customer support and the performance of those interactions.

## Integration Availability

This integration is available for:

* Enterprise
* Growth

## API Endpoints

The Daasity Gorgias extractor is built based on this [Gorgias API documentation](https://developers.gorgias.com/reference/introduction). The following endpoints are used by Daasity to replicate data from Gorgias:

* [Account](https://developers.gorgias.com/reference/the-account-object)
* [Events](https://developers.gorgias.com/reference/get_api-events)
* [Tickets](https://developers.gorgias.com/reference/the-ticket-object)
* [Tags](https://developers.gorgias.com/reference/the-tag-object)
* [Ticket Messages](https://developers.gorgias.com/reference/the-ticketmessage-object)
* [Users](https://developers.gorgias.com/reference/the-user-object)
* [Satisfaction Surveys](https://developers.gorgias.com/reference/the-satisfactionsurvey-object)
* Custom Fields (`/api/custom-fields`, needs the `custom_fields:read` scope)

## **Entity Relationship Diagram (ERD)**

[Click here to view the ERD for the Daasity Gorgias integration](https://lucid.app/documents/embedded/8976a30f-d52d-40bf-81d8-485d4c674d22) illustrating the different tables and keys to join across tables.

## Gorgias Schema

The Daasity Gorgias extractor creates these tables using the endpoints and replication methods listed. The data is mapped from the source API endpoint to the table based on the mapping logic outlined in each table.

* [Accounts](#accounts)
* [Accounts Custom Attributes](#accounts-custom-attributes)
* [Accounts Custom Attributes Data](#accounts-custom-attributes-data)
* [Custom Fields](#custom-fields)
* [Events](#events)
* [Tickets](#tickets)
* [Ticket Custom Fields](#ticket-custom-fields)
* [Ticket Tags](#ticket-tags)
* [Ticket Messages](#ticket-messages)
* [Users](#users)
* [Satisfaction Surveys](#satisfaction-survey)

### **Accounts**

* Endpoint: [Account](https://developers.gorgias.com/reference/the-account-object)
* Update Method: UPSERT
* Table Name: \[`gorgias.accounts`]

| JSON Element                                                      | Database Column           |
| ----------------------------------------------------------------- | ------------------------- |
| domain                                                            | domain                    |
| status                                                            | status                    |
| created\_datetime                                                 | created\_at               |
| current\_subscription::plan                                       | subscription\_plan        |
| current\_subscription::start\_datetime                            | subscription\_created\_at |
| current\_subscription::status                                     | subscription\_status      |
| settings::id (no longer populated)                                | setting\_id               |
| settings::type (no longer populated)                              | setting\_type             |
| settings::data::timezone (no longer populated)                    | timezone                  |
| settings::data::business\_hours::days (no longer populated)       | business\_days            |
| settings::data::business\_hours::to\_time (no longer populated)   | business\_close           |
| settings::data::business\_hours::from\_time (no longer populated) | business\_open            |
| MD5(id + domain)                                                  | \_\_sync\_key             |
| Daasity: timestamp when loaded into DB                            | \_\_synced\_at            |

### **Accounts Custom Attributes**

* Endpoint: [Account](https://developers.gorgias.com/reference/the-account-object)
* Update Method: UPSERT
* Table Name: \[`gorgias.accounts_custom_attributes`]

| JSON Element                         | Database Column          |
| ------------------------------------ | ------------------------ |
| domain                               | domain                   |
| setting\_row::id                     | settings\_id             |
| key                                  | custom\_attribute\_key   |
| value                                | custom\_attribute\_value |
| setting\_row::type                   | custom\_attribute\_type  |
| Daasity: account id                  | \_account\_id            |
| MD5(setting\_row::id + domain + key) | \_\_sync\_key            |

### **Accounts Custom Attributes Data**

* Endpoint: [Account](https://developers.gorgias.com/reference/the-account-object)
* Update Method: UPSERT
* Table Name: \[`gorgias.accounts_custom_attributes_data`]

| JSON Element                                                             | Database Column          |
| ------------------------------------------------------------------------ | ------------------------ |
| domain                                                                   | domain                   |
| settings\_row::id                                                        | settings\_id             |
| array\_name                                                              | attribute\_data\_name    |
| settings\_row::type                                                      | custom\_attribute\_type  |
| index                                                                    | custom\_attribute\_index |
| key                                                                      | custom\_data\_key        |
| value                                                                    | custom\_data\_value      |
| MD5(settings\_row::id + domain + array\_name + index + source\_id + key) | \_\_sync\_key            |

### **Custom Fields**

This table is only loaded when the merchant's Gorgias token has the `custom_fields:read` scope.

* Endpoint: Custom Fields (`/api/custom-fields`)
* Update Method: UPSERT
* Table Name: \[`gorgias.custom_fields`]

| JSON Element                                                                           | Database Column                             |
| -------------------------------------------------------------------------------------- | ------------------------------------------- |
| id                                                                                     | custom\_field\_id                           |
| external\_id                                                                           | external\_id                                |
| object\_type                                                                           | object\_type                                |
| label                                                                                  | label                                       |
| description                                                                            | description                                 |
| priority                                                                               | priority                                    |
| required                                                                               | required                                    |
| managed\_type                                                                          | managed\_type                               |
| definition::data\_type                                                                 | definition\_data\_type                      |
| definition::input\_settings::placeholder                                               | definition\_input\_settings\_placeholder    |
| definition::input\_settings::min                                                       | definition\_input\_settings\_min            |
| definition::input\_settings::max                                                       | definition\_input\_settings\_max            |
| definition::input\_settings::input\_type                                               | definition\_input\_settings\_input\_type    |
| definition::input\_settings::choices                                                   | definition\_input\_settings\_input\_choices |
| definition::input\_settings::default                                                   | definition\_input\_settings\_default        |
| created\_datetime (not populated correctly: filled from priority, not a real date)     | created\_datetime                           |
| updated\_datetime (not populated correctly: filled from priority, not a real date)     | updated\_datetime                           |
| deactivated\_datetime (not populated correctly: filled from priority, not a real date) | deactivated\_datetime                       |
| Daasity: account id                                                                    | \_account\_id                               |
| MD5(id)                                                                                | \_\_sync\_key                               |

### **Events**

This table is only loaded when events extraction is enabled on the Gorgias integration.

* Endpoint: [Events](https://developers.gorgias.com/reference/get_api-events)
* Update Method: UPSERT
* Table Name: \[`gorgias.events`]

| JSON Element      | Database Column |
| ----------------- | --------------- |
| id                | event\_id       |
| uri               | event\_uri      |
| object\_type      | object\_type    |
| object\_id        | object\_id      |
| user\_id          | user\_id        |
| type              | event\_type     |
| context           | context         |
| created\_datetime | created\_at     |
| MD5(id)           | \_\_sync\_key   |

### **Tickets**

* Endpoint: [Tickets](https://developers.gorgias.com/reference/the-ticket-object)
* Update Method: UPSERT
* Table Name: \[`gorgias.tickets`]

| JSON Element                                             | Database Column      |
| -------------------------------------------------------- | -------------------- |
| id                                                       | ticket\_id           |
| external\_id                                             | external\_id         |
| channel                                                  | ticket\_channel      |
| via                                                      | via                  |
| from\_agent                                              | from\_agent          |
| status                                                   | ticket\_status       |
| priority                                                 | ticket\_priority     |
| requester::id                                            | requester\_id        |
| requester::email                                         | requester\_email     |
| requester::name                                          | requester\_name      |
| requester::firstname                                     | requester\_firstname |
| requester::lastname                                      | requester\_lastname  |
| customer::id                                             | customer\_id         |
| customer::email                                          | customer\_email      |
| customer::name                                           | customer\_name       |
| customer::firstname                                      | customer\_firstname  |
| customer::lastname                                       | customer\_lastname   |
| assignee\_user::firstname                                | assignee\_firstname  |
| assignee\_user::lastname                                 | assignee\_lastname   |
| assignee\_user::id                                       | assignee\_id         |
| assignee\_user::email                                    | assignee\_email      |
| subject                                                  | ticket\_subject      |
| except                                                   | ticket\_excerpt      |
| messages\_count                                          | messages\_count      |
| is\_unread                                               | is\_unread           |
| created\_datetime                                        | created\_at          |
| opened\_datetime                                         | opened\_at           |
| last\_received\_message\_datetime                        | last\_received\_at   |
| last\_message\_datetime                                  | last\_message\_at    |
| updated\_datetime                                        | updated\_at          |
| closed\_datetime                                         | closed\_at           |
| merged\_with                                             | merged\_with         |
| trashed\_datetime                                        | trashed\_at          |
| snooze\_datetime                                         | snooze\_at           |
| spam                                                     | spam                 |
| MD5(id + requestor::id + created\_datetime + source\_id) | \_\_sync\_key        |

### **Ticket Custom Fields**

* Endpoint: [Tickets](https://developers.gorgias.com/reference/the-ticket-object)
* Update Method: UPSERT
* Table Name: \[`gorgias.ticket_custom_fields`]

| JSON Element                           | Database Column                       |
| -------------------------------------- | ------------------------------------- |
| id                                     | ticket\_id                            |
| custom\_fields (key)                   | custom\_field\_id                     |
| custom\_fields::value                  | custom\_field\_value                  |
| custom\_fields::prediction::predicted  | custom\_field\_prediction\_predicted  |
| custom\_fields::prediction::confidence | custom\_field\_prediction\_confidence |
| custom\_fields::prediction::display    | custom\_field\_prediction\_display    |
| custom\_fields::prediction::confirmed  | custom\_field\_prediction\_confirmed  |
| custom\_fields::prediction::modified   | custom\_field\_prediction\_modified   |
| Daasity: account id                    | \_account\_id                         |
| MD5(id + custom field id + source\_id) | \_\_sync\_key                         |

### **Ticket Tags**

* Endpoint: [Tickets](https://developers.gorgias.com/reference/the-ticket-object) and [Tags](https://developers.gorgias.com/reference/the-tag-object)
* Update Method: UPSERT
* Table Name: \[`gorgias.ticket_tags`]

| JSON Element                | Database Column |
| --------------------------- | --------------- |
| id                          | ticket\_id      |
| tag::name                   | tag\_name       |
| tag::id                     | tag\_id         |
| account\_id                 | \_account\_id   |
| MD5(id + name + source\_id) | \_\_sync\_key   |

### **Ticket Messages**

* Endpoint: [Tickets](https://developers.gorgias.com/reference/the-ticket-object) and [Ticket Messages](https://developers.gorgias.com/reference/the-ticketmessage-object)
* Update Method: UPSERT
* Table Name: \[`gorgias.ticket_messages`]

| **JSON Element**                  | **Database Column** |
| --------------------------------- | ------------------- |
| id                                | message\_id         |
| ticket\_id                        | ticket\_id          |
| public                            | public              |
| channel                           | channel             |
| via                               | via                 |
| sender::id                        | sender\_id          |
| sender::email                     | sender\_email       |
| sender::name                      | sender\_name        |
| sender::firstname                 | sender\_firstname   |
| sender::lastname                  | sender\_lastname    |
| sender::channel                   | sender\_channel     |
| integration\_id                   | integration\_id     |
| from\_agent                       | from\_agent         |
| receiver::id                      | receiver\_id        |
| receiver::name                    | receiver\_name      |
| subject                           | subject             |
| stripped\_text                    | stripped\_text      |
| created\_datetime                 | created\_at         |
| sent\_datetime                    | sent\_at            |
| account\_id                       | \_account\_id       |
| MD5(id + ticket\_id + source\_id) | \_\_sync\_key       |

### **Users**

* Endpoint: [Users](https://developers.gorgias.com/reference/the-user-object)
* Update Method: UPSERT
* Table Name: \[`gorgias.users`]

| JSON Element               | Database Column |
| -------------------------- | --------------- |
| id                         | user\_id        |
| external\_id               | external\_id    |
| active                     | active          |
| email                      | user\_email     |
| firstname                  | first\_name     |
| lastname                   | last\_name      |
| name (no longer populated) | user\_name      |
| created\_datetime          | created\_at     |
| updated\_datetime          | updated\_at     |
| account\_id                | \_account\_id   |
| MD5(id + source\_id)       | \_\_sync\_key   |

### **Satisfaction Survey**

* Endpoint: [Satisfaction Surveys](https://developers.gorgias.com/reference/the-satisfactionsurvey-object)
* Update Method: UPSERT
* Table Name: \[`gorgias.satisfaction_survey`]

| JSON Element                                     | Database Column |
| ------------------------------------------------ | --------------- |
| id                                               | survey\_id      |
| customer\_id                                     | customer\_id    |
| ticket\_id                                       | ticket\_id      |
| sent\_datetime                                   | sent\_at        |
| scored\_datetime                                 | scored\_at      |
| body\_text                                       | body\_text      |
| score                                            | score           |
| created\_datetime                                | created\_at     |
| MD5(id + customer\_id + ticket\_id + source\_id) | \_\_sync\_key   |
