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

instazap

v0.2.0

Published

A straightforward bot to forward Instagram messages directly to your Slack organization.

Downloads

18

Readme

InstaZap ⚡

npm npm version npm downloads sponsors

A straightforward bot to forward Instagram messages directly to your Slack organization.

Usage

Installation

Add instazap to your Node application.

npm install instazap --save
yarn add instazap ## or in yarn

Additionally, go through the process of adding a Slack bot to your organization if you haven't made one yet. It is pretty straightforward.

Example

import InstaZap from 'instazap'

// Invoke it with credentials.
InstaZap({
  instagram: {
    credentials: {
      USERNAME: process.env.IG_USERNAME,
      PASSWORD: process.env.IG_PASSWORD,
    }
  },
  slack: {
    channel: process.env.SLACK_CHANNEL_ID,
    credentials: {
      OAUTH_TOKEN: process.env.SLACK_BOT_TOKEN,
      SIGNING_SECRET: process.env.SLACK_SIGNING_SECRET,
    }
  }
})

How To Create A Slack Bot

To create a Slack Bot, please follow these steps:

  1. Login to Slack on Web.
  2. Navigate to Your Apps and click on Create New App > From scratch.
  3. Name your app and select the workspace.
  4. After creating your bot, navigate to OAuth & Permissions (under Features tab on the left) and scroll down to Scopes.
  5. Click on Add an OAuth Scope and add the following scopes: channels:join, chat:write, chat:write.public, files:read, files:write, links.embed:write, links:read, links:write, reminders:read, reminders:write.
  6. While you're on the OAuth & Permissions page, install the bot to your workspace by clicking on the Install to Workspace button. After you've done this, copy the Bot User OAuth Token, this is the value for SLACK_BOT_TOKEN.
  7. Navigate to App Home (under Features tab on the left) and enable Home Tab under Show Tabs. You can personalize the bot in the Your App’s Presence in Slack section as well.
  8. Finally, navigate to Basic Information (under Settings) and copy the Signing Secret. This is the value for SLACK_SIGNING_SECRET.

Congratulations! Your Slack Bot is now ready. 🎉

API

instagram

object

credentials

object The credentials for the Instagram account.

attemptReconnections

boolean - OPTIONAL

Handles reconnections on connection failure of any sort with the Instagram API.

slack

object

channel

string

This is the default channel for all your Instagram messages.

customChannelMapper

(message: StructuredMessage) => string - OPTIONAL

If you want specific messages to go into certain channels (such as, Reels in #reels, and so on) then utilize this custom function that maps a message to a channel ID.

mock

boolean - OPTIONAL

Set this as true if you'd like to mock the Slack app and get console logging of messages instead of them being posted to Slack channels.

port

number - OPTIONAL

Port for Slack Bot.

credentials

object The credentials for the Slack bot.

getAllItemsFromCarousel

boolean - OPTIONAL

Determines if all the items in a carousel post should be downloaded and posted in the channel. Default behavior is to post only the focused item in the carousel.

ignoreAspectRatio

boolean - OPTIONAL

As the name suggests, it ignores the aspect ratio of the media and goes for the highest quality available.

enableLogging

boolean - OPTIONAL

Enable additional logs for debugging. Error logs are unaffected by this.

sleep

object - OPTIONAL

randomSleepRange

object - OPTIONAL

Determines when how want the bot to sleep at the beginning of a sleep cycle, and how long you want it to be asleep. Default values work well, but feel free to play with it.

The ranges are used to generate a random time value that is eventually used - a value betweeen 2 seconds to 1.5 minutes is chosen by default.

timeToNextSleepRange

object - OPTIONAL

Determines the time period between the bot's sleep-wake simulations. Default value of ranges is 30 mins to 3 hours. This maintains the Instagram MQTT API connection health.

Troubleshooting

If the bot stops working at any time, it is probably because of the following reasons (listed in order of probability):

  1. 🚩 Instagram flagged your account: This requires you to login from your mobile (or any trusted device), request for an OTP and fill it.
  2. 🤕 A malformed message was sent to Instagram: This will pop up in the error logs. You may create a new issue for this.
  3. 😪 A malformed message was forwarded to Slack: This will pop up in the error logs. You may create a new issue for this.

Disclaimer

Neither the author, the contributors, nor this tool (or its underlying packages) are responsible for any damage that you may cause to yourself or others. Please do not use this tool for evil purposes.

License

MIT