Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qonversion-sdk

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qonversion-sdk

⚡️ An SDK to easily access Qonversions Restful API

  • 1.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
32
decreased by-43.86%
Maintainers
0
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 30 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc