0

I need to implement a Telegram bot, that allows Telegram users to submit ideas, that will be published on website.

This is just a second communication channel with users.

Is there any possibility to implement a form filling using Telegram API.

Interaction with user can be following:

User: /idea
Bot: Enter title
User: "Veggie coconut curry"
Bot: Enter description
User: "Rich and creamy vegan coconut curry. This delicious veggie-packed curry is mildly spicy and perfect for a fast dinner. Ready in 30 minutes. Gluten-free."
Bot: Upload image
User picks an image
Bot: Anything else?
User: /submit

It seems, like Telegram API is stateless. If so, I can implement kind of session in web app backend.

But how can I distinguish requests, that Telegram API follows up to backend, using web hooks?

Website is implemented on Rails 5.2.

Is there some best practices in this direction or frameworks?

AntonAL
  • 16,692
  • 21
  • 80
  • 114
  • Possible duplicate of [How to store sessions of a telegram bot user in my db](https://stackoverflow.com/questions/46011713/how-to-store-sessions-of-a-telegram-bot-user-in-my-db) – Alexander Azarov Apr 01 '19 at 12:19

1 Answers1

1

Along with message texts you will get user ids in webhooks (update_content.dig('message', 'from', 'id')). Messages from the same user within some reasonable timeframe can be assumed to be from the same session.

Vasfed
  • 18,013
  • 10
  • 47
  • 53