8.11.4 • Published 3 years ago

smooch-core v8.11.4

Weekly downloads
2,784
License
Apache-2.0
Repository
github
Last release
3 years ago

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 versionsmooch-core version to use
v1.1 Upgrade guide8.0.0 or newer
v17.* 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.

MethodDescriptionLink
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.getSdkIdsRetrieve 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.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:
integrations.menu.getGet the specified integration’s menu.:link:
integrations.menu.updateUpdate the specified integration’s menu.:link:
integrations.menu.deleteDelete the specified integration's menu.:link:
integrations.messageTemplates.createCreate a message template for the specified WhatsApp integration.:link:
integrations.messageTemplates.listList message templates for the specified WhatsApp integration.:link:
integrations.messageTemplates.deleteDelete a message template for the specified WhatsApp integration.:link:
integrations.profile.getGet the specified integration’s profile.:link:
integrations.profile.updateUpdate the specified integration’s profile.:link:
integrations.profile.photo.uploadUpload 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:
notifications Module
notifications.postNotificationSend a notification.:link:

Deployment

Deployment is automated. When you merge to master, the current version in package.json will be automatically released to the public and published on npm.

Steps:

  • Update the version
    • npm version major|minor|patch
  • PR to master
  • Merge

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.

8.11.4

3 years ago

8.11.3

3 years ago

8.11.2

3 years ago

8.11.1

3 years ago

8.11.0

4 years ago

8.10.2

4 years ago

8.10.1

4 years ago

8.10.0

4 years ago

8.9.0

4 years ago

8.8.0

4 years ago

8.7.4

4 years ago

8.7.3

5 years ago

8.7.2

5 years ago

8.7.1

5 years ago

8.7.0

5 years ago

8.6.0

5 years ago

8.5.0

5 years ago

8.4.0

5 years ago

8.3.1

5 years ago

8.3.0

5 years ago

8.2.0

5 years ago

8.1.0

5 years ago

8.0.1

5 years ago

8.0.0

6 years ago

7.1.0

6 years ago

7.0.0

6 years ago

6.7.0

6 years ago

6.6.0

6 years ago

6.5.0

6 years ago

6.4.0

6 years ago

6.3.0

6 years ago

6.2.0

6 years ago

6.1.0

6 years ago

6.0.0

6 years ago

5.8.0

6 years ago

5.7.0

6 years ago

5.6.0

6 years ago

5.5.0

6 years ago

5.4.0

6 years ago

5.3.0

7 years ago

5.2.0

7 years ago

5.1.0

7 years ago

5.0.0

7 years ago

4.3.0

7 years ago

4.2.0

7 years ago

4.1.0

7 years ago

4.0.0

7 years ago

3.5.0

7 years ago

3.4.0

7 years ago

3.3.0

7 years ago

3.1.1

7 years ago

3.1.0

7 years ago

3.0.0

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.5.0

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.2.0-pre.0

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago