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

botkit-messenger-samples

v2.0.0

Published

Module to receive sample messages of all types from a Facebook Messenger chatbot

Downloads

3

Readme

botkit-messenger-samples

npm

Module to receive sample messages of most types from a Facebook Messenger chatbot.

Takes the idea of sample message types from the Facebook Messenger Platform Sample project and moves it into a module for Botkit.

For usage sample code see examples/sample_bot.js

Steps for using lib

Install library from npm

npm install --save botkit-messenger-samples

Import Library

const MessengerSamples = require('botkit-messenger-samples');

Init the Library

controller.setupWebserver(process.env.port,function(err, webserver) {
  var messengerSamples = new MessengerSamples(controller, bot, {
    // serverUrl (e.g., https://my.domain.com)
    // needed to server up sample images
    serverUrl: process.env.serverUrl
    //, replyCb = function(err, body) {
    //    // call after a sample message is sent
    //  }
  });
});

Available Commands in Messenger

| Command | Results | |-----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | sample:help | text list of available commands | | sample:audio | an Audio Attachment embedded in a player | | sample:button | a Button Template | | sample:file | a text File Attachment | | sample:generic | a Generic Template | | sample:gif | an animated GIF Image Attachment | | sample:image | an Image Attachment | | sample:image:tall | a very tall Image Attachment | | sample:image:wide | a very wide Image Attachment | | sample:list | a List Template top_element_style:large note: on web, it is rendered as compact | | sample:list:compact | a List Template top_element_style:compact | | sample:quick reply | a text message with Quick Replies | | sample:read receipt | the mark_seen Sender Action | | sample:receipt | a Receipt Template | | sample:typing on | the typing_on Sender Action | | sample:typing off | the typing_off Sender Action | | sample:video | a Video Attachment embedded in a player | | sample:json:{ "text": "Lorem Ipsum!"} | any message type; after the sample:json: add any valid message, see Send API Reference |

JSON Examples

Simple text

sample:json:{
  "text": "hello world"
}

Muliple messages

sample:json:[{
  "text": "hello world"
},{
  "attachment": {
    "type": "template",
    "payload": {
      "template_type": "generic",
      "elements": [
        {
          "title": "rift",
          "subtitle": "Next-generation virtual reality",
          "item_url": "https://www.oculus.com/en-us/rift/",
          "image_url": "http://assets.smalltalk.ai/sample-message/rift.png",
          "buttons": [
            {
              "type": "web_url",
              "url": "https://www.oculus.com/en-us/rift/",
              "title": "Open Web URL"
            },
            {
              "type": "postback",
              "title": "Call Postback",
              "payload": "Payload for first bubble"
            }
          ]
        },
        {
          "title": "touch",
          "subtitle": "Your Hands, Now in VR",
          "item_url": "https://www.oculus.com/en-us/touch/",
          "image_url": "http://assets.smalltalk.ai/sample-message/touch.png",
          "buttons": [
            {
              "type": "web_url",
              "url": "https://www.oculus.com/en-us/touch/",
              "title": "Open Web URL"
            },
            {
              "type": "postback",
              "title": "Call Postback",
              "payload": "Payload for second bubble"
            }
          ]
        }
      ]
    }
  }
}]