panthera-hubspot-package
v1.24.0
Published
hubspot
Downloads
59
Readme
Panthera Hubspot Wrapper
Simplifying the usage of Hubspot for Panthera Platform
Usage
First you need to initialize instance of hubspot by passing API_KEY to it
import { CRM } from "panthera-hubspot-package";
const crm = new CRM(HUBSPOT_API);
After it's initialized following methods are avaliable:
Create Player
Interface:
interface CreatePlayer {
uuid: string;
firstName: string;
lastName: string;
email: string;
dob: string;
country: string;
city: string;
currency: string;
address: string;
token: string;
locale: string;
username?: string;
kycStatus?: boolean;
sex?: string;
marketingTag?: string;
isVerified?: boolean;
loginStatus?: boolean;
phoneNumber?: string;
referral?: string;
bonusCode?: string;
hasBonusActive?: boolean;
consent?: boolean;
}
Example usage:
const hubspot = await crm.createPlayer({
...player,
locale: locale.name, // String
});
Example Response:
{
"id": 1,
"properties": {
"address": "Test Street 122",
"bonuscode": null,
"city": "Test",
"consent": "true",
"country": "Test",
"createdate": "2021-04-27T13:45:21.570Z",
"date_of_birth": "1995-03-22T20:40:32.000Z",
"email": "[email protected]",
"firstname": "Test",
"has_bonus_active": "false",
"hs_is_unworked": "true",
"hs_marketable_status": "false",
"hs_marketable_until_renewal": "false",
"is_verified": "false",
"kycstatus": "false",
"lastmodifieddate": "2021-04-27T13:45:21.570Z",
"lastname": "Test",
"locale": "en_US",
"login_status": "false",
"marketing_tag": "test",
"phone": null,
"referral": null,
"sex": "Not Specified",
"token": "uuidv4",
"username": "test_username",
"uuid": "uuidv4"
},
"createdAt": "2021-04-27T13:45:21.570Z",
"updatedAt": "2021-04-27T13:45:21.570Z",
"archived": false
}
Update Player
Interface:
interface UpdatePlayer {
uuid?: string;
firstName?: string;
lastName?: string;
email?: string;
dob?: string;
country?: string;
city?: string;
address?: string;
token?: string;
locale?: string;
username?: string;
kycStatus?: boolean;
sex?: string;
marketingTag?: string;
isVerified?: boolean;
loginStatus?: boolean;
depositAmount?: number;
phoneNumber?: string;
referral?: string;
bonusCode?: string;
hasBonusActive?: boolean;
consent?: boolean;
}
Example usage:
const { error } = await crm.updatePlayer(player.crmReference, {
...player,
locale: player.locale.name,
});
const { error } = await crm.updatePlayer(player.crmReference, {
loginStatus: true,
lastLoginTime: new Date(),
});
const { error } = await crm.updatePlayer(player.crmReference, {
depositAmount: 200,
});
Example Response:
{
"id": 1,
"properties": {
"address": "Test Street 122",
"bonuscode": null,
"city": "Test",
"consent": "true",
"country": "Test",
"createdate": "2021-04-27T13:45:21.570Z",
"date_of_birth": "1995-03-22T20:40:32.000Z",
"email": "[email protected]",
"firstname": "Test",
"has_bonus_active": "false",
"hs_is_unworked": "true",
"hs_marketable_status": "false",
"hs_marketable_until_renewal": "false",
"is_verified": "false",
"kycstatus": "false",
"lastmodifieddate": "2021-04-27T13:45:21.570Z",
"lastname": "Test",
"locale": "en_US",
"login_status": "false",
"lastLoginTime": "2021-04-27T13:45:21.570Z",
"marketing_tag": "test",
"phone": null,
"referral": null,
"sex": "Not Specified",
"token": "uuidv4",
"username": "test_username",
"uuid": "uuidv4"
},
"createdAt": "2021-04-27T13:45:21.570Z",
"updatedAt": "2021-04-27T13:45:21.570Z",
"archived": false
}
Installation
npm i panthera-hubspot-package