php - how to get PSID Facebook messenger
Get the solution ↓↓↓I have donecomposer require laravel/socialite
about Facebook login then I would like to send a notify message by Facebook messenger to the user there is a way to get PSID from Facebook user_id
$_reply_message = '{
"messaging_type": "RESPONSE",
"recipient": {
"id": "<PSID>"
},
"message": {
"text": "hello, world!"
}
}';
function send_reply($access_token='',$reply='') {
$url="https://graph.facebook.com/v11.0/me/messages?access_token=$access_token";
$ch = curl_init();
$headers = array("Content-type: application/json");
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$reply);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$st = curl_exec($ch);
$result = json_decode($st,TRUE);
return $result;
}
send_reply($access_token,$_reply_message);
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: composer detected issues in your platform: your composer dependencies require a php version ">= 8.0.2".
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.