npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@chatlaio/sdk-react-native

v1.0.1

Published

Chatla SDK for React Native — events, traits, and WhatsApp/Messenger deep links.

Readme

Chatla SDK for React Native

Drop-in SDK for sending Chatla events and opening WhatsApp / Messenger deep links from a React Native app. API parity with the Unity SDK.

Install

The SDK ships as TypeScript source — Metro transpiles it via Babel, no build step needed.

From your React Native project:

npm install @chatlaio/sdk-react-native js-sha256
# or
yarn add @chatlaio/sdk-react-native js-sha256

Installing from source (while iterating on the SDK itself)

If you're developing the SDK locally, install it from a folder or git URL instead of the registry:

# local folder
yarn add file:../chatla-sdk-rn js-sha256
# git URL
yarn add github:Simply-Expert/chatla-sdk-rn js-sha256

Peer dependencies

  • react-native >= 0.60
  • js-sha256 (listed as a regular dependency; explicitly install it if your package manager doesn't auto-hoist)

No native modules are required. The SDK uses react-native's built-in Linking, Platform, and NativeModules only — works with Expo (managed and bare) and bare RN.

Setup

1. Initialize once at app startup

// App.tsx
import { useEffect } from 'react';
import { Chatla } from '@chatlaio/sdk-react-native';

export default function App() {
  useEffect(() => {
    Chatla.initialize({
      apiKey: 'YOUR_API_KEY',
      secretKey: 'YOUR_SECRET_KEY',
      // Optional — set once the user is signed in, or omit for guest sessions
      userId: undefined,
      // Optional — used if the backend doesn't return a phone / page id
      fallbackPhone: '15551234567',
      fallbackPageId: 'your-fb-page-id',
      // Optional metadata for event payloads
      appVersion: '1.2.3',
      deviceModel: 'iPhone15,3',
    });
  }, []);

  // ...
}

If you want to read appVersion / deviceModel automatically, install react-native-device-info and pass them yourself:

import DeviceInfo from 'react-native-device-info';

Chatla.initialize({
  apiKey: '...',
  secretKey: '...',
  appVersion: DeviceInfo.getVersion(),
  deviceModel: DeviceInfo.getModel(),
});

2. Identify the user (after sign-in / onboarding)

// Tell Chatla which user this session belongs to
Chatla.setUserId('user-123');

// Send the onboarding event with their phone — this is what makes the user "identified"
Chatla.identify('+15551234567', 'pro-tier', { signup_source: 'app_store' });

identify() and userOnboard() are aliases — pick whichever reads better.

3. Open WhatsApp / Messenger

import { Button } from 'react-native';

<Button title="Chat on WhatsApp" onPress={() => Chatla.openWhatsapp()} />
<Button title="Chat on Messenger" onPress={() => Chatla.openMessenger()} />

The SDK fetches the configured phone / page id from /me, flushes any pending traits, and opens the system deep link. If the user is already identified, the prefilled onboarding message is skipped.

4. Send events

import { Chatla, ChatlaEventType } from '@chatlaio/sdk-react-native';

Chatla.gameStart();
Chatla.levelUp(5, { difficulty: 'hard' });
Chatla.iapTransaction({
  productId: 'gold_pack_100',
  isFirstPurchase: true,
  purchaseCount: 1,
});

// Or directly with the enum
Chatla.sendEvent(ChatlaEventType.AchievementUnlocked, {
  achievement_id: 'first_win',
});

Events are only delivered once the user is identified (the SDK queues nothing — it drops events sent before identification, with the exception of UserOnboard).

5. Set traits

Chatla.setTrait('subscription_tier', 'pro');
Chatla.setTraits({ preferred_language: 'en', has_referral: true });

Traits are queued locally and flushed when the user becomes identified, or right before opening WhatsApp/Messenger.

6. GDPR — tracking consent & deletion

// Pause / resume tracking based on user consent
Chatla.setTrackingEnabled(false);

// On account deletion: drop user state and stop sending data
Chatla.onUserRequestedDeletion();

API surface

| Method | Purpose | | ------------------------------------------------ | ---------------------------------------------------- | | Chatla.initialize(opts) | One-time init | | Chatla.setUserId(id) | Associate or change the user id (re-fetches /me) | | Chatla.identify(phone, tag?, customData?) | Onboard — required before non-onboarding events flow | | Chatla.sendEvent(type, customData?) | Raw event | | Chatla.gameStart() / levelUp() / iapTransaction() / ... | Typed convenience wrappers | | Chatla.openWhatsapp() | Deep-link to WhatsApp | | Chatla.openMessenger() | Deep-link to Facebook Messenger | | Chatla.setTrait(key, value) / setTraits(map) | Queue/flush user traits | | Chatla.setTrackingEnabled(bool) | GDPR consent toggle | | Chatla.onUserRequestedDeletion() | GDPR account deletion | | Chatla.state / Chatla.isIdentified | Current state |

For advanced cases (multiple clients, dependency injection), import the underlying class:

import { ChatlaClient } from '@chatlaio/sdk-react-native';
const client = new ChatlaClient({ apiKey, secretKey });

Notes

  • Singleton. Only one initialize() call takes effect; subsequent calls are ignored (matches the Unity SDK).
  • Async transport. sendEvent / setTraits are fire-and-forget — network failures are logged via console.warn, never thrown.
  • Identified gating. Non-onboarding events are dropped until /me confirms identification — same behavior as the Unity SDK.
  • No native modules. Compatible with Expo Go.

License

MIT