2.0.71 • Published 5 years ago

@gamiphy/dashboard-core v2.0.71

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
5 years ago

Gamiphy Available SDKs

Introduction

Gamiphy is a user engagement and retention platform which offers clients the tools to engage, reach out and retain users, Gamiphy offers clients an all-inclusive gamification service with a variety of features including loyalty programs, branded games, quizzes and playable apps, basically anything to keep users engaged and coming back.

This document contains all the needed information to integrate the services that is provided by Gamiphy, focusing mainly on both Gamibot ( the loyalty program) and Gamistore ( the mini games).

Creating Gamiphy Account

details about the dashboard, how to signup, and link to documents.

Installation

Gamibot and Gamistore are available as a javascript library that you can install on your application and integrate with using the javascript package manager npm, or a static script injection in code.

Gamibot

Getting Started

Step 1: Gamibot Initialization

Gamibot.init(<botId>, <options>)
NameTypeDescription
botIdStringYour gamiphy bot id, you can get the bot id from your account at Gamiphy in the dashboard, within the account settings
optionsobjectGamiphy bot options

Kindly see more details about the options below.

NameTypeDescription
onAuthTrigger RequiredFunction: (isSignUp: boolean) => {}As Gamibot is accessible for anonymous users, you can specify where to redirect these users to do sign-up/login whenever they are trying to do a specific task, Gamibot will call the methods you specify here as options. isSignUp is a flag available for you so you can know where to redirect the users, to the signup form or the login form according to your needs.
user Optionalobject, null by default{name: String, email: String, avatar: String, hash: String}, refer to Register users section below to get more details about the hash parameter. you only need to pass the users in case they are logged in.
withWidget Optionalboolean, true by defaultIndicator to generate the bot widget, Gamibot SDK will help you show the widget of the bot from the SDK according to the configurations you did using Gamiphy dashboard account.
language OptionalString, en by defaultThe language you want to use in the bot. Use ISO 639-1 codes
isOpen Optionalboolean, false by defaultIndicator to show the bot and open it by default once its initialized, recommended value is false until you need a special case of integration.

Registering your users

You can register your users and communicate to Gamibot by calling the following method and passing the user data.

Gamibot.login({
	name: <name>, // Your user name. [Required]
	email: <email>, // You user email. [Required]
	avatar: <avatar>, // Your user avatar url. [Optional]
	hash: <hash> // Generated HMAC 
})
NameTypeDescription
name RequiredStringuser name
email RequiredStringuser email
avatar OptionalString, null by defaultYour user avatar URL, your users will be able to change the avatar later in the bot if you don't have it.
hash RequiredStringGenerated HMAC, Identity Verification, it helps to make sure that conversations/users between your application and Gamibot are kept private and that one user can't impersonate another. Identity Verification works by using a server side generated HMAC (hash based message authentication code), using SHA256, on the user�s email and name.

|

Logout users

When users want to log out of your app, simply call logout like so:

Gamibot.logout();

Gamibot still showing for anonymous

As Gamibot is accessible for anonymous users, you can specify where to redirect these users to do sign-up/login whenever they are trying to do a specific task, Gamibot will call the methods you specify here. isSignUp is a flag available for you so you can know where to redirect the users, to the signup form or the login form according to your needs.

Gamibot.init(<botId>, {
	onAuthTrigger((isSignUp) => {
		if(isSignUp) {
			//Add redirect to sign up code
			//e.x. window.location.href = '/sign-up' in web
		} else {
			//Add redirect to login code
			//e.x. window.location.href = '/login' in web
		}
	})
})

Showing the bot If you selected the option withWidget in the init method as false, that means you need to handle showing, and closing the bot by calling the following methods:

Open Gamibot

Gamibot.open() // will open Gamibot

Close Gamibot

Gamibot.close() // will close Gamibot

Tasks and events

As you will have a Gamiphy account where you can access the dashboard and design the user journey in addition to several configurations, you will need to complete the integration according to the selected configs in the dashboard, for example when you are going to add a task, you will be asked to fill in the action name and the event name.

