Telegram Inline Query
Allows you to receive and answer an inline query from Telegram.
Last updated
Was this helpful?
Allows you to receive and answer an inline query from Telegram.
Last updated
Was this helpful?
Define the context that will receive inline queries, by modify the field bellow in configuration file.
In order to send answers to an inline query, call @reply.inline_query_result()
method:
inline_query_result(type=Symbol, answer=Hash)
type
Symbol
Required.
Can be article
, audio
, contact
, game
, document
, gif
, location
, mpeg4_gif
, photo
, venue
, video
or voice
.
answer
Hash
When an inline query arrives, the configured context will handle it, through that capture text messages such as , , , and so on.
In the next example, we've created a context called NewsContext
, which has been configured to handle inline queries as follows:
This context will call two keyword blocks with the arguments "nytimes"
and "cnn"
respectively. Each of them will return news extracted from the RSS service from the The New York Times or CNN.
To implement this example you'll need to add the gems feedjira
and httparty
to the project's Gemfile.
In the example above, html_template("news/preview", {article: article})
has been called, this method loads a template from bot/templates/news/preview.rhtml
with the following code:
This content is what the person with whom the user is sharing the article will receive.
Required. The answer, that varies depending on the type defined, read about the response formats for each type on .
Learn more about html_template()
method .