npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

smooch-core

v8.11.4

Published

Javascript wrapper for Smooch API

Downloads

4,331

Readme

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.messageTemplates.create | Create a message template for the specified WhatsApp integration. | :link: | | integrations.messageTemplates.list | List message templates for the specified WhatsApp integration. | :link: | | integrations.messageTemplates.delete | Delete a message template for the specified WhatsApp integration. | :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: |

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.