Problem Statement
Imagine a scenario where you set up a whatsapp bot and you use buttons of approve/reject tool calls.
Say that the user sent a message and clicks approve/reject right away - I'd like to be able to handle the button click first while queuing the message.
Complex case is when user just sends multiple messages + multiple reactions + multiple actions in same few seconds. As the developer I would like to be able to handle it in the order I want.
Proposed Solution
A lock for all kinds of events for same thread/channel that also groups the events.
Could be configured by concurrency: 'batch-debounce'.
Bot subscribes to batches, not to single event type, via bot.onBatch(<handler>).
Handler gets an array of all the events or an object like { messages, actions, reactions, etc...}, or similar.
That way the developer can decide how to handle these cases mentioned above.
Alternatives Considered
No response
Use Case
import { Chat } from "chat";
const bot = new Chat({
userName: "botName",
adapters: {
telegram: createTelegramAdapter(),
whatsapp: createWhatsAppAdapter(),
},
state: createPostgresState({ client: pool }),
fallbackStreamingPlaceholderText: null,
concurrency: "batch-debounce"
});
bot.onBatch(handleEvents)
Priority
Important
Contribution
Additional Context
No response
Problem Statement
Imagine a scenario where you set up a whatsapp bot and you use buttons of approve/reject tool calls.
Say that the user sent a message and clicks approve/reject right away - I'd like to be able to handle the button click first while queuing the message.
Complex case is when user just sends multiple messages + multiple reactions + multiple actions in same few seconds. As the developer I would like to be able to handle it in the order I want.
Proposed Solution
A lock for all kinds of events for same thread/channel that also groups the events.
Could be configured by concurrency: 'batch-debounce'.
Bot subscribes to batches, not to single event type, via
bot.onBatch(<handler>).Handler gets an array of all the events or an object like { messages, actions, reactions, etc...}, or similar.
That way the developer can decide how to handle these cases mentioned above.
Alternatives Considered
No response
Use Case
Priority
Important
Contribution
Additional Context
No response