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

facebot

v0.0.11

Published

Facebook messenger integration in slack

Downloads

4

Readme

Facebot image

Facebot is a Slack bot for facebook messenger integration. It allows you to link slack channels to facebook messenger, and communicate to them through slack.

Features

  • Connect slack channel to a facebook messenger channels
  • Messages appear using friends names and profile pictures
  • Supports all message types: Images, Stickers, Gifs, Thumbs & Audio messages
  • Facebook<-->Slack Emoji support
  • Channel links persist between restarts

Restrictions

  • Only 1 facebook account can login and is authorised to use the bot. Multi-user support could be added in the future but facebook-chat-api requires logins to use plaintext email and password, so these are passed and environment variables for a single account.
  • For privacy, you can only link completely private slack channels (just you and facebot) to messenger. The person you want to link must be a facebook friend.

Running the bot

Run on Heroku for free

You can immediately deploy and start using the bot by clicking the button below:

Deploy

You will need to enter your slack bot API key, facebook details and slack username, and it will begin running on a free heroku instance.

Downloading

You can download the package from npm with:

npm install facebot

Environment Variables

Facebot requires the following environment variables:

Variable|Description ----|----- BOT_API_KEY|The slack bot API key, for the bot user you want to run facebot BOT_NAME|The name of your slack bot AUTHORISED_USERNAME|The slack username for the authorised user. The authorised user should be the owner of the Facebook account. Only the authorised user can interact with Facebot (link channels etc). FACEBOOK_EMAIL|Email address for the Facebook account you want to use FACEBOOK_PASSWORD|Password for the Facebook account you want to use DATABASE_URL|URL for a postgres or mysql database to save and load data from, see details below for format. This reduces the number of sign in messages you may receive by using existing cookies and tokens, and keeps channel links persistent through bot restarts. If this is not set the bot will still function, but you will lose channel links between sessions (if not using file based storage). DEBUG_MESSAGES|False by default. Set this to true to receive debug direct messages from Facebot

DATABASE_URL

  • For mysql DATABASE_URL should be a json string that will be decoded. For all possible options see: https://github.com/mysqljs/mysql#connection-options . An example of a simple block would be: '{"host":"localhost","user":"me","password":"secret","database":"my_db"}'
  • For postgres this should be the the connection string that is given to pg.Client.

Running Locally

You can test or run Facebot locally with node bin/run_local_storage.js

You will still need to setup the environment variables described above (without DATABASE_URL). run_local_storage.js will use the local file system to store the login data and any channel links, this is usually not appropriate when running on a PaaS such as Heroku.

Using the Bot

Commands

image

Linking Chats

To link a slack channel to a Facebook friend, create a new private channel and invite Facebot. Then send @facebot chat FriendNameHere to link incoming and outgoing messages.

image

Contributing

Pull requests more than welcome!

Some things to keep in mind

Yarn

This project uses yarn to lock down dependencies, so when adding another dependency remember to update the yarn.lock file

Prettier

In order to keep the code formatting and style consistent this project uses Prettier to enforce formatting.

Prettier is installed as a dev dependency, and a pre-commit hook is setup to automatically run and prettify staged files just before commiting.

Running Prettier Manually

Check out the Prettier docs for instructions on how to run Prettier from the commandline, or inside your editor using a plugin.