Currently, the SDK assumes that the bot will only be deployed on one page. But Facebook lets you associate a bot with multiple pages. This PR adds the plumbing necessary so calls that depend on the page now take pageId as an argument. The SDK constructor has a new option for page ids because it needs to know how to turn a page id into an access token. For now, the new pageId is optional as long as the user still has the existing page id and page access token config set.
getPublicProfile can work for multiple pages
send can work for multiple pages
configuration is split better between config needed bot config for listening (app) and config for responding (page).
Closes #30
Did you document your work?
It turns out a lot of the API wasn't really documented, so this adds documentation using the current format with warnings about future pageId changes
How can someone test these changes?
Steps to manually verify the change:
npm i
npm t
Link to an existing bot and make sure your existing bot works:
npm link
go to your bot
npm link launch-vehicle-fbm
run and test your bot
What possible risks or adverse effects are there?
The way the page config is possibly up in the air. Right now it's a simple mapping of page ids to access tokens, but maybe we'll want it to be richer in the future. Since I can't think of a use case, I think it's fine to go with the simple solution and make another breaking change later.
Why are we doing this?
Currently, the SDK assumes that the bot will only be deployed on one page. But Facebook lets you associate a bot with multiple pages. This PR adds the plumbing necessary so calls that depend on the page now take
pageId
as an argument. The SDK constructor has a new option for page ids because it needs to know how to turn a page id into an access token. For now, the newpageId
is optional as long as the user still has the existing page id and page access token config set.Closes #30
Did you document your work?
pageId
changesHow can someone test these changes?
Steps to manually verify the change:
npm i
npm t
Link to an existing bot and make sure your existing bot works:
npm link
npm link launch-vehicle-fbm
What possible risks or adverse effects are there?
What are the follow-up tasks?
Are there any known issues?
none
Did the test coverage decrease?
increases. Some previously uncovered code is now covered. Most of the new LOC is tests, then backwards compatibility that can be deleted later.