# Integration Specifications

KnoCommerce allows you to show post-purchase surveys on your website. These surveys can unlock powerful insights that are hard to glean from other types of data, such as: where customers most commonly hear about your brand and whether they're buying for themselves or others.

Daasity exposes this raw data for you to do your own analysis. We enable you analyze all of your survey response data and will also will incorporate responses to the standard "How did you first hear about us?" post-purchase question into your attribution reporting.

## Refresh Cadence

This extractor pulls the last 2 complete days of data during the nightly refresh.

## Availability

This integration is available for:

* Enterprise
* Growth

## API Endpoints

This extractor is based on the [KNO REST API](https://developers.knocommerce.com/#c5344d0e-97e4-4723-8627-b01afeecd44c). The following endpoints are used to replicate data into Daasity:

* [List Benchmark Questions](https://developers.knocommerce.com/#227a7e79-1f31-4e8a-b839-2cc04dc89497)
* [List Responses](https://developers.knocommerce.com/#c5344d0e-97e4-4723-8627-b01afeecd44c)
* [List Surveys](https://developers.knocommerce.com/#1b6f457e-c60c-4ea7-be57-14ea0c8d0273)

## Entity Relationship Diagram (ERD)

{% @lucid/lucid-component url="<https://lucid.app/lucidchart/45e31e02-9a65-4168-a6c8-d1a880f43bad/view>" fullWidth="true" %}

## KnoCommerce Schema

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

* [Benchmarks](#benchmarks)
* [Response Values](#response-values)
* [Responses](#responses)
* [Survey Questions](#survey-questions)
* [Surveys](#surveys)

### Benchmarks

* Endpoint: [List Benchmark Questions](https://developers.knocommerce.com/#227a7e79-1f31-4e8a-b839-2cc04dc89497)
* Update Method: UPSERT
* Table Name: `[knocommerce.benchmarks]`

| JSON Element                                          | Database Column            |
| ----------------------------------------------------- | -------------------------- |
| questions\[].id                                       | BENCHMARK\_QUESTION\_ID    |
| questions\[].label                                    | BENCHMARK\_QUESTION\_LABEL |
| questions\[].title                                    | BENCHMARK\_QUESTION\_TITLE |
| MD5(BENCHMARK\_QUESTION\_ID + KnoCommerce account ID) | \_\_SYNC\_KEY              |

### Response Values

* Endpoint: [List Responses](https://developers.knocommerce.com/#c5344d0e-97e4-4723-8627-b01afeecd44c)
* Update Method: UPSERT
* Table Name: `[knocommerce.response_values]`

| JSON Element                                              | Database Column    |
| --------------------------------------------------------- | ------------------ |
| results\[].id                                             | RESPONSE\_ID       |
| results\[].response\[].attribution\_type                  | ATTRIBUTION\_TYPE  |
| results\[].response\[].value                              | VALUE              |
| results\[].response\[].type                               | TYPE               |
| results\[].response\[].label                              | LABEL              |
| results\[].response\[].quesion\_id                        | QUESTION\_ID       |
| results\[].response\[].question\_duration                 | QUESTION\_DURATION |
| results\[].response\[].other                              | OTHER              |
| MD5(RESPONSE\_ID + QUESTION\_ID + KnoCommerce account ID) | \_\_SYNC\_KEY      |

### Responses

* Endpoint: [List Responses](https://developers.knocommerce.com/#c5344d0e-97e4-4723-8627-b01afeecd44c)
* Update Method: UPSERT
* Table Name: `[knocommerce.responses]`

| JSON Element                               | Database Column                           |
| ------------------------------------------ | ----------------------------------------- |
| results\[].response\[].id                  | RESPONSE\_ID                              |
| results\[].response\[].account\_id         | ACCOUNT\_ID                               |
| results\[].response\[].created\_at         | CREATED\_AT                               |
| results\[].response\[].updated\_at         | UPDATED\_AT                               |
| results\[].response\[].completed\_at       | COMPLETED\_AT                             |
| results\[].response\[].                    | CUSTOMER\_ID                              |
| results\[].response\[].                    | CUSTOMER\_EMAIL                           |
| results\[].response\[].                    | CUSTOMER\_PHONE                           |
| results\[].response\[].                    | CUSTOMER\_SHOP                            |
| results\[].response\[].                    | CUSTOMER\_LIFETIME\_SPENT                 |
| results\[].response\[].                    | CUSTOMER\_LIFETIME\_ORDERS                |
| results\[].response\[].                    | TIME\_SPENT                               |
| results\[].response\[].                    | SURVEY\_ID                                |
| results\[].response\[].                    | RESPONSE\_ORDER\_RESPONSE\_ID             |
| results\[].response\[].                    | RESPONSE\_ORDER\_ORDER\_ID                |
| results\[].response\[].                    | RESPONSE\_ORDER\_ORDER\_NUMBER            |
| results\[].response\[].                    | RESPONSE\_ORDER\_TOTAL\_PRICE             |
| results\[].response\[].                    | RESPONSE\_ORDER\_CURRENCY                 |
| results\[].response\[].                    | RESPONSE\_ORDER\_BROWSER\_IP              |
| results\[].response\[].                    | RESPONSE\_ORDER\_USER\_AGENT              |
| results\[].response\[].                    | CUSTOMER\_JOURNEY\_RESPONSE\_ID           |
| results\[].response\[].                    | CUSTOMER\_JOURNEY\_ORDER\_ID              |
| results\[].response\[].                    | CUSTOMER\_JOURNEY\_LAST\_VISIT\_SOURCE    |
| results\[].response\[].                    | CUSTOMER\_JOURNEY\_LAST\_VISIT\_UTM       |
| results\[].response\[].                    | CUSTOMER\_JOURNEY\_FIRST\_VISIT\_SOURCE   |
| results\[].response\[].                    | CUSTOMER\_JOURNEY\_FIRST\_VISIT\_UTM      |
| results\[].response\[].                    | CUSTOMER\_JOURNEY\_DAYS\_TO\_CONVERSION   |
| results\[].response\[].                    | CUSTOMER\_JOURNEY\_CUSTOMER\_ORDER\_INDEX |
| MD5(RESPONSE\_ID + KnoCommerce account ID) | \_\_SYNC\_KEY                             |
| results\[].response\[].order.id            | RESPONSE\_ORDER\_ID                       |

### Survey Questions

* Endpoint: [List Surveys](https://developers.knocommerce.com/#1b6f457e-c60c-4ea7-be57-14ea0c8d0273)
* Update Method: UPSERT
* Table Name: `[knocommerce.survey_questions]`

| JSON Element                                            | Database Column  |
| ------------------------------------------------------- | ---------------- |
| results\[].id                                           | SURVEY\_ID       |
| results\[].questions\[].id                              | QUESTION\_ID     |
| results\[].questions\[].label                           | LABEL            |
| results\[].questions\[].type                            | TYPE             |
| results\[].questions\[].values                          | QUESTION\_VALUES |
| MD5(SURVEY\_ID + QUESTION\_ID + KnoCommerce account ID) | \_\_SYNC\_KEY    |

### Surveys

* Endpoint: [List Surveys](https://developers.knocommerce.com/#1b6f457e-c60c-4ea7-be57-14ea0c8d0273)
* Update Method: UPSERT
* Table Name: `[knocommerce.surveys]`

| JSON Element                             | Database Column |
| ---------------------------------------- | --------------- |
| results\[].id                            | SURVEY\_ID      |
| results\[].accountId                     | ACCOUNT\_ID     |
| results\[].createdAt                     | CREATED\_AT     |
| results\[].updatedAt                     | UPDATED\_AT     |
| results\[].title                         | TITLE           |
| MD5(SURVEY\_ID + KnoCommerce account ID) | \_\_SYNC\_KEY   |
