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!
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 version | smooch-core version to use |
---|---|
v1.1 Upgrade guide |
8.0.0 or newer |
v1 |
7.* 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.
});
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
});
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 π icon.
Method | Description | Link |
---|---|---|
appUsers Module | ||
appUsers.get |
Get a specific appUser. | π |
appUsers.update |
Update an appUserβs basic profile information and specify custom profile data. | π |
appUsers.delete |
Delete an appUser. | π |
appUsers.deleteProfile |
Delete an appUserβs profile. | π |
appUsers.create |
Pre-create an appUser object before that appUser runs your app for the first time. | π |
appUsers.linkChannel |
Link appUser to continue conversation on his/her preferred channel. | π |
appUsers.unlinkChannel |
Remove the specified channel from the appUserβs clients. | π |
appUsers.getMessages |
Get the specified appUserβs conversation history. | π |
appUsers.resetUnreadCount |
Reset the unread count of the conversation to 0. | π |
appUsers.typingActivity |
Notify Smooch when an app maker starts or stops typing a response. | π |
appUsers.sendMessage |
Post a message to or from the appUser. | π |
appUsers.deleteMessage |
Delete a single message. | π |
appUsers.deleteMessages |
Clears the message history for an appUser, permanently deleting all messages. | π |
appUsers.getChannels |
Get all of the appUserβs channel entity Ids. | π |
appUsers.getBusinessSystems |
Get all the business systems to which an appUserβs conversation is connected. | π |
appUsers.getAuthCode |
Get auth code. | π |
appUsers.getLinkRequests |
Generate a transfer URL for a given channel type. | π |
menu Module | ||
menu.get |
Get the specified appβs menu. | π |
menu.configure |
Configure the specified appβs menu. | π |
menu.remove |
Remove the specified appβs menu. | π |
webhooks Module | ||
webhooks.list |
List all webhooks configured for a given app. | π |
webhooks.create |
Create a webhook for the specified app. | π |
webhooks.get |
Get individual webhooks. | π |
webhooks.update |
Update existing webhooks. | π |
webhooks.delete |
Delete specified webhook. | π |
apps Module | ||
apps.create |
Create a new app. | π |
apps.list |
List all configured apps. | π |
apps.get |
Get the specified app. | π |
apps.delete |
Delete the specified app, including all its enabled integrations. | π |
apps.keys.create |
Create a secret key for the specified app. | π |
apps.keys.list |
List all secret keys for the sepcified app. | π |
apps.keys.get |
Get a secret key. | π |
apps.keys.delete |
Delete a secret key. | π |
apps.keys.getJwt |
Get an app-scoped JWT signed using the requested keyId/secret pair. | π |
integrations Module | ||
integrations.create |
Create a new integration. | π |
integrations.list |
List all integrations for a given app. | π |
integrations.get |
Return the specified integration. | π |
integrations.update |
Update the specified integration. | π |
integrations.delete |
Delete the specified integration. | π |
integrations.menu.get |
Get the specified integrationβs menu. | π |
integrations.menu.update |
Update the specified integrationβs menu. | π |
integrations.menu.delete |
Delete the specified integration's menu. | π |
integrations.profile.update |
Update the specified integrationβs profile. | π |
serviceAccounts Module | ||
serviceAccounts.create |
Create a new service account. | π |
serviceAccounts.list |
List all service accounts. | π |
serviceAccounts.get |
Get the specified service account. | π |
serviceAccounts.delete |
Delete the specified service account. | π |
serviceAccounts.keys.create |
Create a secret key for the specified service account. | π |
serviceAccounts.keys.list |
List all secret keys for the specified service account. | π |
serviceAccounts.keys.get |
Get a specified secret key for the specified service account. | π |
serviceAccounts.keys.delete |
Delete a specified secret key for the specified service account. | π |
serviceAccounts.keys.getJwt |
Get an account-scoped JWT signed using the requested keyId/secret pair. | π |
attachments Module | ||
attachments.create |
Upload an attachment to Smooch to use in future messages. | π |
attachments.delete |
Remove an attachment uploaded to Smooch | π |
templates Module | ||
templates.create |
Create a new template. | π |
templates.list |
List all templates for a given app. | π |
templates.get |
Return the specified template. | π |
templates.update |
Update the specified template. | π |
templates.delete |
Delete the specified template. | π |