skip to Main Content

I’m trying to make a bot that register an user on my website.
This bot should ask some key informations about the user like:

  • First Name
  • Last Name
  • Username
  • Email Address
  • Profile Link

In your opinion what is the best method to implement this feature?
I’ve seen somebody suggesting to use database in order to find out what message you’ve sent to user, and what information you have for the user and ask the missing one accordingly!
This particular way to solve this problem, could be effective but not so much efficient imho! Is there any way at all to use like a callback query or maybe give a message an specific id, so I can check whether the last message id is the “username_request” and respond accordingly?

Let me know

Oh by the way, I’m using PHP and the Webhook method!

2

Answers


  1. I’m working on a similar project at the moment.

    I was thinking about some kind of syntax wherein you place the things you want to save, for example:

    John,,,Hawk,,,JHawk,,,[email protected],,,https://www.url.com/
    

    After saying

    /adduser
    John,,,Hawk,,,JHawk,,,[email protected],,,https://www.url.com/

    inside the chat: you can split the message at the three commas (,,,) with PHP.

    Otherwise you could:

    • Make some kind of transaction protocol to let the bot ask values per item after saying

    /adduser

    inside the Telegram chat.

    Let me know how you think about these ways! Typing the three commas (,,,) once is not so much effort, but if you have to add multiple users a day… It could become very annoying..

    Login or Signup to reply.
  2. For such tasks – there are solution.
    You need to install shapoapps/multibot_driver (composer require shapoapps/multibot_driver) for Laravel.
    In this packet there are session manager. Its like sessions for web browser users. But only for messenger users (telegram, …).
    After each user message received, you can record user input into the session on server side. When each new request(message) received, you read the data from the session and build the application logic.
    Here’s the documentation – https://github.com/shapoapps/multibot_driver

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search