Socket
Socket
Sign inDemoInstall

twict

Package Overview
Dependencies
115
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    twict

Library for Twitter Account Activity API


Version published
Weekly downloads
1
Maintainers
1
Install size
7.99 MB
Created
Weekly downloads
 

Readme

Source

🐦 twict

A library for Twitter Account Activity API written in TypeScript

🚀 Installation

yarn add twict
# or
npm install twict

🗺️ Tutorial

1. Install twict

yarn add twict
# or
npm install twict

2. ngrok

download ngrok to your environment.

start http tunnel on port 5000 and copy https://*.ngrok.io url.

ngrok http 5000

3. Like detection

// like-detection.ts
import { Activity, isExpectEventType } from 'twict'

async function main() {
  const activity = new Activity('your environment label', {
    consumerKey: 'your consumer key',
    consumerSecret: 'your consumer secret',
    token: 'your access token',
    tokenSecret: 'your access token secret',
  })

  activity.onFavorite((event) => {
    for (const like of event.favorite_events) {
      console.log(
        `${like.user.screen_name} liked your tweet (${like.favorited_status.text})`
      )
    }
  })

  await activity.listen(5000)

  await activity.deleteAllWebhooks()
  await activity.registerWebhook('your ngrok url here')
  await activity.subscribe()
}

main()

and run with ts-node.

npx ts-node like-detection.ts

FAQs

Last updated on 24 Dec 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc