Javascript wrapper for Smooch API

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.


$ npm install smooch-core --save


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

Smooch API Version

The Smooch API offers multiple versions. Each release of this project targets one and only one Smooch API version. If you depend on an older version of the Smooch API, you may need to use an older release of this library. Use the table below as your guide:

Smooch API versionsmooch-coreversion to use
v1.1Upgrade guide8.0.0or newer
v17.*or older


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 manyproxiesavailable, as long as it an http.Agentimplementation. 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

Testing new additions

If you've just added some new APIs and would like to test them locally before pushing your changes, do the following.

  1. npm run build
  2. Create a simple Node.jsscript
  3. Import the built SDK
  4. Test it


const Smooch = require('../smooch-core-js-private/lib/smooch');

const smooch = new Smooch({
    keyId: '<redacted>',
    secret: '<redacted>',
    scope: 'account'

(async () => {
    console.log(await smooch.apps.list());


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.

For more detailed information and example usage of each of the following methods, click on the method's :link: icon.

appUsers Module
appUsers.getGet a specific appUser.:link:
appUsers.updateUpdate an appUser’s basic profile information and specify custom profile data.:link:
appUsers.deleteDelete an appUser.:link:
appUsers.deleteProfileDelete an appUser’s profile.:link:
appUsers.createPre-create an appUser object before that appUser runs your app for the first time.:link:
appUsers.linkChannelLink appUser to continue conversation on his/her preferred channel.:link:
appUsers.unlinkChannelRemove the specified channel from the appUser’s clients.:link:
appUsers.getMessagesGet the specified appUser’s conversation history.:link:
appUsers.resetUnreadCountReset the unread count of the conversation to 0.:link:
appUsers.typingActivityNotify Smooch when an app maker starts or stops typing a response.:link:
appUsers.sendMessagePost a message to or from the appUser.:link:
appUsers.deleteMessageDelete a single message.:link:
appUsers.deleteMessagesClears the message history for an appUser, permanently deleting all messages.:link:
appUsers.getChannelsGet all of the appUser’s channel entity Ids.:link:
appUsers.getBusinessSystemsGet all the business systems to which an appUser’s conversation is connected.:link:
appUsers.getAuthCodeGet auth code.:link:
appUsers.getLinkRequestsGenerate a transfer URL for a given channel type.:link:
appUsers.mergeUsersForce the merge of two specific users, when the business has determined that they represent the same person:link:
menu Module
menu.getGet the specified app’s menu.:link:
menu.configureConfigure the specified app’s menu.:link:
menu.removeRemove the specified app’s menu.:link:
webhooks Module
webhooks.listList all webhooks configured for a given app.:link:
webhooks.createCreate a webhook for the specified app.:link:
webhooks.getGet individual webhooks.:link:
webhooks.updateUpdate existing webhooks.:link:
webhooks.deleteDelete specified webhook.:link:
apps Module
apps.createCreate a new app.:link:
apps.listList all configured apps.:link:
apps.getGet the specified app.:link:
apps.deleteDelete the specified app, including all its enabled integrations.:link:
apps.keys.createCreate a secret key for the specified app.:link:
apps.keys.listList all secret keys for the sepcified app.:link:
apps.keys.getGet a secret key.:link:
apps.keys.deleteDelete a secret key.:link:
apps.keys.getJwtGet an app-scoped JWT signed using the requested keyId/secret pair.:link:
integrations Module
integrations.createCreate a new integration.:link:
integrations.listList all integrations for a given app.:link:
integrations.getReturn the specified integration.:link:
integrations.updateUpdate the specified integration.:link:
integrations.deleteDelete the specified integration.:link: the specified integration’s menu.:link: the specified integration’s menu.:link: the specified integration's menu.:link:
integrations.profile.getGet the specified integration’s profile.:link:
integrations.profile.updateUpdate the specified integration’s profile.:link: a photo to be used for the the specified integration’s profile.:link:
deployments Module
deployments.createCreate a new deployment.:link:
deployments.activateActivate the phone number of the deployment.:link:
deployments.confirmCodeConfirm the phone number of the deployment.:link:
deployments.getReturn the specified deployment.:link:
deployments.listList all configured deployments.:link:
deployments.deleteDelete the specified deployment.:link:
serviceAccounts Module
serviceAccounts.createCreate a new service account.:link:
serviceAccounts.listList all service accounts.:link:
serviceAccounts.getGet the specified service account.:link:
serviceAccounts.deleteDelete the specified service account.:link:
serviceAccounts.keys.createCreate a secret key for the specified service account.:link:
serviceAccounts.keys.listList all secret keys for the specified service account.:link:
serviceAccounts.keys.getGet a specified secret key for the specified service account.:link:
serviceAccounts.keys.deleteDelete a specified secret key for the specified service account.:link:
serviceAccounts.keys.getJwtGet an account-scoped JWT signed using the requested keyId/secret pair.:link:
attachments Module
attachments.createUpload an attachment to Smooch to use in future messages.:link:
attachments.deleteRemove an attachment uploaded to Smooch:link:
templates Module
templates.createCreate a new template.:link:
templates.listList all templates for a given app.:link:
templates.getReturn the specified template.:link:
templates.updateUpdate the specified template.:link:
templates.deleteDelete the specified template.:link:






扫码加入 JavaScript 社区