### Install SaaSquatch CLI Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/themes-publish.md Install the saasquatch-cli globally using npm. This makes the `squatch` executable available in your system's PATH. ```bash npm install -g saasquatch-cli ``` -------------------------------- ### Example user.created Event Payload Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/api/webhooks.md An example of the JSON payload received when a user is created. ```APIDOC ## Example user.created Event Payload This is an example of the payload structure for a `user.created` event: ```json { "id": "577303ece4b066c5cb171835", "type": "user.created", "tenantAlias": "aohgcctyskc0p", "live": true, "created": 1467155436449, "data": { "id": "sat09jsaet09setset", "accountId": "90w4etjsa4et", "email": "mike.keenerson@example.com", "firstName": "Mike", "lastName": "Keenerson", "referralCodes": { "referral-program": "MIKEKEENERSON", "partner-program": "FREE" }, "imageUrl": "", "firstSeenIP": "10.230.163.157", "lastSeenIP": null, "dateCreated": 1467155436418, "locale": "fr_CA", "countryCode": "CA", "programShareLinks": { "partner-program": { "cleanShareLink": "http://example.com/free", "MOBILE": { "DIRECT": "http://example.com/free?me" }, "EMAIL": { "DIRECT": "http://example.com/free?mP" }, "UNKNOWN": { "DIRECT": "http://example.com/free?mv" } } }, "customFields": { "birthday": "--02-29" }, "segments": ["segment1"], "referredByCodes": ["CODE1"] } } ``` ``` -------------------------------- ### Install CocoaPods Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/mobile-ios-quickstart.md Install CocoaPods using this Terminal command if it is not already on your system. ```bash sudo gem install cocoapods ``` -------------------------------- ### Example Mobile Widget URL Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/guides-mobile-installation.md An example of a fully constructed URL for the mobile widget, demonstrating the inclusion of all necessary parameters. ```url https://app.referralsaasquatch.com/a/{{tenantalias}}/widgets/mobilewidget?jwt={{calculated_JWT}}&systemId=abc_123&userId=abc_123&email=john%40example.com&firstName=John&lastName=Doe&referralCode=JANEDOE&accountStatus=TRIAL&mode=EMPTY ``` -------------------------------- ### Example: Publish Change URL Event Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/theming/widgetjs.md This example demonstrates how to use `widget.rpc.ready` to ensure the event bus is initialized before publishing a `changeUrl` event with a new URL in the payload when a specific button is clicked. ```javascript widget.rpc.ready(function() { $(\'#changeURL\').click(function() { widget.rpc.publish(\"changeUrl\", { url : \"http://www.referralsaasquatch.com/done\" }); }); }); ``` -------------------------------- ### Example Short Tags Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/theming/short-tags.md Examples of commonly used short tags for referral links and codes. ```html {{referralcode}} ``` ```html {{twittersharelink}} ``` -------------------------------- ### Example Landing Page URL with Discount Code Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/adding-custom-landing-page-parameters.md Demonstrates how a landing page URL with a custom parameter is handled by SaaSquatch. ```text www.example.com/landingpage?discountCode=REFERRED20 ``` -------------------------------- ### User Info Dictionary Example Objective-C Source: https://github.com/saasquatch/saasquatch-docs/blob/production/public/mobile/ios/docs-objectivec/Classes/Saasquatch/index.html An example of the NSDictionary structure required for the userInfo parameter when registering a user. It includes essential fields like 'id' and 'accountId', along with optional details. ```objectivec NSDictionary *userInfo = @{ @"id" : @"10001110101", @"accountId" : @"10001110101", @"email" : @"claire@lallybroch.com", @"firstName" : @"Claire", @"lastName" : @"Fraser", @"locale" : @"en_US", @"referralCode" : @"CLAIREFRASER" }; ``` -------------------------------- ### Start Import Job (GraphQL) Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/developer-bulk-import.md Initiates a bulk import job using the `createJob` GraphQL mutation. Requires the `fileRef` and job `type`. ```APIDOC ## POST /api/v1/{tenant_alias}/graphql ### Description Starts a bulk import job using the `createJob` GraphQL mutation. Returns the job `id` upon successful creation. ### Method POST ### Endpoint `https://app.referralsaasquatch.com/api/v1/{tenant_alias}/graphql` ### Parameters #### Request Body - **variables** (object) - Required - Contains job input details. - **jobInput** (object) - Required. - **type** (string) - Required - The type of job (e.g., `MUTATION/USER`, `MUTATION/DELETE_USER`, `MUTATION/USER_EVENT`, `MUTATION/REDEEMABLE_REWARD_BALANCE`). - **outputFormat** (string) - Optional - The desired output format (e.g., `CSV`). - **fileRef** (string) - Required - The reference obtained from the file upload step. - **query** (string) - Required - The GraphQL query string: `mutation ($jobInput: JobInput!) { createJob(jobInput: $jobInput) {id type requester dateCreated}}` ### Request Example ```curl curl -X POST https://app.referralsaasquatch.com/api/v1/{tenant_alias}/graphql -u :{tenant_api_key} -H "Content-Type: application/json" -d '{ "variables":{ "jobInput": { "type":"{job_type}", "outputFormat":"CSV", "fileRef":"{file_ref}" } }, "query":"mutation ($jobInput: JobInput!) { createJob(jobInput: $jobInput) {id type requester dateCreated}}" }' ``` ### Response #### Success Response (200) - **data.createJob.id** (string) - The unique identifier for the created import job. - **data.createJob.type** (string) - The type of the import job. - **data.createJob.requester** (string) - Indicates who initiated the job (e.g., `API`). - **data.createJob.dateCreated** (integer) - Timestamp when the job was created. ``` -------------------------------- ### Example Folder Structure for Packaged Translations Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/features-program-i18n.md This example shows how to structure your translated files within the zip archive. Translated files for specific locales (e.g., `fr_FR.json`, `en_US.json`) are placed in the corresponding subfolders for emails, widgets, and rewards. ```json Your_Program_Name.zip ├── /Emails | ├── /programEmailID <-- Place your translated email files here | | ├── fr_FR.json | | └── en_US.json | └── programEmailID.json ├── /Rewards | ├── /referredReward <-- Place your translated referred reward files here | | ├── fr_FR.json | | └── en_US.json | ├── /referrerReward <-- Place your translated referrer reward files here | | ├── fr_FR.json | | └── en_US.json | └── referredReward.json | └── referrerReward.json └── /Widgets ├── /programWidgetID <-- Place your translated widget files here | ├── fr_FR.json | └── en_US.json └── programWidgetID.json ``` -------------------------------- ### Asset Pipeline Output Example Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/theming/assets.html This shows the expected HTML output after the `{{assets}}` helper processes the references, including CDN paths and versioning. ```html
```
--------------------------------
### Mobile Widget URL Parameters
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/mobile-widget-reference.md
Example parameters to construct the Mobile Widget URL. Ensure all parameters are URL encoded.
```nohighlight
https://app.referralsaasquatch.com/a/test_345gh4545g23kj3/widgets/mobilewidget
?userId=123
&firstName=Bob
&lastName=Testserson
&accountId=abc
&paymentProviderId=NULL
&email=misterd%2Bmuser001%40example.com
&jwt={{calculated_JWT}}
```
--------------------------------
### test Webhook Example
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/api/webhooks.md
This webhook is used to test a subscription. It sends a sample payload to the configured endpoint.
```json
{
"id": "1337049u0194u2105",
"type": "test",
"tenantAlias": "AAA111BBB222DDD333",
"live": false,
"created": 1337001337,
"data": {
"endpointUrl": "http://example.com/hook",
"name": "Example"
}
}
```
--------------------------------
### theme.publish.finished Webhook Example
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/api/webhooks.md
This webhook is sent after a theme has been successfully published to a tenant. It contains information about the new assets version.
```json
{
"id": "577407a6e4b0cc57c1e2e6a6",
"type": "theme.publish.finished",
"tenantAlias": "aohgcctyskc0p",
"live": true,
"created": 1467221926388,
"data": {
"newAssetsVersion": "CQOkemZF"
}
}
```
--------------------------------
### titleMarginStart
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/public/mobile/android/docs/com/referralsaasquatch/sampleapp/R.attr.html
Sets the start margin for the title. Must be a dimension value (e.g., '14.5sp').
```APIDOC
## titleMarginStart
### Description
Sets the start margin for the title.
### Type
Dimension value (e.g., '14.5sp').
```
--------------------------------
### Get Account Reward API Response
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/guides/pctDiscountGuide.md
Example response when looking up account reward details. This includes the discount percentage applicable to the customer.
```json
{
"accountId":"SV0TYE5OWI11120144",
"discountPercentage":20,
"referrerDiscountPercent":10,
"referredDiscountPercent":10
}
```
--------------------------------
### Initialize Podfile
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/mobile-ios-quickstart.md
Create a Podfile in your Xcode project directory if one does not already exist.
```bash
pod init
```
--------------------------------
### init
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/developer-squatchjs-v2-reference.md
Initializes the static `squatch` global, setting up static instances for `squatch.api()` and `squatch.widgets()`.
```APIDOC
## init
Initializes the static `squatch` global. This sets up:
- `squatch.api()` a static instance of the [WidgetApi](#widgetapi)
- `squatch.widgets()` a static instance of [Widgets](#widgets)
### Properties
- `tenantAlias` (string) - The Tenant that you're using.
- `domain` (string) - The domain for API. Defaults to `https://app.referralsaasquatch.com`
### Request Example
```javascript
squatch.init({tenantAlias:'test_basbtabstq51v'});
```
### Returns
- `void`
```
--------------------------------
### View SaaSquatch CLI Help
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/themes-publish.md
Access the help documentation for the `squatch` CLI to see available commands and options.
```bash
squatch --help
```
--------------------------------
### referral.started Webhook Example (Classic)
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/api/webhooks.md
This webhook is sent when a new referral is successfully established in the classic system. It includes detailed referral and moderation status information.
```json
{
"id": "5773073fe4b066c5cb171900",
"type": "referral.started",
"tenantAlias": "aohgcctyskc0p",
"live": true,
"created": 1467156287085,
"data": {
"id": "5773073ee4b066c5cb1718fc",
"referredUser": "5773073ee4b08b14ab979fb8",
"referrerUser": "577306eae4b08b14ab979f70",
"referred": {
"id": "5773073ee4b08b14ab979fb8",
"accountId": "5773073ee4b08b14ab979fb8"
},
"referrer": {
"id": "577306eae4b08b14ab979f70",
"accountId": "577306eae4b08b14ab979f70"
},
"referralCodeUsed": "LORETTABURKE10",
"shareLinkUsed": "http://ssqt.co/mPbcF5",
"moderationStatus": "PENDING",
"dateReferralStarted": 1467156286882,
"dateReferralPaid": null,
"dateConverted": null,
"dateReferralEnded": null,
"dateModerated": 1467156286882,
"referredModerationStatus": "PENDING",
"referrerModerationStatus": "PENDING",
"fraudSignals": null
}
}
```
--------------------------------
### Tab Padding Start
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/public/mobile/android/docs/com/wholepunk/saasquatch/R.attr.html
Defines the start padding for the tabs. Accepts dimension values with various units.
```APIDOC
## tabPaddingStart
### Description
Defines the start padding for the tabs. This attribute accepts a dimension value, which is a floating-point number appended with a unit such as "14.5sp". Available units include px, dp, sp, in, and mm. It can also be a reference to a resource or theme attribute.
### Type
Dimension value or resource reference
```
--------------------------------
### Initialize WidgetApi in Browser
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/developer-squatchjs-v2-reference.md
Instantiates the WidgetApi for browser environments, requiring only the tenant alias.
```javascript
var squatchApi = new squatch.WidgetApi({tenantAlias:'test_12b5bo1b25125'});
```
--------------------------------
### Create a Referred Account
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/guides/pctDiscountGuide-nojs.md
Use the Account Sync API to create a new account and include the referral code to link it to the referrer. Set the subscription status, for example, to 'TRIAL' for new signups.
```bash
$ curl -X POST https://app.referralsaasquatch.com/api/v1/{tenant_alias}/accountsync \
-u API_KEY: \
-H "Content-Type: application/json" \
-d '{
"id": "def456",
"subscription": {
"status": "TRIAL"
},
"referral": {
"code": "SUPERBOB"
}
}'
```
--------------------------------
### Example Message Link URL
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/features-message-links.md
An example of a fully constructed message link for a user sharing via email on mobile for the 'klip-referral-program'.
```curl
https://app.referralsaasquatch.com/a/test_aut32av0b11uc/message/redirect/EMAIL?engagementMedium=MOBILE&accountId=messageLink&userId=messageLink&programId=klip-referral-program
```
--------------------------------
### Legacy Deep Linking Data Example
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/mobile-appsflyer.md
Example JSON payload for Legacy Deep Linking, including referral code and share link.
```json
{
"pid": "saasquatch_int",
"c": "saasquatch",
"af_web_dp": "http://myReferralLandingPage.com",
"utm_source": "invite",
"utm_medium": "link",
"utm_campaign": "saasquatch",
"rsCode": "REFERRALCODE",
"rsShareMedium": "UNKNOWN",
"rsEngagementMedium": "UNKNOWN",
"_saasquatch": "eyJhcHAucmVmZXJyYWxzYWFzcXVhdGNoLmNvbSI6eyJ0ZXN0XzEyMzQ1NjdfQ09ERSI6eyJjb2RlcyI6eyJyZWZlcnJhbCI6IlJFRkVSUkFMQ09ERSJ9LCJjb2Rlc0V4cCI6eyJSRUZFUlJBTENPREUiOjE2Mjk1ODIxOTl9LCJsaW5rcyI6eyJyZWZlcnJhbCI6Imh0dHBzOi8vc3NxdC5jby9temFBMjIifSwibGlua3NFeHAiOnsiaHR0cHM6Ly9zc3F0LmNvL216YUEyMiI6MTYyOTU4MjE5OX19fX0="
}
```
--------------------------------
### Initialize Squatch.js with Account Status
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/guides/conversion.md
Use this to initialize Squatch.js and trigger a conversion by setting the account_status to 'PAID'. Omit account_status if using payment system connectors.
```javascript
_sqh.push(['init', {
tenant_alias: 'test_bpinhag9yagag',
account_id: 'abc',
payment_provider_id: null,
user_id: '5678',
email: 'bob@example.com',
first_name: 'John',
// account_status: 'PAID' // Include the value "PAID" to trigger a conversion. Omit it if you're using a payment system connectors like Stripe and Recurly.
}]);
```
--------------------------------
### referral.started Webhook Example (GA)
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/api/webhooks.md
This webhook is sent when a new referral is successfully established in the GA (non-classic) system. It includes basic referral details.
```json
{
"id": "5773073fe4b066c5cb171900",
"type": "referral.started",
"tenantAlias": "aohgcctyskc0p",
"live": true,
"created": 1467156287085,
"data": {
"id": "5773073ee4b066c5cb1718fc",
"referred": {
"id": "5773073ee4b08b14ab979fb8",
"accountId": "5773073ee4b08b14ab979fb8"
},
"referrer": {
"id": "577306eae4b08b14ab979f70",
"accountId": "577306eae4b08b14ab979f70"
},
"referralCodeUsed": "LORETTABURKE10",
"shareLinkUsed": "http://ssqt.co/mPbcF5",
"moderationStatus": "PENDING",
"dateReferralStarted": 1467156286882,
"dateConverted": null
}
}
```
--------------------------------
### Unified Deep Linking Data Example
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/mobile-appsflyer.md
Example JSON payload for Unified Deep Linking, including referral code and share link.
```json
{
"pid": "saasquatch_int",
"c": "saasquatch",
"af_web_dp": "http://myReferralLandingPage.com",
"deep_link_sub1": "eyJhcHAucmVmZXJyYWxzYWFzcXVhdGNoLmNvbSI6eyJ0ZXN0XzEyMzQ1NjdfQ09ERSI6eyJjb2RlcyI6eyJyZWZlcnJhbCI6IlJFRkVSUkFMQ09ERSJ9LCJjb2Rlc0V4cCI6eyJSRUZFUlJBTENPREUiOjE2Mjk1ODIxOTl9LCJsaW5rcyI6eyJyZWZlcnJhbCI6Imh0dHBzOi8vc3NxdC5jby9temFBMjIifSwibGlua3NFeHAiOnsiaHR0cHM6Ly9zc3F0LmNvL216YUEyMiI6MTYyOTU4MjE5OX19fX0=",
"deep_link_sub2": "invite",
"deep_link_sub3": "link",
"deep_link_sub4": "saasquatch",
"deep_link_sub5": "REFERRALCODE",
"deep_link_sub6": "UNKNOWN",
"deep_link_sub7": "UNKNOWN"
}
```
--------------------------------
### Initialize Widgets Instance (Browser)
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/developer-squatchjs-v2-reference.md
Instantiate the `Widgets` class in a browser environment by providing your `tenantAlias`. This is the standard way to begin using SaaSquatch widgets.
```javascript
var widgets = new squatch.Widgets({tenantAlias:'test_12b5bo1b25125'});
```
--------------------------------
### Example Personalized Mobile Widget URL
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/mobile-widget-reference.md
A complete example of a personalized URL for the Mobile Widget, combining base URL and encoded parameters.
```nohighlight
https://app.referralsaasquatch.com/a/test_345gh4545g23kj3/widgets/mobilewidget?userId=123&firstName=Bob&lastName=Testserson&accountId=abc&paymentProviderId=NULL&email=misterd%2Bmuser001%40example.com&checksum={{calculated_JWT}}
```
--------------------------------
### Render Widget for Classic Referral Programs
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/developer-squatchjs-v2-reference.md
An example of rendering a widget for classic referral programs using the `squatch.widgets().render` method. This includes user details, engagement medium, widget type, and an optional JWT for validation. The promise resolves with widget and user details or rejects with an error.
```javascript
var initObj = {
user: {
id: 'abc_123',
accountId: 'abc_123'
},
engagementMedium: 'EMBED',
widgetType: 'REFERRER_WIDGET',
jwt: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiYWJjXzEyMyIsImFjY291bnRJZCI6ImFiY18xMjMifX0.Sor56NRtkKqZKLLOy8177bFee5ukiS2-__R1s34KNOE'
};
squatch.widgets().render(initObj).then(function(response) {
user = response.user;
}).catch(function(error){
console.log(error);
});
```
--------------------------------
### Segment Identify Event Body Example
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/integrations-segment-v2-subscription.md
Example of an Identify event body received from Segment, used for user upserts and segment transformations in SaaSquatch.
```json
{
"messageId": "test-message-rxya2",
"timestamp": "2021-01-12T22:28:04.947Z",
"type": "identify",
"email": "test@example.org",
"projectId": "nczL0it7lw",
"traits": {
"trait1": 1,
"trait2": "test",
"trait3": true
},
"userId": "test-user-524utb"
}
```
--------------------------------
### Example SaaSquatch Web Component
Source: https://github.com/saasquatch/saasquatch-docs/blob/production/content/articles/developer-widgets-writing-a-web-component-for-saasquatch.md
This is an example of a SaaSquatch web component for a share link with a copy button. It demonstrates how custom components are represented in HTML.
```html