1.0.8 • Published 1 year ago

@ingestkorea/client-telegram v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@ingestkorea/client-telegram

npm (scoped) NPM downloads Build Status

Description

INGESTKOREA SDK Telegram Client for Node.js.

Installing

npm install @ingestkorea/client-telegram

Getting Started

Pre-requisites

  • Use TypeScript v4.x
  • Includes the TypeScript definitions for node.
    npm install -D @types/node # save dev mode

Support Commands

  • SendMessage

Import

import {
  TelegramClient,
  SendMessageCommand, SendMessageCommandInput
} from '@ingestkorea/client-telegram';

Usage

To send a request, you:

  • Initiate client with configuration.
  • Initiate command with input parameters.
  • Call send operation on client with command object as input.
// a client can be shared by different commands.
const client = new TelegramClient({
  credentials: {
    token: TOKEN, // 0123456789:ABCDEFG
    chatId: CHAT_ID // 9876543210 (string | number)
  }
});

const input: SendMessageCommandInput = {
  text: 'hello client-telegram',
  chatId: CHAT_ID // optional // this chatId override TelegramClient config
};
const command = new SendMessageCommand(input);

Async/await

(async () => {
  try {
    const data = await client.send(command);
    console.dir(data, { depth: 4 })
  } catch (err){
    console.log(err)
  }
})();

Promises

client.send(command)
  .then(data => console.dir(data, { depth: 4 }))
  .catch(err => console.log(err));

License

This SDK is distributed under the MIT License, see LICENSE for more information.

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago