# Integration Specifications

## Integration Overview

Snapchat is a microblogging and social networking service on which users post and interact with messages. Merchants can advertise on and use Snapchat to redirect and generate sales.

The Daasity Snapchat integration extracts data from the marketing endpoints needed to populate the UMS table.

## Integration Availability

This integration is available for:

* Enterprise
* Growth

## API Endpoints

The Daasity Snapchat extractor is built based on this [Snapchat Marketing API documentation](https://marketingapi.snapchat.com/docs/#introduction).  The following endpoints are used by Daasity to replicate data from Snapchat:

* [Organizations](https://marketingapi.snapchat.com/docs/#organizations)
* [Ad Accounts](https://marketingapi.snapchat.com/docs/#ad-accounts)
* [Campaigns](https://marketingapi.snapchat.com/docs/#campaigns)
* [Ad Squads](https://marketingapi.snapchat.com/docs/#ad-squads)
* [Ads](https://marketingapi.snapchat.com/docs/#ads)
* [Media](https://marketingapi.snapchat.com/docs/#media)
* [Creatives](https://marketingapi.snapchat.com/docs/#creatives)
* [Measurement](https://marketingapi.snapchat.com/docs/#measurement)

## Entity Relationship Diagram (ERD)

[Click here to view the ERD for the Daasity Snapchat integration](https://lucid.app/documents/embedded/82baf09b-38de-43c8-af74-3d6435f7de0a) illustrating the different tables and keys to join across tables.

## Snapchat Schema

The Daasity Snapchat 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.

* [Organizations](#organizations)
* [Ad Accounts](#a-d-accounts)
* [Campaigns](#campaigns)
* [Ad Squads](#a-d-squads)
* [Ads](#a-ds)
* [Media](#media)
* [Creatives](#creatives)
* [Measurement](#measurement)

### **Organizations**

* Endpoint: [Organizations](https://marketingapi.snapchat.com/docs/#organizations)
* Update Method: UPSERT
* Table Name: \[`snapchat.organizations`]

| JSON Element                       | Database Column                    |
| ---------------------------------- | ---------------------------------- |
| id                                 | organization\_id                   |
| name                               | organization\_name                 |
| type                               | type                               |
| created\_at                        | created\_at                        |
| updated\_at                        | updated\_at                        |
| locality                           | locality                           |
| administrative\_district\_level\_1 | administrative\_district\_level\_1 |
| country                            | country                            |
| postal\_code                       | postal\_code                       |
| MD5(id)                            | \_\_sync\_key                      |

### **Ad Accounts**

* Endpoint: [Ad Accounts](https://marketingapi.snapchat.com/docs/#ad-accounts)
* Update Method: UPSERT
* Table Name: \[`snapchat.ad_accounts`]

| JSON Element                 | Database Column              |
| ---------------------------- | ---------------------------- |
| id                           | ad\_account\_id              |
| name                         | ad\_account\_name            |
| type                         | type                         |
| status                       | status                       |
| created\_at                  | created\_at                  |
| updated\_at                  | updated\_at                  |
| organization\_id             | organization\_id             |
| currency                     | currency                     |
| timezone                     | timezone                     |
| advertiser\_organization\_id | advertiser\_organization\_id |
| MD5(id + organization\_id)   | \_\_sync\_key                |

### **Campaigns**

* Endpoint: [Campaigns](https://marketingapi.snapchat.com/docs/#campaigns)
* Update Method: UPSERT
* Table Name: \[`snapchat.campaigns`]

| JSON Element               | Database Column      |
| -------------------------- | -------------------- |
| id                         | campaign\_id         |
| name                       | campaign\_name       |
| status                     | status               |
| ad\_account\_id            | ad\_account\_id      |
| created\_at                | created\_at          |
| updated\_at                | updated\_at          |
| start\_time                | start\_time          |
| end\_time                  | end\_time            |
| daily\_budget\_micro       | daily\_budget\_micro |
| MD5(id + organization\_id) | \_\_sync\_key        |

### **Ad Squads**

* Endpoint: [Ad Squads](https://marketingapi.snapchat.com/docs/#ad-squads)
* Update Method: UPSERT
* Table Name: \[`snapchat.adsquads`]

| JSON Element               | Database Column      |
| -------------------------- | -------------------- |
| id                         | adsquad\_id          |
| name                       | adsquad\_name        |
| type                       | type                 |
| status                     | status               |
| campaign\_id               | campaign\_id         |
| created\_at                | created\_at          |
| updated\_at                | updated\_at          |
| placement                  | placement            |
| billing\_event             | billing\_event       |
| auto\_bid                  | auto\_bid            |
| target\_bid                | target\_bid          |
| bid\_strategy              | bid\_strategy        |
| daily\_budget\_micro       | daily\_budget\_micro |
| optimization\_goal         | optimization\_goal   |
| MD5(id + organization\_id) | \_\_sync\_key        |

### **Ads**

* Endpoint: [Ads](https://marketingapi.snapchat.com/docs/#ads)
* Update Method: UPSERT
* Table Name: \[`snapchat.ads`]

| JSON Element               | Database Column |
| -------------------------- | --------------- |
| id                         | ad\_id          |
| name                       | ad\_name        |
| type                       | type            |
| status                     | status          |
| created\_at                | created\_at     |
| updated\_at                | updated\_at     |
| ad\_squad\_id              | ad\_squad\_id   |
| creative\_id               | creative\_id    |
| MD5(id + organization\_id) | \_\_sync\_key   |

### **Media**

* Endpoint: [Media](https://marketingapi.snapchat.com/docs/#media)
* Update Method: UPSERT
* Table Name: \[`snapchat.media`]

| JSON Element               | Database Column |
| -------------------------- | --------------- |
| id                         | media\_id       |
| name                       | media\_name     |
| type                       | type            |
| status                     | status          |
| created\_at                | created\_at     |
| updated\_at                | updated\_at     |
| file\_name                 | file\_name      |
| ad\_account\_id            | ad\_account\_id |
| MD5(id + organization\_id) | \_\_sync\_key   |

### **Creatives**

* Endpoint: [Creatives](https://marketingapi.snapchat.com/docs/#creatives)
* Update Method: UPSERT
* Table Name: \[`snapchat.creatives`]

<table><thead><tr><th width="379">JSON Element</th><th>Database Column</th></tr></thead><tbody><tr><td>id</td><td>creative_id</td></tr><tr><td>name</td><td>creative_name</td></tr><tr><td>type</td><td>type</td></tr><tr><td>packaging_status</td><td>packaging_status</td></tr><tr><td>review_status</td><td>review_status</td></tr><tr><td>created_at</td><td>created_at</td></tr><tr><td>updated_at</td><td>updated_at</td></tr><tr><td>shareable</td><td>shareable</td></tr><tr><td>call_to_action</td><td>call_to_action</td></tr><tr><td>top_snap_media_id</td><td>top_snap_media_id</td></tr><tr><td>top_snap_crop_position</td><td>top_snap_crop_position</td></tr><tr><td>longform_video_properties::video_media_id</td><td>longform_video_media_id</td></tr><tr><td>app_install_properties::app_name</td><td>install_app_name</td></tr><tr><td>app_install_properties::ios_app_id</td><td>install_ios_app_id</td></tr><tr><td>app_install_properties::android_app_url</td><td>install_android_app_url</td></tr><tr><td>app_install_properties::icon_media_id</td><td>install_app_icon_media_id</td></tr><tr><td>web_view_properties::url</td><td>web_view_url</td></tr><tr><td>ad_account_id</td><td>ad_account_id</td></tr><tr><td>MD5(id + organization_id)</td><td>__sync_key</td></tr></tbody></table>

### **Measurement**

* Endpoint: [Measurement](https://marketingapi.snapchat.com/docs/#measurement)
* Update Method: UPSERT
* Table Name: \[`snapchat.measurement`]

| JSON Element                                                                                                                                                                                                          | Database Column                       |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| MD5(campaign\_id + timeseries\_stat::swipe\_up\_attribution\_window + timeseries\_stat::view\_attribution\_window +  timeseries\_stat::granularity + ad\_time::start\_time + timeseries\_stat::id + organization\_id) | measurement\_id                       |
| campaign\_id                                                                                                                                                                                                          | campaign\_id                          |
| timeseries\_stat::swipe\_up\_attribution\_window                                                                                                                                                                      | swipe\_up\_attribution\_window        |
| timeseries\_stat::view\_attribution\_window                                                                                                                                                                           | view\_attribution\_window             |
| timeseries\_stat::granularity                                                                                                                                                                                         | granularity                           |
| ad\_time::start\_time                                                                                                                                                                                                 | start\_time                           |
| ad\_time::end\_time                                                                                                                                                                                                   | end\_time                             |
| timeseries\_stat::id                                                                                                                                                                                                  | ad\_id                                |
| impressions                                                                                                                                                                                                           | impressions                           |
| swipes                                                                                                                                                                                                                | swipes                                |
| quartile\_1                                                                                                                                                                                                           | quartile\_1                           |
| quartile\_2                                                                                                                                                                                                           | quartile\_2                           |
| quartile\_3                                                                                                                                                                                                           | quartile\_3                           |
| view\_completion                                                                                                                                                                                                      | view\_completion                      |
| attachment\_quartile\_1                                                                                                                                                                                               | attachment\_quartile\_1               |
| attachment\_quartile\_2                                                                                                                                                                                               | attachment\_quartile\_2               |
| attachment\_quartile\_3                                                                                                                                                                                               | attachment\_quartile\_3               |
| attachment\_view\_completion                                                                                                                                                                                          | attachment\_view\_completion          |
| attachment\_total\_view\_time\_millis                                                                                                                                                                                 | attachment\_total\_view\_time\_millis |
| spend                                                                                                                                                                                                                 | spend                                 |
| video\_views                                                                                                                                                                                                          | video\_views                          |
| shares                                                                                                                                                                                                                | shares                                |
| saves                                                                                                                                                                                                                 | saves                                 |
| story\_opens                                                                                                                                                                                                          | story\_opens                          |
| story\_completes                                                                                                                                                                                                      | story\_completes                      |
| attachment\_video\_views                                                                                                                                                                                              | attachment\_video\_views              |
| total\_installs                                                                                                                                                                                                       | total\_installs                       |
| conversion\_purchases                                                                                                                                                                                                 | conversion\_purchases                 |
| conversion\_purchases\_value                                                                                                                                                                                          | conversion\_purchases\_value          |
| conversion\_save                                                                                                                                                                                                      | conversion\_save                      |
| conversion\_start\_checkout                                                                                                                                                                                           | conversion\_start\_checkout           |
| conversion\_add\_cart                                                                                                                                                                                                 | conversion\_add\_cart                 |
| conversion\_view\_content                                                                                                                                                                                             | conversion\_view\_content             |
| conversion\_add\_billing                                                                                                                                                                                              | conversion\_add\_billing              |
| conversion\_sign\_ups                                                                                                                                                                                                 | conversion\_sign\_ups                 |
| conversion\_searches                                                                                                                                                                                                  | conversion\_searches                  |
| conversion\_level\_completes                                                                                                                                                                                          | conversion\_level\_completes          |
| conversion\_app\_opens                                                                                                                                                                                                | conversion\_app\_opens                |
| conversion\_page\_views                                                                                                                                                                                               | conversion\_page\_views               |
| MD5(campaign\_id + timeseries\_stat::swipe\_up\_attribution\_window + timeseries\_stat::view\_attribution\_window +  timeseries\_stat::granularity + ad\_time::start\_time + timeseries\_stat::id + organization\_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/snapchat/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.
