i want to bild a simply skype bot via php for send and recive massage im tired for serch but cannot find any true sdk or complated sample for this
im need help after get token from https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token
now i have my token and sed realtime and always send this with my requests .
but im not undrestand and fine what is any way for send massage ? what is send massage parameters ? what is send massage post link ?
i have this error: The page cannot be displayed because an internal server error has occurred.
pls help me and send completed or true sdk to work !
im rtying avry sdk in git or google no find my answer ..
thanks .
Hi this is my bot script , with this i can get token and send realtim just i dont known what is next step for send msg or what is my script problem ?
i useing php lagn
$content = file_get_contents("php://input");
$update = json_decode($content,true);
$conversation=$update['conversation']['id'];
$user=$update['from']['id'];
file_put_contents('skype.txt',print_r($update,true));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token");
curl_setopt($ch, CURLOPT_POST, 1);
$params ="grant_type=client_credentials&";
$params.="client_id=*****************************"; // My id
$params.="client_secret=**************************"; // My Password
$params.="scope=https://api.botframework.com/.default";
curl_setopt($ch, CURLOPT_POSTFIELDS,$params); //Post Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers = ['Content-Type: application/x-www-form-urlencoded'];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec ($ch);
if(curl_errno($ch)){
var_dump(curl_error($ch));
}
$result=json_decode($result);
$access_token=$result->access_token; // now i have access token
// what is after this step ? for send or reply msg in skype bot ?
// send request for send massage ?!
curl_setopt($ch, CURLOPT_URL,"https://skype.botframework.com/v3/conversations/".$conversation."/activities/".$user);
curl_setopt($ch, CURLOPT_POST, 1);
// what is parametr for send or reply msg ?
// what is requarement params ?
$params=array(
'type' =>'message' ,
'timestamp'=>$update['timestamp'],
'from'=>array(
'id' => $update['from']['id'],
'name' => $update['from']['name'],
),
'conversation'=>array(
'id' => $update['conversation']['id'],
),
'recipient'=>array(
'id' => $update['recipient']['id'],
'name' => $update['recipient']['name'],
),
'text'=>'Wellcome to MWH',
'replyToId' =>$user,
);
$params=json_encode($params);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params); //Post Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers = ['Authorization: Bearer'.$access_token];
$headers = ['Content-Type: application/json; charset=utf-8'];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$res = curl_exec ($ch);
if(curl_errno($ch)){
var_dump(curl_error($ch));
}
curl_close ($ch);
$res=json_decode($res);
// file_put_contents('skype.txt',print_r($res,true));
im use this link https://blogs.msdn.microsoft.com/tsmatsuz/2016/08/19/build-skype-bot-with-microsoft-bot-framework-oauth-and-rest-api/