1.1.0 • Published 12 months ago

@ingestkorea/client-telegram v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months 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 v5.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.1.0

12 months ago

1.0.9

12 months ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago