2017-05-23 5 views
0

i는 전송을 위해 PHP를 통해 단순히 스카 이프 봇 빌트와 serch 피곤 마사지 메신저를 받아 봐 싶어하지만 지금 https://login.microsoftonline.com/botframework.com/oauth2/v2.0/tokenphp를 통해 skype bot에 마사지를 연결하고 보내는 방법은 무엇입니까?

에서 토큰을 얻을 후 도움이 필요이

메신저에 대한 진정한 SDK 또는 complated 샘플을 찾을 수 없습니다 나는 토큰을 가지고 실시간으로 sed하고 항상 내 요청으로 이것을 보냅니다.

하지만 마사지를받을 수있는 방법은 무엇입니까? 마사지 매개 변수는 무엇입니까? 마사지 게시물 링크를 보내려면 무엇입니까?

이 오류가 있습니다 : 내부 서버 오류가 발생하여 페이지를 표시 할 수 없습니다.

pls 나를 도와주고 완성 된 또는 진정한 SDT를 보내주십시오! 자식 또는 구글이 더 내 대답을 찾을 수있는 avry SDK를 rtying

메신저 ..

감사합니다.

답변

0

안녕하세요, 내 bot 스크립트입니다. 토큰을 받고 realtim을 보낼 수 있습니다. msg를 보내려면 다음 단계는 무엇인지, 내 스크립트 문제는 무엇인지 알 수 없습니까?

내가 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)); 

메신저 링크 https://blogs.msdn.microsoft.com/tsmatsuz/2016/08/19/build-skype-bot-with-microsoft-bot-framework-oauth-and-rest-api/

를 사용 useing