Skip to content

reviewpro/smooch-core-js

 
 

Repository files navigation

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 used server-side with Node.js.

Installation

$ npm install smooch-core --save

Contributing

If a method is missing please file an Issue, or better yet make a PR!

Usage

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

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

// using JWT components
var smooch = new SmoochCore({
    keyId: 'some-key',
    secret: 'some-secret',
    scope: 'appUser', // account, app, or appUser
    userId: 'some-id' // only required for appUser scope
});

// ...

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

Usage with a proxy

If you need to use a proxy, you can use one of the many proxies available, as long as it an http.Agent implementation. You only need to pass the agent when creating the SmoochCore instance.

var SmoochCore = require('smooch-core');
var SocksProxyAgent = require('socks-proxy-agent');
var proxy = process.env.http_proxy || 'socks://localhost:8123';
var agent = new SocksProxyAgent(proxy);

var smooch = new SmoochCore({
    keyId: 'some-key',
    secret: 'some-secret'
}, {
  httpAgent: agent
});

API

Below is a list of methods included in Smooch Core. For comprehensive documentation of Smooch Core and its methods see Smooch's REST API docs.

Module Method Endpoint
appUsers get GET /v1/appusers/:id
update PUT /v1/appusers/:id
deleteProfile DELETE /v1/appusers/:id/profile
create POST /v1/appusers
linkChannel POST /v1/appusers/:id/channels
unlinkChannel POST /v1/appusers/:id/channels/:channel
getMessages GET /v1/appusers/:id/messages
resetUnreadCount POST /v1/appusers/:id/conversation/read
typingActivity POST /v1/appusers/:id/conversation/:activity
sendMessage POST /v1/appusers/:id/messages
uploadImage POST /v1/appusers/:id/images
deleteMessages DELETE /v1/appusers/:id/messages
getChannels GET /v1/appusers/:id/channels
getBusinessSystems GET /v1/appusers/:id/businesssystems
getAuthCode GET /v1/appusers/:id/authcode
menu get GET /v1/menu
configure PUT /v1/menu
remove DELETE /v1/menu
webhooks list GET /v1/webhooks
create POST /v1/webhooks
get GET /v1/webhooks/:id
update PUT /v1/webhooks/:id
delete DELETE /v1/webhooks/:id
apps create POST /v1/apps
list GET /v1/apps
get GET /v1/apps/:id
delete DELETE /v1/apps/:id
keys.create POST /v1/apps/:id/keys
keys.list GET /v1/apps/:id/keys
keys.get GET /v1/apps/:id/keys/:keyId
keys.delete DELETE /v1/apps/:id/:keyId
keys.getJwt GET /v1/apps/:id/keys/:keyId/jwt
integrations create POST /v1/apps/:id/integrations
list GET /v1/apps/:id/integrations
get GET /v1/apps/:id/integrations/integrationId
delete DELETE /v1/apps/:id/integrations/:integrationId
menu.get GET /v1/apps/:id/integrations/:integrationId/menu
menu.create POST /v1/apps/:id/integrations/:integrationId/menu
menu.update PUT /v1/apps/:id/integrations/:integrationId/menu
menu.delete DELETE /v1/apps/:id/integrations/:integrationId/menu
attachments create POST /v1/apps/:id/attachments

Release process

  1. Merge your changes in master.
  2. Wait for CircleCI to run the test suite on master.
  3. Run npm run release -- <level> --run. Replace <level> with patch, minor, major depending on which type of version this is.

About

Javascript API for Smooch

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%