npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

qonversion-sdk

v1.0.9

Published

⚡️ An SDK to easily access Qonversions Restful API

Downloads

133

Readme

Qonversion SDK

The Qonversion SDK is an npm package that allows easy access to the Qonversion API in JavaScript and TypeScript projects. It is well-documented with js/ts examples, making it simpler for developers to access the functionality provided by the API without the need for a deep-dive into Qonversion's documentation.

Installation

Install qonversion-sdk using npm

npm install qonversion-sdk

Install qonversion-sdk using yarn

yarn add qonversion-sdk

See Sections Demo

Demo Code

import QonversionClient from "qonversion-sdk";

const qonversionClient = new QonversionClient(secretKey, projectKey);

// Call the get identity function
qonversionClient
  .getIdentity("USER ID")
  .then((response) => {
    console.log(response);
  })
  .catch((err) => {
    console.log(err);
  });

Demo Response

{
  "id": string;
  "user_id": string;
}

Demo (Using Require)

const QonversionClient = require("qonversion-sdk").default;

const qonversionClient = new QonversionClient(secretKey, projectKey);

// Call the get identity function
qonversionClient
  .getIdentity("USER ID")
  .then((response) => {
    console.log(response);
  })
  .catch((err) => {
    console.log(err);
  });

Demo Response

{
  "id": string;
  "user_id": string;
}

API

.getUser(userId: string)

Get a user based on their Qonversion user ID.

Parameters

  • userId [required] - The Qonversion user ID.

Response

{
  id: string;
  created: number;
  environment: Environment;
  identity_id: string;
}

.createUser(userId: string, environment: Qonversion.Environment)

Create a user using a custom user ID.

Parameters

  • userId [required] - The custom user ID.
  • environment [required] - The environment in which the user is created.

Response

{
  id: string;
  created: number;
  environment: Qonversion.Environment;
}

.getUserProperties(userId: string)

Get a user's properties based on their Qonversion user ID.

Parameters

  • userId [required] - The Qonversion user ID.

Response

[
  {
    key: string;
    value: string;
  },
  {
    key: string;
    value: string;
  }
]

.setUserProperties(userId: string, properties: Qonversion.UserProperties)

Set a user's properties based on their Qonversion user ID.

Parameters

  • userId [required] - The Qonversion user ID.
  • properties [required] - The properties to set.

Response

{
  savedProperties: [
    {
      key: string;
      value: string;
    },
    {
      key: string;
      value: string;
    }
  ],
  propertyErrors: [
    {
      key: string;
      error: string;
    },
    {
      key: string;
      error: string;
    }
  ];
}

.getIdentity(identityId: string)

Get a Qonversion user ID based on a custom user ID.

Parameters

  • identityId [required] - The custom user ID.

Response

{
  id: string;
  user_id: string;
}

.createIdentity(identityId: string, userId: string)

Create a new identity using a custom identity id

Parameters

  • identityId [required] - The custom identity ID.
  • userId [required] - The Qonversion user ID.

Response

{
  id: string;
  user_id: string;
}

.getEntitlements(userId: string)

Get a user's entitlements based on their Qonversion user ID.

Parameters

  • userId [required] - The Qonversion user ID.

Response

{
  data: [
    {
      id: string;
      active: boolean;
      started: number;
      expires: number;
      product: {
        product_id: string;
        subscription?: {
          current_period_type: "normal" | "trial" | "intro";
          renewal_state: "will_renew" | "canceled" | "billing_issue";
        };
      };
    }
  ]
}

.grantEntitlement(userId: string, entitlementId: string, expires: number)

Grant an entitlement to a user based on their Qonversion user ID.

Parameters

  • userId [required] - The Qonversion user ID.
  • entitlementId [required] - The entitlement ID.

No response

.revokeEntitlement(userId: string, entitlementId: string)

Revoke an entitlement from a user based on their Qonversion user ID.

Parameters

  • userId [required] - The Qonversion user ID.

No response