Socket
Socket
Sign inDemoInstall

runtime-less-stuff

Package Overview
Dependencies
20
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    runtime-less-stuff

Javascript wrapper for Smooch API


Version published
Weekly downloads
2
Maintainers
1
Install size
1.03 MB
Created
Weekly downloads
 

Readme

Source

Smooch Core

Smooch Core is the most basic for interaction possible for the Smooch API. It wraps the public API in a convenient Javascript API.

This library is meant to be isomorphic, which means it can be used in the browser and server-side with Node.js. However, the webhooks API and the JWT utils are not available in the browser to reduce the bundle size. Those actions should not be done in the browser anyway.

Installation

$ npm install smooch-core --save

Usage

In the browser (using browserify or webpack)

var SmoochCore = require('smooch-core');

// using app token
var smoochCore = new SmoochCore({
    appToken: 'some-token'
});


// using generated JWT
var smoochCore = new SmoochCore({
    jwt: 'some-jwt'
});

// ...

smoochCore.appUsers.init(options).then(function(response) {
  // do something with the response.
});

Server-side

var SmoochCore = require('smooch-core');

// using app token
var smoochCore = new SmoochCore({
    appToken: 'some-token'
});


// using generated JWT
var smoochCore = new SmoochCore({
    jwt: 'some-jwt'
});

// using JWT components
// Only available server-side. NEVER put your keyId and secret
// in you client-side code.
var smoochCore = new SmoochCore({
    keyId: 'some-key',
    secret: 'some-secret',
    scope: 'appUser', // app or appUser
    userId: 'some-id' // not necessary if scope === 'app'
});

// ...

smoochCore.webhooks.get(id).then(function(response) {
  // do something with the response.
});

API

This is an overview of what the library has to offer. A better documentation will be available soon.

ModuleMethodEndpoint
appUsersinitPOST /v1/init
getGET /v1/appusers/:id
updatePUT /v1/appusers/:id
trackEventPOST /v1/appusers/:id/events
conversationsgetGET /v1/appusers/:id/conversation
sendMessagePOST /v1/appusers/:id/conversation/messages
webhookslistGET /v1/webhooks
createPOST /v1/webhooks
getGET /v1/webhooks/:id
updatePUT /v1/webhooks/:id
deleteDELETE /v1/webhooks/:id

FAQs

Last updated on 13 Jun 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc