-
I would like to use InlineKeyboardMarkup in my bot to implement a configuration menu similar to what is used by the @Botfather for configuring bots. From the Telegram API docs it sounds to me like I just need to send a message with a I tried it with code like this: keyboard =
[
[%{text: "Configure A", callback_data: "a_start"}],
[%{text: "Configure B", callback_data: "b_start"}]
]
|> Jason.encode!()
Telegram.Api.request(token, "sendMessage",
text: "Configuration Menu",
chat_id: chat_id,
reply_markup: keyboard) The result is sadly nothing at all. As soon as I add the
I'm fairly new to Elixir, so it might just be a stupid mistake on my side. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @MLNW Have a look here https://visciang.github.io/telegram/readme.html#sendmessage-with-keyboard About errors: we are just send request to the telegram server and you get back a reply from them, just look at the response. IE: iex(5)> Telegram.Api.request(token, "sendMessage", chat_id: 0, text: "text")
{:error, "Bad Request: chat not found"}
iex(6)> Telegram.Api.request(token, "getMe", this_is_an_unknown_parameter: 1)
{:ok, %{...}} Hope it helps you |
Beta Was this translation helpful? Give feedback.
Hi @MLNW
Have a look here https://visciang.github.io/telegram/readme.html#sendmessage-with-keyboard
Just use the json object "facility" (no need to serialize the object yourself) and use the correct
reply_markup
object schema (keyboard_markup = %{one_time_keyboard: ..., keyboard: ...}
)About errors: we are just send request to the telegram server and you get back a reply from them, just look at the response.
But consider that they will apply the robustness principle, so if you send by mistake extra info that won't give any error.
IE: