npm.io
1.1.3 • Published 2 years ago

justwords-node

Licence
MIT
Version
1.1.3
Deps
4
Size
135 kB
Vulns
0
Weekly
0

Just Words Node SDK

Typescript library for Just Words (YC W24).

Get Started

Installation

npm install justwords-node
Initialize
import {JustWords} from "justwords-node";

// Initialize client
await JustWords.initialize({apiKey, orgId});

// Get copy variant for a template
const copy = JustWords.getCopy("<template-id>");

// Get copy variant for a template, filtered by language (depends on how the metrics are set up)
const copyJa = JustWords.getCopy("<template-id>", { criteria: { language: "ja" } });

// Print copy ID
console.log(copy.id);        // "<copy-id>"

// Print copy variable
console.log(copy.vars.text); // "just setting up my copy"
Tips:
  • The initialize function must be awaited before calling JustWords.getCopy. JustWords.getCopy will throw if it has not been initialized first.
  • JustWords.getCopy will throw if the template ID is not known. A template must be created in advance before fetching any copy variants.

Changelog

1.1.2 (2024-06-11)
  • Updated prefetchData to return the data directly and updated the types to be used in other libraries
  • Removed 'stats' param from 'Copy' definition. Should be unused.
1.1.0 (2024-05-31)
  • Rewrote the pipeline to be more modular
  • Added "epsilon sampling" so that some percentage of copy are randomly shown
1.0.11 (2024-05-02)
  • Added jitter to the polling function and increased default polling period from 1 min to 10 min.
1.0.10 (2024-04-30)
  • Removed lingering console.log
1.0.9 (2024-04-30)
  • Can set host as an initialization param. Preparing for on-prem use-cases.
1.0.8
  • New changelog!
1.0.7 (2024-04-17)
  • Fixed issue where API key was being passed as an Authorization header and not as an 'X-Api-Key' header.

Keywords