# telehook

> Trigger localhost / non-https telegram hook

Latest version **1.1.0** (published 2018-07-02) · MIT license · 0 weekly downloads

## Install

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

Provides the command `telehook`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-07-02 |
| First published | 2018-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Lafif Astahdziq |
| Maintainers | qutek |
| Keywords | node, nodejs, telegram, hook, bot, development |

## Links

- npm: https://www.npmjs.com/package/telehook
- Repository: https://github.com/qutek/telehook
- Homepage: https://github.com/qutek/telehook#readme
- Issues: https://github.com/qutek/telehook/issues
- npm.io page: https://npm.io/package/telehook

## Dependencies (6)

- [clui](https://npm.io/package/clui.md) ^0.3.6
- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [extend](https://npm.io/package/extend.md) ^3.0.1
- [request](https://npm.io/package/request.md) ^2.87.0
- [commander](https://npm.io/package/commander.md) ^2.15.1
- [request-promise](https://npm.io/package/request-promise.md) ^4.2.2

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-07-02
- 1.0.1 — 2018-06-25
- 1.0.0 — 2018-06-25

## README

# Telehook.js

Telegram bot development tool for triggering localhost / non-https hook with [getUpdates](https://core.telegram.org/bots/api#getupdates)

It will listen for incoming updates from Telegram.org and if there any updates it will forward the messages to your local webhook.

Please make sure there is no active webhook registered on your bot, you can check it here `https://api.telegram.org/bot<bot-token>/getWebhookInfo`

if not so, you can remove your active webhook by accessing `https://api.telegram.org/bot<bot-token>/setWebhook?url=`

## Installation
>$ `npm install telehook --save`

or install as global to use Telehook CLI
>$ `npm install -g telehook`
    
## Example
```js
const telehook = require('telehook');

var hook = telehook('YOUR_BOT:API_KEY', 'http://localhost/your-hook/', {
  interval: 1000,
  timeout: 0
});
hook.on('data', function(data){
	console.group('RECEIVED');
	console.log(data);
	console.groupEnd();
})

hook.on('error', function(error){
	console.group('ERROR');
	console.error(error);
	console.groupEnd();
})

hook.on('forwarded', function(data){
	console.log('forwarded');
})

hook.on('forward.error', function(error){
	console.group('FORWARD ERROR');
	console.error(error);
	console.groupEnd();
})
```

## CLI
Make sure you have install Telehook CLI with
>$ `npm install -g telehook`

use command run and pass the bot api key as well as the hook ur.
```sh
telehook run <botToken> <hookUrl>
```
### Options
- `-i, --interval`  *(To set the interval for checking updates, default to 1000 (1 second)*
- `-t, --timeout`  *(To set the timout request while checking updates, default to 0*

## License

MIT

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