AntonAL
AntonAL

Reputation: 17410

Telegram bot for submitting ideas

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?

Upvotes: 0

Views: 337

Answers (1)

Vasfed
Vasfed

Reputation: 18464

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.

Upvotes: 1

Related Questions