I have a problem using telegram bot api with php. I send messages easily to user when I set 'reply_markup' to a ReplyKeyboardMarkup but whenever I want to use it as ForceReply bot keeps sending a single message to user over and over. do you know why it is working like that? what should I do to fix it?
You need to specify your markup like this :
$replyMarkup = array(
'force_reply' => true,
'selective' => true
);
If you need to have custom keyboard you can follow this :
$keyboradsValue = array(
array("button 1","button 2"),
array("button 3","button 4"),
);
$replyMarkup = array(
'keyboard' => $keyboradsValue,
'force_reply' => true,
'selective' => true
);
After that you need to encode your object using json_encode
$encodedMarkup = json_encode($replyMarkup, true);
Finally you just put above code at your query string at the rest of sendMessage.