-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Facebook Messenger v3.2 Fix #133
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -47,7 +47,7 @@ module.exports = function fbSetup(api, bot, logError, optionalParser, optionalRe | |||||
stageName: lambdaDetails.alias | ||||||
}).then(data => { | ||||||
if (options['configure-fb-bot']) { | ||||||
let token, pageAccessToken; | ||||||
let token, pageAccessToken, pageID; | ||||||
|
||||||
return Promise.resolve().then(() => { | ||||||
if (data.variables && data.variables.facebookVerifyToken) | ||||||
|
@@ -69,13 +69,14 @@ module.exports = function fbSetup(api, bot, logError, optionalParser, optionalRe | |||||
console.log(`\n\n${color.green}Facebook Messenger setup${color.reset}\n`); | ||||||
console.log(`\nFollowing info is required for the setup, for more info check the documentation.\n`); | ||||||
console.log(`\nYour webhook URL is: ${color.cyan}${lambdaDetails.apiUrl}/facebook${color.reset}\n`); | ||||||
console.log(`Your verify token is: ${color.cyan}${token}${color.reset}\n`); | ||||||
console.log(` fda Your verify token is: ${color.cyan}${token}${color.reset}\n`); | ||||||
|
||||||
return prompt(['Facebook page access token', 'Facebook App Secret']); | ||||||
return prompt(['Facebook page access token', 'Facebook App Secret', 'Facebook Page ID']); | ||||||
}) | ||||||
.then(results => { | ||||||
console.log('\n'); | ||||||
pageAccessToken = results['Facebook page access token']; | ||||||
pageID = results['Facebook Page ID']; | ||||||
const deployment = { | ||||||
restApiId: lambdaDetails.apiId, | ||||||
stageName: lambdaDetails.alias, | ||||||
|
@@ -84,13 +85,12 @@ module.exports = function fbSetup(api, bot, logError, optionalParser, optionalRe | |||||
facebookAppSecret: results['Facebook App Secret'] | ||||||
} | ||||||
}; | ||||||
|
||||||
if (!data.variables || (!data.variables.facebookAppSecret && !results['Facebook App Secret'])) | ||||||
console.log(`\n${color.yellow}Deprecation warning:${color.reset} your bot is not using facebook validation. Please re-run with --configure-fb-bot to set it. This will become mandatory in the next major version. See https://github.com/claudiajs/claudia-bot-builder/blob/master/docs/API.md#message-verification for more information.\n`); | ||||||
|
||||||
return utils.apiGatewayPromise.createDeploymentPromise(deployment); | ||||||
}) | ||||||
.then(() => rp.post(`https://graph.facebook.com/v2.6/me/subscribed_apps?access_token=${pageAccessToken}`)); | ||||||
.then(() => rp.post(`https://graph.facebook.com/v3.2/${pageID}/subscribed_apps?subscribed_fields=['messages']&access_token=${pageAccessToken}`)); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any other values for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe there is a messages received value that users might be interested in? In case they are creating logs as to how many people click on their messages. The first answer here has all of them: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
}); | ||||||
}) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
fda
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought I deleted this in the second commit. Just a typo! That shouldn't be there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this - done!