{"id":26406485,"url":"https://github.com/js00001/qonversion-sdk","last_synced_at":"2025-03-17T17:20:00.863Z","repository":{"id":229092894,"uuid":"775747734","full_name":"JS00001/qonversion-sdk","owner":"JS00001","description":"⚡️ An SDK to easily access Qonversions Restful API","archived":false,"fork":false,"pushed_at":"2024-09-09T22:49:46.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-10T17:23:14.270Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JS00001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-22T01:01:48.000Z","updated_at":"2024-09-09T22:49:49.000Z","dependencies_parsed_at":"2024-03-22T02:34:07.727Z","dependency_job_id":null,"html_url":"https://github.com/JS00001/qonversion-sdk","commit_stats":null,"previous_names":["js00001/qonversion-sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JS00001%2Fqonversion-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JS00001%2Fqonversion-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JS00001%2Fqonversion-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JS00001%2Fqonversion-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JS00001","download_url":"https://codeload.github.com/JS00001/qonversion-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244075623,"owners_count":20393980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-17T17:20:00.182Z","updated_at":"2025-03-17T17:20:00.857Z","avatar_url":"https://github.com/JS00001.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Qonversion SDK\n\nThe 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.\n\n## Installation\n\nInstall qonversion-sdk using **npm**\n\n```bash\nnpm install qonversion-sdk\n```\n\nInstall qonversion-sdk using **yarn**\n\n```bash\nyarn add qonversion-sdk\n```\n\n### See Sections [Demo](#demo-code)\n\n## Demo Code\n\n```javascript\nimport QonversionClient from \"qonversion-sdk\";\n\nconst qonversionClient = new QonversionClient(secretKey, projectKey);\n\n// Call the get identity function\nqonversionClient\n  .getIdentity(\"USER ID\")\n  .then((response) =\u003e {\n    console.log(response);\n  })\n  .catch((err) =\u003e {\n    console.log(err);\n  });\n```\n\n## Demo Response\n\n```javascript\n{\n  \"id\": string;\n  \"user_id\": string;\n}\n```\n\n## Demo (Using Require)\n\n```javascript\nconst QonversionClient = require(\"qonversion-sdk\").default;\n\nconst qonversionClient = new QonversionClient(secretKey, projectKey);\n\n// Call the get identity function\nqonversionClient\n  .getIdentity(\"USER ID\")\n  .then((response) =\u003e {\n    console.log(response);\n  })\n  .catch((err) =\u003e {\n    console.log(err);\n  });\n```\n\n## Demo Response\n\n```javascript\n{\n  \"id\": string;\n  \"user_id\": string;\n}\n```\n\n## API\n\n#### .getUser(userId: string)\n\nGet a user based on their Qonversion user ID.\n\n**Parameters**\n\n- `userId` \\[required\\] - The Qonversion user ID.\n\n**Response**\n\n```javascript\n{\n  id: string;\n  created: number;\n  environment: Environment;\n  identity_id: string;\n}\n```\n\n#### .createUser(userId: string, environment: Qonversion.Environment)\n\nCreate a user using a custom user ID.\n\n**Parameters**\n\n- `userId` \\[required\\] - The custom user ID.\n- `environment` \\[required\\] - The environment in which the user is created.\n\n**Response**\n\n```javascript\n{\n  id: string;\n  created: number;\n  environment: Qonversion.Environment;\n}\n```\n\n#### .getUserProperties(userId: string)\n\nGet a user's properties based on their Qonversion user ID.\n\n**Parameters**\n\n- `userId` \\[required\\] - The Qonversion user ID.\n\n**Response**\n\n```javascript\n[\n  {\n    key: string;\n    value: string;\n  },\n  {\n    key: string;\n    value: string;\n  }\n]\n\n```\n\n#### .setUserProperties(userId: string, properties: Qonversion.UserProperties)\n\nSet a user's properties based on their Qonversion user ID.\n\n**Parameters**\n\n- `userId` \\[required\\] - The Qonversion user ID.\n- `properties` \\[required\\] - The properties to set.\n\n**Response**\n\n```javascript\n{\n  savedProperties: [\n    {\n      key: string;\n      value: string;\n    },\n    {\n      key: string;\n      value: string;\n    }\n  ],\n  propertyErrors: [\n    {\n      key: string;\n      error: string;\n    },\n    {\n      key: string;\n      error: string;\n    }\n  ];\n}\n```\n\n#### .getIdentity(identityId: string)\n\nGet a Qonversion user ID based on a custom user ID.\n\n**Parameters**\n\n- `identityId` \\[required\\] - The custom user ID.\n\n**Response**\n\n```javascript\n{\n  id: string;\n  user_id: string;\n}\n```\n\n#### .createIdentity(identityId: string, userId: string)\n\nCreate a new identity using a custom identity id\n\n**Parameters**\n\n- `identityId` \\[required\\] - The custom identity ID.\n- `userId` \\[required\\] - The Qonversion user ID.\n\n**Response**\n\n```javascript\n{\n  id: string;\n  user_id: string;\n}\n```\n\n#### .getEntitlements(userId: string)\n\nGet a user's entitlements based on their Qonversion user ID.\n\n**Parameters**\n\n- `userId` \\[required\\] - The Qonversion user ID.\n\n**Response**\n\n```javascript\n{\n  data: [\n    {\n      id: string;\n      active: boolean;\n      started: number;\n      expires: number;\n      product: {\n        product_id: string;\n        subscription?: {\n          current_period_type: \"normal\" | \"trial\" | \"intro\";\n          renewal_state: \"will_renew\" | \"canceled\" | \"billing_issue\";\n        };\n      };\n    }\n  ]\n}\n```\n\n#### .grantEntitlement(userId: string, entitlementId: string, expires: number)\n\nGrant an entitlement to a user based on their Qonversion user ID.\n\n**Parameters**\n\n- `userId` \\[required\\] - The Qonversion user ID.\n- `entitlementId` \\[required\\] - The entitlement ID.\n\n**No response**\n\n#### .revokeEntitlement(userId: string, entitlementId: string)\n\nRevoke an entitlement from a user based on their Qonversion user ID.\n\n**Parameters**\n\n- `userId` \\[required\\] - The Qonversion user ID.\n\n**No response**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs00001%2Fqonversion-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjs00001%2Fqonversion-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs00001%2Fqonversion-sdk/lists"}