Skip to content

[P-830] fix: remove trailing comma in package.json for valid JSON#2

Merged
yosriady merged 1 commit into
mainfrom
P-830
Dec 29, 2025
Merged

[P-830] fix: remove trailing comma in package.json for valid JSON#2
yosriady merged 1 commit into
mainfrom
P-830

Conversation

@HtetShwe
Copy link
Copy Markdown
Contributor

No description provided.

@linear
Copy link
Copy Markdown

linear Bot commented Dec 29, 2025

P-830 SDK: Server-side events Node.js SDK

Ask yos to explain before starting

Request from xena

What

Most analytics platforms have 2 types of SDKs:

Create a Node.js SDK to enable builders to send custom events from the server.

Server-side SDK API

  • The server-side SDK should allow builders to send to the events.formo.so API:
  • See how the Web SDK generates the common properties (anonymous_id, user_id, message_id,…) the server-side SDK should match it
    • version must be string
    • anonymousId should be anonymous_id and a uuid
    • user_id must be present or be empty string ""
    • address must be a valid ethereum address or empty string ""
    • original_timestamp must be present
    • message_id must be 64 chars length

Testing

To test, send a relevant event with the SDK to tinybird. Use the SDK Write Key found in the workspace settings page of the Formo / formo.so project. You can test on the local backend.

Review the raw_events in Tinybird for correctness (select by message_id)

Note if validation fails (e.g. if channel, version is missing) it will go to raw_events_quarantine

References:

import { Analytics } from '@segment/analytics-node'
// or, if you use require:
const { Analytics } = require('@segment/analytics-node')

// instantiation
const analytics = new Analytics({ writeKey: '<MY_WRITE_KEY>' })

app.post('/login', (req, res) => {
   analytics.identify({
      userId: req.body.userId,
      previousId: req.body.previousId
  })

app.post('/cart', (req, res) => {
  analytics.track({
    userId: req.body.userId,
    event: 'Add to cart',
    properties: { productId: '123456' }
  })
   res.sendStatus(201)
});

How

Consider using https://www.stainless.com/ (need an open api spec for the POST /raw_events endpoint)

Stainless lets you generate SDKs for other languages

Choose typescript target

Examples

@yosriady yosriady merged commit 6719055 into main Dec 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants