Skip to content
Airchat SDK and API documentation
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md

README.md

Airchat SDK

Overview

  1. Who can help me to add Airchat to my website?
  2. Airchat SDK
  3. Airchat API (coming soon)

Who can help me?

If you have questions, you can always email or skype us(gamanuk_alexander)! If you found a bug feel free to create an issue.

Getting Started

This is a simplified walkthrough to see the platform in action. Register at airchat.us to learn more.

  1. Register on airchat.us using your Google account.
  2. Add a JavaScript snippet to your website. Copy the snippet here https://airchat.us/settings/install-pixel. Airchat Pixel

Airchat SDK

The Airchat SDK allows you to pass some information about users to Airchat. Add the following JavaScript code before the body tag closing.

    <script type='text/javascript' src="https://widget.airchat.us/scripts/sdk.js"></script>
    <script>
        setTimeout(function () { 
            airchatSdk.identify('5938104868471', { //EXTERNAL USER ID
                customFields: {
                    'first-name': 'Alexander' //USER FIRST NAME
                },
                appFields: {
                    subscription: {
                        stripe: {
                            customerId: 'cus_DoI173JzBQyefN' //STRIPE CUSTOMER ID 
                        }
                    }
                }
            }); 
        }, 2000);
    </script>

1. Load sdk.js

Add the https://widget.airchat.us/scripts/sdk.js as to the header.

 <script type='text/javascript' src="https://widget.airchat.us/scripts/sdk.js"></script>

2. Initialize Airchat SDK

Call airchatSdk.identify and pass the external user id from your database as the first parameter.

Example: airchatSDK.identify

3. Add customFields

You can pass any extra information about the uses by adding the customFields field. Usually it's used to add users first name, last name, email, current plan, etc. Example: airchatSDK.identify custom fields

4. Add Stripe Customer id

If you're using Stripe API inside your Airchat bots you're required to pass the Stripe Customer ID. To do that you need to add the appFields object to the airchatSdk.identify call.

           appFields: {
                    subscription: {
                        stripe: {
                            customerId: 'cus_DoI173JzBQyefN' //STRIPE CUSTOMER ID 
                        }
                    }
                }

Example: airchatSDK.identify stripe customer id

See the complete example here.

You can’t perform that action at this time.