# twict

> Library for Twitter Account Activity API

Latest version **0.0.12** (published 2022-12-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install twict
pnpm add twict
yarn add twict
bun add twict
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2022-12-24 |
| First published | 2021-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 113.9 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 9 |
| Maintainers | hota1024 |

## Links

- npm: https://www.npmjs.com/package/twict
- Repository: https://github.com/hota1024/twict
- npm.io page: https://npm.io/package/twict

## Dependencies (5)

- [ufo](https://npm.io/package/ufo.md) ^0.6.10
- [axios](https://npm.io/package/axios.md) ^0.21.1
- [express](https://npm.io/package/express.md) ^4.17.1
- [twitter](https://npm.io/package/twitter.md) ^1.7.1
- [request-promise](https://npm.io/package/request-promise.md) ^4.2.6

## Recent versions

- 0.0.12 (latest) — 2022-12-24
- 0.0.11 — 2022-12-19
- 0.0.10 — 2022-10-08
- 0.0.9 — 2022-10-08
- 0.0.8 — 2022-03-05
- 0.0.7 — 2021-04-19
- 0.0.6 — 2021-04-17
- 0.0.5 — 2021-04-14
- 0.0.4 — 2021-04-14
- 0.0.3 — 2021-04-11
- 0.0.2 — 2021-04-09
- 0.0.1 — 2021-04-09
- 0.0.0 — 2021-04-09

## README

<h1 align="center">🐦 twict</h1>
<h2 align="center">A library for Twitter Account Activity API written in TypeScript</h2>

## 🚀 Installation

```shell
yarn add twict
# or
npm install twict
```

## 🗺️ Tutorial

### 1. Install twict

```shell
yarn add twict
# or
npm install twict
```

### 2. ngrok

[download ngrok](https://ngrok.com/download) to your environment.

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

```shell
ngrok http 5000
```

### 3. Like detection

```typescript
// 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.

```shell
npx ts-node like-detection.ts
```

---
_Source: https://npm.io/package/twict · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
