1import { createOxinion } from 'oxinion';
2
3const oxinion = createOxinion({ apiKey: process.env.OXINION_API_KEY! });
4
5// 1. Register the user's Expo push token (call this once on app start)
6await oxinion.notify.registerToken({
7 userId: "user_123",
8 token: "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
9});
10
11// 2. Send a push notification directly
12const result = await oxinion.notify.send({
13 userId: "user_123",
14 title: "You're near our store!",
15 body: "Get 20% off today only.",
16 data: { deepLink: "myapp://offer/SAVE20" },
17});
18
19console.log(result.ticketId); // Expo ticket ID
20
21// Or use inside a pipeline for automatic location-triggered pushes:
22await oxinion.nodes.create({
23 pipelineId: "pipe_abc",
24 type: "notify",
25 orderIndex: 0,
26 config: {
27 userId: "{{userId}}",
28 title: "Welcome to {{geofenceName}}!",
29 body: "Tap for your exclusive offer.",
30 data: { deepLink: "myapp://offer" },
31 },
32});