Gamibot will fire an action whenever the user trying to do a specific task in the bot so you can handle the business logic in your application, the following method onTaskTrigger will be called, and you will be receiving the action name you specified in the dashboard as a parameter, you can perform your login the call back function shown below according to each action per task.

Gamibot.onTaskTrigger(<actionName>, () => {
	//Action name handler
	//e.x. Redirect to the page where you can do the task
})

In order to send back to the bot whenever the user did a specific task in your application, so Gamibot can consider that task as done, you will need to call the following method and pass the eventName as a parameter, eventName value is specified in the dashboard when you create your tasks.

Gamibot.taskDone(<eventName>)
NameTypeDescription
eventNameStringEvent name added in the dashboard

Handling user's redeem

The following method will be called whenever the user is trying to redeem his points from Gamibot, Gamibot will trigger this method and pass the reward details as an object to the method, you can inject your logic within the handler according to the reward config you specified in the dashboard.

Gamibot.onRedeemTrigger((reward) => {
	// On redeem handler
})

kindly note the fields of the reward object you will get as a parameter as described above.

NameTypeDescription
_idStringThe reward identifier
typeStringdiscount, freeShipping, gift
meritPointsnumberThe points at which the user can redeem the reward
optionsobjectIn case of discount rewards it contains {type: 'percent' | 'fixed'}

Whenever the user attempt to get the reward, and he actually did get the reward, you'll need to communicate that to Gamibot so that the user points will be updated. you can do so by calling the following method.

Gamibot.redeemDone(<rewardId>)
NameTypeDescription
rewardIdStringThe reward identifier
2.0.71

5 years ago

2.0.70

5 years ago

2.0.69

5 years ago

2.0.68

5 years ago

2.0.67

5 years ago

2.0.66

5 years ago

2.0.65

5 years ago

2.0.64

5 years ago

2.0.63

5 years ago

2.0.62

5 years ago

2.0.61

5 years ago

2.0.60

5 years ago

2.0.59

5 years ago

2.0.58

5 years ago

2.0.57

5 years ago

2.0.56

5 years ago

2.0.55

5 years ago

2.0.54

5 years ago

2.0.53

5 years ago

2.0.52

5 years ago

2.0.51

5 years ago

2.0.50

5 years ago

2.0.9-patch-1.4

5 years ago

2.0.9-patch-1.3

5 years ago

2.0.9-patch-1.2

5 years ago

2.0.9-patch-1

5 years ago

2.0.49

5 years ago

2.0.48

5 years ago

2.0.47

5 years ago

2.0.46

5 years ago

2.0.45

5 years ago

2.0.44

5 years ago

2.0.43

5 years ago

2.0.42

5 years ago

2.0.41

5 years ago

2.0.40

5 years ago

2.0.39

5 years ago

2.0.38

5 years ago

2.0.37

5 years ago

2.0.36

5 years ago

2.0.35

5 years ago

2.0.34

5 years ago

2.0.33

5 years ago

2.0.32

5 years ago

2.0.31

5 years ago

2.0.30

5 years ago

2.0.29

5 years ago

2.0.28

5 years ago

2.0.27

5 years ago

2.0.26

5 years ago

2.0.25

5 years ago

2.0.24

5 years ago

2.0.23

5 years ago

2.0.22

5 years ago

2.0.21

5 years ago

2.0.20

5 years ago

2.0.19

5 years ago

2.0.18

5 years ago

2.0.7-patch-1

5 years ago

2.0.17

5 years ago

2.0.16

5 years ago

2.0.15

5 years ago

2.0.14

5 years ago

2.0.13

5 years ago

2.0.12

5 years ago

2.0.11

5 years ago

2.0.10

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

1.0.51

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

1.0.50

5 years ago

1.0.49

5 years ago

1.0.48

5 years ago

1.0.47

5 years ago

1.0.46

5 years ago

1.0.45

5 years ago

1.0.44

5 years ago

1.0.43

5 years ago

1.0.42

5 years ago

1.0.41

5 years ago

1.0.40

5 years ago

1.0.39

5 years ago

1.0.38

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago