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

wingbot-intercom

v1.0.3

Published

Intercom integration for wingbot.ai

Downloads

14

Readme

Intercom connector for wingbot.ai bot

It's easy now to use the wingbot.ai as an automation backend for Intercom.

wingbot bot in the Intercom

Setting up the Intercom

  1. Create an Intercom application

    you'll get an access token, which you'll be able to use as intercomAppToken.

  2. Set up the webhook

    Subscribe the bot to following channels

    • conversation.user.created
    • conversation.user.replied
    • conversation.admin.assigned
  3. Create a Bot admin user

    You'll use an ID of the user as a botAdminId param.

  4. Make additional setup

    These steps are required to make the bot working properly:

    • set the Bot admin user as a default assignee
    • turn off the work hours
    • set up the welcome message for all chat users
  5. Use team (or admin user) ID as a Handover app ID

    To pass thread to team or user use it's ID as an application ID in pass thread command.

Setting up the bot

And don't forget to disable autoTyping and autoSeen feature and all handover related interactions.

const { Router, Bot } = require('wingbot');
const { Intercom } = require('wingbot-intercom');

const bot = new Bot();

const processor = new Processor(bot);

const intercom = new Intercom(processor, {
    botAdminId: '123',
    intercomAppToken: '456'
});

// the route
module.exports.bot = async (req, res) => {
    const { body, headers } = req;

    await intercom.verifyRequest(body, headers);

    await intercom.processEvent(body);
};

API

Classes

Typedefs

Intercom

BotService connector for wingbot.ai

Kind: global class

new Intercom(processor, options, [senderLogger])

| Param | Type | Description | | --- | --- | --- | | processor | Processor | wingbot Processor instance | | options | object | | | options.botAdminId | string | id of the bot user in Intercom | | options.intercomAppToken | string | OAUTH token to authorize Intercom requests | | [options.passThreadAction] | string | trigger this action for pass thread event | | [options.requestLib] | function | request library replacement for testing | | [options.uri] | string | override intercom URL | | [senderLogger] | console | optional console like chat logger |

intercom.processEvent(body) ⇒ Promise.<Array.<{message:object, pageId:string}>>

Process Facebook request

Kind: instance method of Intercom
Returns: Promise.<Array.<{message:object, pageId:string}>> - - unprocessed events

| Param | Type | Description | | --- | --- | --- | | body | object | event body |

intercom.verifyRequest(body, headers) ⇒ Promise

Verify Facebook webhook event

Kind: instance method of Intercom
Throws:

  • Error when authorization token is invalid or missing

| Param | Type | Description | | --- | --- | --- | | body | string | Buffer | parsed request body | | headers | object | request headers |

Processor : Object

Kind: global typedef

| Param | Type | | --- | --- | | processMessage | function |