# Integration Specifications

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

## **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)
* [Events](#events)
* [Tickets](#tickets)
* [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                                | setting\_id               |
| settings::type                              | setting\_type             |
| settings::data::timezone                    | timezone                  |
| settings::data::business\_hours::days       | business\_days            |
| settings::data::business\_hours::to\_time   | business\_close           |
| settings::data::business\_hours::from\_time | 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  |
| \_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            |

### **Events**

* Endpoint:
* Update Method: UPSERT
* Table Name: \[`gorgias.event`]

| 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           |
| trashed\_datetime                                        | trashed\_at          |
| snooze\_datetime                                         | snooze\_at           |
| MD5(id + requestor::id + created\_datetime + 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::email                   | receiver\_email     |
| receiver::name                    | receiver\_name      |
| receiver::firstname               | receiver\_firstname |
| receiver::lastname                | receiver\_lastname  |
| receiver::meta::name\_set\_via    | receiver\_channel   |
| subject                           | subject             |
| body\_text                        | body\_text          |
| stripped\_text                    | stripped\_text      |
| created\_datetime                 | created\_at         |
| sent\_datetime                    | send\_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                 | 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   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.daasity.com/core-concepts/data-integrations/setup-guides/digital-integrations/gorgias/integration-specifications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
