react-native-contlo

1.3.0-beta.2 • Public • Published

React Native Contlo

SDK Installation

Install Contlo's React Native plugin using the npm package manager.

$ cd path_to_your_project

Add the contlo plugin from npm

$ npm install react-native-contlo

Please note: if you're using Expo for development, be sure to be using the "bare workflow".

ContloAPI Usage

import { ContloAPI } from 'react-native-contlo'

// Init ContloAPI with your Stores public API key
// call this function in your index.js file
ContloAPI.init({apiKey: '<YOUR_API_KEY>'})

// Set email, phone one of the fields is mandatory for sending a request
ContloAPI.set.userEmail('john@example.com')
ContloAPI.set.userPhone('+912223334444')

// Set methods (optional)
ContloAPI.set.userFirstName('John')
ContloAPI.set.userLastName('Doe')
ContloAPI.set.userCity('bangalore')
ContloAPI.set.userProvince('')
ContloAPI.set.userZip('560010')
ContloAPI.set.userCountry('india')

// Get methods 
ContloAPI.get.userEmail()
ContloAPI.get.userPhone()
ContloAPI.get.userFirstName()
ContloAPI.get.userLastName()
ContloAPI.get.userCity()
ContloAPI.get.userProvince()
ContloAPI.get.userZip()
ContloAPI.get.userCountry()

// Events Template
// Template for sending any custom/user Events to contlo (events)
// {
//   "event": "<event_key>",
//   "email": "john@example.com",
//   "phone_number": "+912223334444",
//   "properties": {
//     "key1": "<key1>",
//     "key2": <key2>,
//   }
// }

// Template Profile Identification (create/set customer profile)
// {
//   "custom_properties": {
//     "property1": "<value1>",
//     "property2": "<value2>",
//   },
//   "first_name": "John",
//   "last_name": "Doe",
//   "email": "john@example.com",
//   "phone_number": "+12223334444",
//   "country": "india",
//   "zip": "560010",
//   "city": "bangalore"
// }

// If you don't want to send customProperties just pass in an empty object {}

// Send methods (async methods) - return type promise
ContloAPI.send.event({event: event, properties: properties})
ContloAPI.send.profile({customProperties: customProperties})

Package Sidebar

Install

npm i react-native-contlo

Weekly Downloads

1

Version

1.3.0-beta.2

License

ISC

Unpacked Size

16.3 MB

Total Files

33

Last publish

Collaborators

  • rupam-kerketta
  • hertzbit