Quick start
Web
Three calls: start the SDK, tell it who the user is, and turn on push. Ten minutes if your push setup already works.
1. Install
terminal
npm install @chumbaq/sdk2. Start the SDK and identify the user
Find your API key and project ID in your project's settings. Read them from your app's config rather than hard-coding them. Call identify right after login with your own user ID.
app start-up
import Chumbaq from '@chumbaq/sdk';
const chumbaq = new Chumbaq({
baseUrl: 'https://your-chumbaq-host',
apiKey: '<project API key>',
projectId: '<project id>',
});
await chumbaq.init();
// Who this is, once they log in.
await chumbaq.identify({
externalUserId: 'u_42',
deviceFingerprint: chumbaq.deviceFingerprint,
platform: 'web',
});3. Turn on push
Web push uses your Firebase project's web credentials and service worker; Chumbaq registers the token you get from it.
push
// The token from your own Firebase Messaging setup.
await chumbaq.registerPushToken({
token: fcmToken,
platform: 'web',
provider: 'fcm',
});Next
- Add your FCM and APNs credentials
- Send traits and events to build segments
- Send a test push from the dashboard, then email us and we'll check your setup with you.