smooch-core
Javascript wrapper for Smooch API
Last updated a month ago by smoochlabs .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install smooch-core 
SYNC missed versions from official npm registry.

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!

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 version smooch-core version to use
v1.1 Upgrade guide 8.0.0 or newer
v1 7.* or older

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
});

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.js script
  3. Import the built SDK
  4. Test it

Example:

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());
})();

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.

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

Method Description Link
appUsers Module
appUsers.get Get a specific appUser. :link:
appUsers.update Update an appUser’s basic profile information and specify custom profile data. :link:
appUsers.delete Delete an appUser. :link:
appUsers.deleteProfile Delete an appUser’s profile. :link:
appUsers.create Pre-create an appUser object before that appUser runs your app for the first time. :link:
appUsers.linkChannel Link appUser to continue conversation on his/her preferred channel. :link:
appUsers.unlinkChannel Remove the specified channel from the appUser’s clients. :link:
appUsers.getMessages Get the specified appUser’s conversation history. :link:
appUsers.resetUnreadCount Reset the unread count of the conversation to 0. :link:
appUsers.typingActivity Notify Smooch when an app maker starts or stops typing a response. :link:
appUsers.sendMessage Post a message to or from the appUser. :link:
appUsers.deleteMessage Delete a single message. :link:
appUsers.deleteMessages Clears the message history for an appUser, permanently deleting all messages. :link:
appUsers.getChannels Get all of the appUser’s channel entity Ids. :link:
appUsers.getBusinessSystems Get all the business systems to which an appUser’s conversation is connected. :link:
appUsers.getAuthCode Get auth code. :link:
appUsers.getLinkRequests Generate a transfer URL for a given channel type. :link:
appUsers.mergeUsers Force the merge of two specific users, when the business has determined that they represent the same person :link:
menu Module
menu.get Get the specified app’s menu. :link:
menu.configure Configure the specified app’s menu. :link:
menu.remove Remove the specified app’s menu. :link:
webhooks Module
webhooks.list List all webhooks configured for a given app. :link:
webhooks.create Create a webhook for the specified app. :link:
webhooks.get Get individual webhooks. :link:
webhooks.update Update existing webhooks. :link:
webhooks.delete Delete specified webhook. :link:
apps Module
apps.create Create a new app. :link:
apps.list List all configured apps. :link:
apps.get Get the specified app. :link:
apps.delete Delete the specified app, including all its enabled integrations. :link:
apps.getSdkIds Retrieve the IDs of the three SDK integrations (android, ios, and web) for the specified app, to be used when initializing the SDKs. :link:
apps.keys.create Create a secret key for the specified app. :link:
apps.keys.list List all secret keys for the sepcified app. :link:
apps.keys.get Get a secret key. :link:
apps.keys.delete Delete a secret key. :link:
apps.keys.getJwt Get an app-scoped JWT signed using the requested keyId/secret pair. :link:
integrations Module
integrations.create Create a new integration. :link:
integrations.list List all integrations for a given app. :link:
integrations.get Return the specified integration. :link:
integrations.update Update the specified integration. :link:
integrations.delete Delete the specified integration. :link:
integrations.menu.get Get the specified integration’s menu. :link:
integrations.menu.update Update the specified integration’s menu. :link:
integrations.menu.delete Delete the specified integration's menu. :link:
integrations.profile.get Get the specified integration’s profile. :link:
integrations.profile.update Update the specified integration’s profile. :link:
integrations.profile.photo.upload Upload a photo to be used for the the specified integration’s profile. :link:
deployments Module
deployments.create Create a new deployment. :link:
deployments.activate Activate the phone number of the deployment. :link:
deployments.confirmCode Confirm the phone number of the deployment. :link:
deployments.get Return the specified deployment. :link:
deployments.list List all configured deployments. :link:
deployments.delete Delete the specified deployment. :link:
serviceAccounts Module
serviceAccounts.create Create a new service account. :link:
serviceAccounts.list List all service accounts. :link:
serviceAccounts.get Get the specified service account. :link:
serviceAccounts.delete Delete the specified service account. :link:
serviceAccounts.keys.create Create a secret key for the specified service account. :link:
serviceAccounts.keys.list List all secret keys for the specified service account. :link:
serviceAccounts.keys.get Get a specified secret key for the specified service account. :link:
serviceAccounts.keys.delete Delete a specified secret key for the specified service account. :link:
serviceAccounts.keys.getJwt Get an account-scoped JWT signed using the requested keyId/secret pair. :link:
attachments Module
attachments.create Upload an attachment to Smooch to use in future messages. :link:
attachments.delete Remove an attachment uploaded to Smooch :link:
templates Module
templates.create Create a new template. :link:
templates.list List all templates for a given app. :link:
templates.get Return the specified template. :link:
templates.update Update the specified template. :link:
templates.delete Delete the specified template. :link:
notifications Module
notifications.postNotification Send a notification. :link:

Copyright and license

Copyright 2018 Zendesk, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Current Tags

  • 8.10.2                                ...           latest (a month ago)
  • 1.2.0-pre.0                                ...           pre (4 years ago)

78 Versions

  • 8.10.2                                ...           a month ago
  • 8.10.1                                ...           2 months ago
  • 8.10.0                                ...           3 months ago
  • 8.9.0                                ...           3 months ago
  • 8.8.0                                ...           6 months ago
  • 8.7.4                                ...           8 months ago
  • 8.7.3                                ...           a year ago
  • 8.7.2                                ...           a year ago
  • 8.7.1                                ...           a year ago
  • 8.7.0                                ...           a year ago
  • 8.6.0                                ...           a year ago
  • 8.5.0                                ...           a year ago
  • 8.4.0                                ...           a year ago
  • 8.3.1                                ...           a year ago
  • 8.3.0                                ...           a year ago
  • 8.2.0                                ...           a year ago
  • 8.1.0                                ...           a year ago
  • 8.0.1                                ...           2 years ago
  • 8.0.0                                ...           2 years ago
  • 7.1.0                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 6.7.0                                ...           2 years ago
  • 6.6.0                                ...           2 years ago
  • 6.5.0                                ...           2 years ago
  • 6.4.0                                ...           2 years ago
  • 6.3.0                                ...           2 years ago
  • 6.2.0                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.0                                ...           2 years ago
  • 5.8.0                                ...           2 years ago
  • 5.7.0                                ...           2 years ago
  • 5.6.0                                ...           3 years ago
  • 5.5.0                                ...           3 years ago
  • 5.4.0                                ...           3 years ago
  • 5.3.0                                ...           3 years ago
  • 5.2.0                                ...           3 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 4.3.0                                ...           3 years ago
  • 4.2.0                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.5.0                                ...           3 years ago
  • 3.4.0                                ...           3 years ago
  • 3.3.0                                ...           3 years ago
  • 3.1.1                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.5.0                                ...           4 years ago
  • 1.4.0                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.1                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.2.0-pre.0                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.0.15                                ...           4 years ago
  • 0.0.14                                ...           4 years ago
  • 0.0.13                                ...           4 years ago
  • 0.0.12                                ...           5 years ago
  • 0.0.11                                ...           5 years ago
  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago

Copyright 2014 - 2016 © taobao.org |