I set a webhook with telegram and basically use this code to send messages to telegram from my server:
header("Content-Type: application/json");
$parameters = array('chat_id' => xxx, "text" => "hi there");
$parameters["method"] = "sendMessage";
echo json_encode($parameters);
and this all works.
The problem is that I can't send two messages one after the other.
I tried echoing two times:
header("Content-Type: application/json");
$parameters = array('chat_id' => xxx, "text" => "hi there");
$parameters["method"] = "sendMessage";
echo json_encode($parameters);
$parameters["text"] = "hi everybody";
echo json_encode($parameters);
and I tried sending an array of messages:
header("Content-Type: application/json");
$parameters = array('chat_id' => xxx, "text" => array("hi there", "hi everybody"));
$parameters["method"] = "sendMessage";
echo json_encode($parameters);
both with no success.
What am I doing wrong??