tom_chattools 1.0.1 copy "tom_chattools: ^1.0.1" to clipboard
tom_chattools: ^1.0.1 copied to clipboard

Unified chat API abstraction for Telegram, WhatsApp, Signal, and other messaging platforms.

example/tom_chattools_example.dart

import 'package:tom_chattools/tom_chattools.dart';

void main() async {
  // Example: Connect to Telegram
  final api = await ChatApi.connect(ChatSettings.telegram(
    'YOUR_BOT_TOKEN', // Get this from @BotFather
  ));

  // Define the receiver (user/chat to communicate with)
  final receiver = ChatReceiver.id('123456789');

  // Send a message to the receiver
  await api.sendMessage(receiver, 'Hello from Tom ChatTools!');

  // Wait for and process responses from that same receiver
  final response = await api.getMessages(
    receiver,
    maxWait: Duration(seconds: 30),
    minWait: Duration(seconds: 5),
  );

  if (response.hasMessages) {
    for (final message in response.messages) {
      print('Received from ${message.sender.name}: ${message.text}');
    }
  } else {
    print('No messages received (status: ${response.status})');
  }

  await api.disconnect();
}
0
likes
160
points
27
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Unified chat API abstraction for Telegram, WhatsApp, Signal, and other messaging platforms.

Homepage
Repository (GitHub)

Topics

#telegram #chat #messaging #bot

License

BSD-3-Clause (license)

Dependencies

televerse

More

Packages that depend on tom_chattools