howdyai / botkit

Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.
MIT License
11.39k stars 2.28k forks source link

How to send message to web adapter at a later point with bot reference or websocket #2174

Closed deepakmahakale closed 2 years ago

deepakmahakale commented 2 years ago

Are you sure this is an issue with the Botkit core module?

Yes.

What are you trying to achieve or the steps to reproduce?

We are trying to integrate another application that communicates with the Botkit backend.

The initial conversation happens with the bot but later there comes an agent.

Now we want to send the same message to the web that the agent has sent to the backend. The communication between the agent and backend is over API calls.

let bot = await controller.spawn();
await bot.say('ok');

NOTE:

I have the user_id where I want to send the message

I found a few similar issues but they are no help since botkit has changed a lot in the last 3 years. - https://github.com/howdyai/botkit/issues/1705

What was the result you received?

What did you expect?

Screenshots and animated GIFs

Context:

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

georak commented 2 years ago

any answer on this?

georak commented 2 years ago

Maybe this will help you!

    const bot = await this.botkitController.spawn()

    await bot.changeContext({
        user: {
            id: user
        },
        channelId: "websocket",
        bot: {
            id: "bot"
        },
        conversation: {
            id: user
        }
    })

    await bot.say(message)
benbrown commented 2 years ago

I think @georak's answer is correct.

Let me know if you have any further questions.