circuit-sdk

node v6.17.1
version: 1.1.0
endpointsharetweet
// Create Circuit client instance for OAuth 2.0 (Client Credentials Grant) on the sandbox system const Circuit = require('circuit-sdk') const client = new Circuit.Client({ client_id: 'b1376280114c4062b7be44eb00bba048', client_secret: '6dc45749dc034b09b451229bc9aa5f97', domain: 'circuitsandbox.net' }); // Register and log all events Circuit.supportedEvents.forEach(e => client.addEventListener(e, console.log)); // Logon, then create a group conversation with two users and send a text message client.logon() .then(user => console.log(`Logged on as ${user.displayName}`, user)) .then(() => client.getUsersByEmail(['kim.jackson@mailinator.com', 'maeva.barnaby@mailinator.com'])) .then(users => users.map(user => user.userId)) .then(userIds => client.createGroupConversation(userIds, 'Runkit demo')) .then(conv => client.addTextItem(conv.convId, 'I am test bot. What can I do for you?')) .catch(console.error)
Loading…

no comments

    sign in to comment