Skip to content

Instantly share code, notes, and snippets.

@justlev
Last active February 6, 2022 11:40
Show Gist options
  • Save justlev/ebe0dd7eb8bb9f84c4ec0639b17db795 to your computer and use it in GitHub Desktop.
Save justlev/ebe0dd7eb8bb9f84c4ec0639b17db795 to your computer and use it in GitHub Desktop.
Integrate once & forget
import {StatewizeClient} from "statewize-client-sdk";
const sdk = new StatewizeClient(process.env.STW_TOKEN);
// Report an action, along with its state (start/finished/failed):
await sdk.reportEvent({ slug: `checkout-express`, type: 'finished',
// Optionally, add data attachments that will help you debug
attachments: [{
type: 'object', // can be any object, file or text you like
content: { object: { res, errors, whatever }}}]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment