0
저는 Node.js에서 새로 왔으며 SDK를 사용하여 facebook 사용자 "first name"을 검색하는 데 어려움이 있습니다. "Hello {userName}"에 대한 답변을 원할 때 "인사말"이라고하는 이야기가 있습니다.Node.js Wit.ai SDK - 메신저에서 사용자 이름 검색
나는 "인사"이야기와 관련되는 getUserName 메서드 이름 액션을 정의한 다음과 같이 requestUserName가 정의
getUserName({context, entities}) {
if(context.fbid) {
return new Promise(function(resolve, reject) {
if (context.userName) {
return requestUserName(context)
.then((json) => {
context.userName = json.first_name;
return context;
})
.catch((err) => {
console.error('Oops! An error occurred while asking the name of the user: ',
err.stack || err);
});
} else {
return resolve(context);
}
});
} else {
console.error('Oops! Couldn\'t find user for session:', sessionId);
// Giving the wheel back to our bot
return Promise.resolve()
}
}
:
액션이 트리거 될 것으로 보인다하더라도const requestUserName = (id) => {
const qs = 'access_token=' + encodeURIComponent(FB_PAGE_TOKEN);
return fetch('https://graph.facebook.com/v2.8/' + id +'?' + qs)
.then(rsp => rsp.json())
.then(json => {
if (json.error && json.error.message) {
throw new Error(json.error.message);
}
return json;
});
};
, 그것은 작동하지 않으며 그 이유에 대해서는 전혀 모른다 : ( 놀랍게도 또 다른 행동이 촉발되었지만이 행동이 "인사"이야기와 관련이 없기 때문에 왜 그런지 모르겠다. 나는 몇 가지 핵심 개념을 놓쳤다 고 생각한다. Node.js SDK
도와 주시면 대단히 감사하겠습니다.
안녕 ... wit.ai이 때 우리는 사용자 이름을 얻을 수있는 방법이 있는지 당신은 알고 계십니까 페이스 북의 메신저를 통해 통합 된 NLP? – SamT