2016-09-24 2 views
1


C# 응용 프로그램에서 Microsoft Bot Framework로 만든 내 Facebook 봇으로 간단한 메시지를 보내려고합니다. 스카이프와
이 perfeclty 작동하지만, 나는 다음과 같은 요청 오류 얻을 메신저 봇하려고하면
REST를 통해 Facebook 봇으로 메시지를 보낼 수 없습니다. Api Botframework

{ 
    "message": "The 'form' field is unrecognized" 
} 

내가 메시지를 보내려면 다음과 같은 활동을 사용하고 있습니다 :

{ 
"type": "message", 
"id": "...", 
"timestamp": "2016-09-24T02:47:03.8956722Z", 
"serviceUrl": "https://facebook.botframework.com", 
"channelId": "facebook", 
"from": { 
    "id": "...", 
    "name": "..." 
}, 
"conversation": { 
    "id": "..." 
}, 
"recipient": { 
    "id": "...", 
    "name": "..." 
}, 
"text": "Hy, from remote!", 
"channelData": { 
    "sender": { 
    "id": "..." 
}, 
"recipient": { 
    "id": "..." 
}, 
"timestamp": 1474685223681, 
"message": { 
    "mid": "...", 
    "seq": 35, 
    "text": "Testtest" 
} 

을} }


'보낸 사람'필드가 실제로 여기에 있습니다.
'보낸 사람'입력란을 삭제하면 요청 메시지에 필수 입력란이 표시되어 필드를 인식합니다. 어쩌면 잘못된 형식으로 포맷 된 것일 수도 있습니다.
이렇게하려면 어떻게해야합니까?

+0

은 당신이 오타가 없습니다 :

데이터는 봇에 전송 된 같은 메시지에서 추출 할 수 있습니까? 위의 메시지는 "양식"필드가 인식되지 않고 "보낸 사람"필드가 아니라고 말합니다. – Lars

답변

2

더 적은 수의 인수로 메시지를 작성하십시오.
Facebook의 경우 어떤 이유로 든 보낸 사람 필드가 필요하지만 다른 모든 매개 변수를 제공 할 필요는 없습니다.

는 다음과 같은 요청을 시도해보십시오

{ 
    "type": "message", 
    "textFormat": "plain", 
    "text": "Hello messenger!", 
    "from": 
    { 
    "id": "your-id-from-recipient-id-in-the-message-received", 
    "name": "your-name-from-recipient-name-in-the-message-received" 
    } 
} 

정확하게 ID와 사용자가 메시지를 보낼 때받은 이름을 사용하는 것이 중요합니다.

{ 
    "type": "message", 
    "id": "<snip>", 
    "timestamp": "2017-01-06T14:09:36.8882093Z", 
    "serviceUrl": "https://facebook.botframework.com", 
    "channelId": "facebook", 
    "from": { 
    "id": "<snip>", 
    "name": "<snip>" 
    }, 
    "conversation": { 
    "isGroup": false, 
    "id": "<snip>" 
    }, 
    "recipient": { 
    "id": "your-id-from-recipient-id-in-the-message-received", 
    "name": "your-name-from-recipient-name-in-the-message-received" 
    }, 
    <snip> 
} 
관련 문제