i am working on facebook messenger chatbot. i dealing with facebook braodcast when i trying to message_creative i don't get any response from facebook regarding to message_creative_id. i am also set up webhook to my website and save all response to another file hell.txt
<?php
if(isset($_REQUEST['hub_challenge'])) {
$challenge = $_REQUEST['hub_challenge'];
$hub_verify_token = $_REQUEST['hub_verify_token'];
}else{
$rawdata = file_get_contents('php://input');
$handle = fopen('hell.txt','w');
fwrite($handle,$rawdata);
fclose($handle);
}
$input = json_decode(file_get_contents('php://input'), true);
$senderId = $input['entry'][0]['messaging'][0]['sender']['id'];
$messageText = $input['entry'][0]['messaging'][0]['message']['text'];
$response = null;
if($messageText == "broadcast"){
sendResponse($markSeen,$input);
//sendResponse($typing,$input);
$response = "{
'messages':'Message',
}";
SendMessageCreative($response,$input);
}
function SendMessageCreative($response,$input){
$ch = curl_init('https://graph.facebook.com/v4.0/me/message_creatives?access_token=XXXXXX');
curl_setopt($ch, CURLOPT_POSTFIELDS, $response);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
if(!empty($input)){
$result = curl_exec($ch);
}
curl_close($ch);
}
?>
I dont if i am write right code for message creative or not . Thanks for your help