Giter VIP home page Giter VIP logo

smooch-core-js's Introduction

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

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 πŸ”— 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. πŸ”—

smooch-core-js's People

Contributors

lemieux avatar alavers avatar jugarrit avatar wmora avatar mario54 avatar spasiu avatar chloepouprom avatar mspensieri avatar dannytranlx avatar smooch-ci-core-js avatar jpventura avatar hebime avatar ubald avatar gozman avatar scottanthonymorin avatar jpjoyal avatar

Stargazers

Justin avatar

Watchers

James Cloos avatar Justin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.