0

I am trying to create a possibility for a user to call a technical support in the chat with the bot. I need to find a way to connect a real person to chat.

So, for example, user starts the bot and uses a command '/support'. Manager (real person) gets a notification (somehow) and can step in into the conversation in the same chat (where user called a support). Bot meanwhile should stop answering any commands until manager or user stops the help-conversation (with a '/stop' command, for example). How can I create something like that?

1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Aug 7, 2023 at 11:01

1 Answer 1

0

You can use a method or algorithm called step, the way you do this is you have to:

  1. Create a database (doesn't have to be online necessarily, you can use sqlite, json, redis and etc...)
  2. For every user and support guy when they enter /start for the first time have to create a row for them containing (user_id integer, step string) the step doesn't matter at the beginning you can set it empty and for user_id set it to the user id based on their telegram message (you can create a is_supporter field to know if a user is supporter or just create another table for them)
  3. When the user for example types /support and someone accepts their support ticket you have to set the user step to something for like "support_{support_id}" where the support_id is the guy who answers question and you do the same thing but for the support guy
  4. Everytime they send a message, before you do anything else (like check for commands and etc...) you have to check their step, if it is like support_x you have to redirect their message to x
  5. When they for example enter the /cancel command you can clear the step field both for supporter and user so they won't message each other anymore
1
  • Thank you, good man, now that's clear! Commented Aug 7, 2023 at 11:41

Your Answer

By clicking β€œPost Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.