chatterbox 1.0.4 copy "chatterbox: ^1.0.4" to clipboard
chatterbox: ^1.0.4 copied to clipboard

outdated

Framework to build dialog flows for Telegram Bots

Chatterbox is a simple framework to build multi level Telegram Bot dialog flows. It is build around televerse library.

Features #

Allows to process different kind of messages from user and reply to them within the given context

Getting started #

Can be used with both webhook and polling.

Usage #

Webhook with Cloud Functions #

@CloudFunction()
Future<Response> function(Map<String, dynamic> updateJson) async {
  try {
    final flows = <Flow>[
      //todo
    ];

    Chatterbox(Config.botToken, flows, StoreProxy()).invokeFromWebhook(updateJson);
    return Response.ok(
      null,
      headers: {'Content-Type': 'application/json'},
    );
  } catch (error) {
    return Response.badRequest();
  }
}

Coding dialog flows #

Creating Flows #

Reacting to user input #

[ReactionResponse] is a simple reaction that allows to respond with a test to user input

ReactionResponse(
  /// Required text message to reply to user
  text: 'What is your favorite number?',
  /// Optional buttons
  buttons: [
    InlineButton(
      /// Button text
      title: 'Seventy three',
      /// Uri of a step to be invoked when this button is pressed
      nextStepUri: NextStep.toStepUri().appendArgs('73')
    ),
  ],
);

It can also contain buttons

3
likes
0
points
30
downloads

Publisher

verified publisherdevartel.io

Weekly Downloads

Framework to build dialog flows for Telegram Bots

Repository

License

unknown (license)

Dependencies

collection, televerse

More

Packages that depend on chatterbox