# Referral SaaSquatch

Referral SaaSquatch is a cloud-based loyalty, referral and rewards marketing platform.

Referral SaaSquatch integration replicates data using the [Referral SaaSquatch REST API](https://docs.referralsaasquatch.com/api/).

See the [Schema](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Referral-SaaSquatch.htm#Schema) section for a list of objects available for replication.

## Preparing for authentication

To access your data, you need to authenticate the connection with your account credentials.

Information noteMake sure that the account you use has read access to the tables you want to fetch.

You must have the Full Access role in your Referral SaaSquatch admin portal.

To retrieve your API key and tenant alias:

1. Log into your [Referral SaaSquatch](https://auth.saasquatch.com/login?state=hKFo2SAzVGlmTUZPcEpmY282NzBrcWMtZlZpVTE3Tng2dHpRZqFupWxvZ2luo3RpZNkgSDMtYVV4bzFuczhkVzdUcy0ySFZLYW5CWUxVUURHR2ujY2lk2SBCVTF0QkZzd3Q5bGVSS09JeDBtUmwzZThEM3FDMEJXcg&client=BU1tBFswt9leRKOIx0mRl3e8D3qC0BWr&protocol=oauth2&redirect_uri=https%3A%2F%2Fapp.referralsaasquatch.com%2Fauth0%2Fcallback&response_type=code&scope=openid%20email) account.
2. Choose your tenant from the tenant selection dropdown.
3. Go to Settings &gt; General.
4. In the Tenant details section, click the eye icon to reveal the API key and locate the Tenant Alias field.
5. Copy and paste your API key and tenant alias into a secured file.

## Creating the connection

For more information, see [Connecting to SaaS applications](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/Landing/connecting-web-applications.htm).

1. Fill in the required connection properties.

2. Provide a name for the connection in Connection name.

3. Select Open connection metadata to define metadata for the connection when it has been created.

4. Click Create.

Connection settings

| Setting | Description |
| --- | --- |
| Data gateway | Select a Data Movement gateway if required by your use case.<br><br>Information note<br><br>This field is not available with the Qlik Talend Cloud Starter subscription, as it does not support Data Movement gateway. If you have another subscription tier and do not want to use Data Movement gateway, select None.<br><br>For information on the benefits of Data Movement gateway and use cases that require it, see [Qlik Data Gateway - Data Movement](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Gateways/replication-gateway.htm). |
| Start Date | Enter the date, in the format `MM/DD/YYYY`, from which the data must be replicated from your source to your target. |
| API Key | API key. |
| Tenant Alias | Tenant alias. |

## Schema

Information note

Schemas and naming conventions can change from version to version. It is recommended to verify your version before continuing.

Depending on your destination, table and column names may not appear as they are outlined below.

### referrals

The `referrals` table contains info about all of the referrals in your Referral SaaSquatch tenant.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Key** | id |
| **Useful links** | [Referral SaaSquatch documentation](https://docs.referralsaasquatch.com/api/methods/#open_list_referrals)<br><br>[Referral SaaSquatch API method](https://docs.referralsaasquatch.com/api/methods/#list_referrals "Opens in new tab: Referral SaaSquatch API method") |

referrals table foreign keys

| Join referrals with | on |
| --- | --- |
| [reward_balances](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Referral-SaaSquatch.htm#reward-balances) | ```<br>referrals.referredUser = reward_balances.userId<br>```<br><br>```<br>referrals.referrerUser = reward_balances.userId<br>```<br><br>```<br>referrals.referredAccount = reward_balances.accountId<br>```<br><br>```<br>referrals.referrerAccount = reward_balances.accountId<br>``` |
| [users](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Referral-SaaSquatch.htm#users) | ```<br>referrals.referredUser = users.id<br>```<br><br>```<br>referrals.referrerUser = users.id<br>```<br><br>```<br>referrals.referredAccount = users.accountId<br>```<br><br>```<br>referrals.referrerAccount = users.accountId<br>``` |

referrals table schema

| **dateConverted**<br><br>DATE-TIME |
| --- |
| **dateModerated**<br><br>DATE-TIME |
| **dateReferralEnded**<br><br>DATE-TIME |
| **dateReferralPaid**<br><br>DATE-TIME |
| **dateReferralStarted**<br><br>DATE-TIME |
| **id**<br><br><br>OBJECT<br><br>This is a nested data structure. |
| **programId**<br><br><br>STRING |
| **referredAccount**<br><br><br>STRING |
| **referredModerationStatus**<br><br><br>STRING |
| **referredReward**<br><br><br>STRING |
| **referredUser**<br><br><br>STRING |
| **referrerAccount**<br><br><br>STRING |
| **referrerModerationStatus**<br><br><br>STRING |
| **referrerReward**<br><br><br>STRING |
| **referrerUser**<br><br><br>STRING |

### reward\_balances

The `reward_balances` table contains info about the balances for all rewards.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Keys** | userId<br><br>accountId |
| **Useful links** | [Referral SaaSquatch API method](https://docs.referralsaasquatch.com/api/methods#list_balances "Opens in new tab: Referral SaaSquatch API method") |

reward\_balances table foreign keys

| Join reward\_balances with | on |
| --- | --- |
| [referrals](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Referral-SaaSquatch.htm#referrals) | ```<br>reward_balances.userId = referrals.referredUser<br>```<br><br>```<br>reward_balances.userId = referrals.referrerUser<br>```<br><br>```<br>reward_balances.accountId = referrals.referredAccount<br>```<br><br>```<br>reward_balances.accountId = referrals.referrerAccount<br>``` |
| [users](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Referral-SaaSquatch.htm#users) | ```<br>reward_balances.userId = users.id<br>```<br><br>```<br>reward_balances.accountId = users.accountId<br>``` |

reward\_balances table schema

| **accountId**<br><br><br>OBJECT<br><br>This is a nested data structure. |
| --- |
| **amount**<br><br><br>INTEGER |
| **type**<br><br><br>STRING |
| **unit**<br><br><br>STRING |
| **userId**<br><br><br>OBJECT<br><br>This is a nested data structure. |

### users

The `users` table contains info about the users in your Referral SaaSquatch tenant.

| **Replication Method** | CDC |
| --- | --- |
| **Primary Keys** | id<br><br>accountId |
| **Useful links** | [Referral SaaSquatch API method](https://docs.referralsaasquatch.com/api/methods#list_users "Opens in new tab: Referral SaaSquatch API method") |

users table foreign keys

| Join users with | on |
| --- | --- |
| [referrals](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Referral-SaaSquatch.htm#referrals) | ```<br>users.id = referrals.referredUser<br>```<br><br>```<br>users.id = referrals.referrerUser<br>```<br><br>```<br>users.accountId = referrals.referredAccount<br>```<br><br>```<br>users.accountId = referrals.referrerAccount<br>``` |
| [reward_balances](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/DataIntegration/WebApplications/Connecting-Referral-SaaSquatch.htm#reward-balances) | ```<br>users.id = reward_balances.userId<br>```<br><br>```<br>users.accountId = reward_balances.accountId<br>``` |

users table schema

| **accountId**<br><br><br>OBJECT<br><br>This is a nested data structure. |
| --- |
| **dateCreated**<br><br>DATE-TIME |
| **email**<br><br><br>STRING |
| **emailHash**<br><br><br>STRING |
| **emailShareLink**<br><br><br>STRING |
| **facebookShareLink**<br><br><br>STRING |
| **firstName**<br><br><br>STRING |
| **firstSeenIP**<br><br><br>STRING |
| **id**<br><br><br>OBJECT<br><br>This is a nested data structure. |
| **imageUrl**<br><br><br>STRING |
| **lastName**<br><br><br>STRING |
| **lastSeenIP**<br><br><br>STRING |
| **linkedinShareLink**<br><br><br>STRING |
| **locale**<br><br><br>STRING |
| **referralSource**<br><br><br>STRING |
| **shareLink**<br><br><br>STRING |
| **twitterShareLink**<br><br><br>STRING |