0.1.8 • Published 3 years ago

@releai/rb-node-sdk v0.1.8

Weekly downloads
29
License
Apache License
Repository
github
Last release
3 years ago

RELE.AI Node SDK

RELE.AI Node SDK provides an easy interface to manage, create, and integrate applications to Clara.

Create Application

Please visit: https://github.com/rele-ai/cli

Client Usage Examples

const { RBC } = require("@releai/rb-node-sdk")

// Initiate new releai bot client.
const rbc = new RBC({
    appId,
    appHash,
    host,
    port,
})

// send notification to endpoint
const response = await rbc.notify(
    // send the operation key
    "new_contact",

    // send the payload
    {
        "foo": {
            "bar": 1
        }
    },

    // send additional headers
    {
        "example-header-key": "value"
    }
)

// handle output - JSON
console.log(response)

REST Formatter Example

const { format } = require("@releai/rb-node-sdk")

// format payload to gRPC struct format
const payload = format({
    // payload
})

Server Usage Example

const { RBS } = require("@releai/rb-node-sdk")

// initiate the bot server
const rbs = new RBS({
    appId,
    appHash,
})

// Register operation handler for a given operation
rbs.registerOperation("record_note", async (req, res) => {
    // do some logic here...

    // reply with the payload data
    res.send(200, {
        // response payload
    })
})

// run server
rbs.listen(50003)
0.1.8

3 years ago

0.1.6

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago