0.0.117 • Published 13 days ago

@smartico/public-api v0.0.117

Weekly downloads
-
License
ISC
Repository
-
Last release
13 days ago

Smartico Public API

API allows you to build custom Gamification UI using smartico.ai as a backend system.

Please contact your Smartico account manager to get the API keys
and for terms of API usage

Front-end usage

To use the API you need the smartico.js library installed and initialized on your site according to this guide https://help.smartico.ai/welcome/technical-guides/front-end-integration

As soon as the _smartico object is available in the global context and the user is identified, you can call API methods to get the data or act on behalf of the logged-in user.

_smartico.api.getLevels().then( levels => {
    console.log('There are ' + levels.length + ' levels available');
});

Some methods can be called with onUpdate callback, which is executed when there are changes in the underlying data. Example:

var miniGamesUpdates = (games) => {
    console.log('There are ' + games.length + ' games available now');
}

_smartico.api.getMiniGames( { onUpdate: miniGamesUpdates} ).then( games => {
    console.log('There are ' + games.length + ' games available');
});

See the API documentation for all available methods and returning data.

Backend usage (NodeJS context)

Note: access to the server-to-server API is not provided by default and is a topic for a separate agreement with Smartico. We recommend using a front-end API approach in most cases.

Installation

npm install --save @smartico/public-api

Usage

import { SmarticoAPI } from '@smartico/public-api';

const SAPI = new SmarticoAPI( 'your-label-api-key', 'your-brand-key', 'your-message-sender', { logger: console });

const userExtId = 'John1984'
            
const response = await SAPI.miniGamesGetTemplates(userExtId);

response.templates.forEach( t => {
    console.log(t.saw_template_ui_definition.name)
}

Development and publishing process

Publishing process

git commit
npm run build
npm version patch
npm run pub

To debug locally

In the public-api project:

npm link
# when you are done
npm unlink

In the target project

npm link @smartico/public-api --legacy-peer-deps

# when you are done
npm unlink @smartico/public-api --legacy-peer-deps && npm install @smartico/public-api --legacy-peer-deps
0.0.117

13 days ago

0.0.116

14 days ago

0.0.115

14 days ago

0.0.114

14 days ago

0.0.113

23 days ago

0.0.112

23 days ago

0.0.111

1 month ago

0.0.110

1 month ago

0.0.109

1 month ago

0.0.108

2 months ago

0.0.107

2 months ago

0.0.106

2 months ago

0.0.105

3 months ago

0.0.104

3 months ago

0.0.103

3 months ago

0.0.102

3 months ago

0.0.101

3 months ago

0.0.100

4 months ago

0.0.99

4 months ago

0.0.98

5 months ago

0.0.97

5 months ago

0.0.96

5 months ago

0.0.91

5 months ago

0.0.92

5 months ago

0.0.93

5 months ago

0.0.94

5 months ago

0.0.84

6 months ago

0.0.85

5 months ago

0.0.86

5 months ago

0.0.87

5 months ago

0.0.88

5 months ago

0.0.89

5 months ago

0.0.45

10 months ago

0.0.46

10 months ago

0.0.47

9 months ago

0.0.80

6 months ago

0.0.82

6 months ago

0.0.83

6 months ago

0.0.73

7 months ago

0.0.74

6 months ago

0.0.75

6 months ago

0.0.76

6 months ago

0.0.77

6 months ago

0.0.78

6 months ago

0.0.79

6 months ago

0.0.70

7 months ago

0.0.71

7 months ago

0.0.72

7 months ago

0.0.62

7 months ago

0.0.63

7 months ago

0.0.64

7 months ago

0.0.65

7 months ago

0.0.66

7 months ago

0.0.68

7 months ago

0.0.69

7 months ago

0.0.60

8 months ago

0.0.61

8 months ago

0.0.59

8 months ago

0.0.51

9 months ago

0.0.52

9 months ago

0.0.53

9 months ago

0.0.54

9 months ago

0.0.55

9 months ago

0.0.56

9 months ago

0.0.57

9 months ago

0.0.58

9 months ago

0.0.90

5 months ago

0.0.50

9 months ago

0.0.48

9 months ago

0.0.49

9 months ago

0.0.40

11 months ago

0.0.41

11 months ago

0.0.42

11 months ago

0.0.43

11 months ago

0.0.44

10 months ago

0.0.37

11 months ago

0.0.38

11 months ago

0.0.39

11 months ago

0.0.34

12 months ago

0.0.35

11 months ago

0.0.36

11 months ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.33

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago