using the below code sniplet to send an InlineQuery to a chat (or channel or group) in Telegram as answer to a "Share"-button from another chat - it seems to work well...
My inline bot creates a message and places it into the target chat.
Problem is: I do not get a message-ID or similar back which allows me to acces this message again in order to be able to modify it.
(Goal is to synchronize content between several channels even if no bot is part of the the channel and the content has been shared via "Share"-inline-buttons).
I.e. $res in the sample below is $res = {"ok":true,"result":true}
Any idea, what can be done?!
Thanks!
$botID = 'botabcdefghij1234567890';
$url = "https://api.telegram.org/$botID/answerInlineQuery";
$results = array(
array(
"type" => "article",
"id" => $iid,
"title" => $title,
"description" => $desc,
"reply_markup" => $reply, // some buttons here
"input_message_content" => array(
"message_text" => "$txt", // synchronized text
"parse_mode" => "HTML"
)
)
);
$post = array("inline_query_id" => $iid, "results" => json_encode($results));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$res = curl_exec($ch);
curl_close($ch);
You can send multiple answers in one inline query, so please enable
/setinlinefeedback
in @BotFather to receive messages ID.It will return chosen_inline_result update, then use
inline_message_id
to modify the message.