question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to communicate with different pages with the same app

See original GitHub issue

I want to make generic bot the can communicate with different pages knowing from which page the message received and response to the user in that specific page.

For knowing which page I think It can be done easily from the recipient attribute like this

bot.on('message', (payload, chat) => {
switch(payload.recipient) {
  case '12334784': //page id
    // do something
    break;
  case '9877654': //page id
    // do something
    break;
}
});

But in the first place BootBot accept only one page access token

const bot = new BootBot({
  accessToken: 'PAGE_ACCESS_TOKEN',
  verifyToken: 'FB_VERIFY_TOKEN',
  appSecret: 'FB_APP_SECRET'
});

What is the best way to accomplish such thing? How to accept messages from different pages?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
temryshcommented, May 28, 2017

Would it be easier if we refactor code to make possible to pass the ‘route’ param to each Bot instance? Alike:

const bot = new BootBot({
  accessToken: 'PAGE_ACCESS_TOKEN',
  verifyToken: 'FB_VERIFY_TOKEN',
  appSecret: 'FB_APP_SECRET',
  webhook: '/webhook'
});

So each instance could listen their own route for webhooks.

1reaction
mraaroncruzcommented, Nov 25, 2017

@tmwd’s suggestion was implemented in #53 and there is an open PR for my suggestion above. I will close this now. Maybe someday we will have page routing but I don’t see it in the near future. Please open an issue specific to page routing if you still think it is a needed feature @MMayla. Cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Ways to Communicate Across Browser Tabs in Realtime
1. Local Storage Events ... You might have already used LocalStorage, which is accessible across Tabs within the same application origin. But do ......
Read more >
How to Combine All of Your Messaging Apps in One Place
Each time, you have to open the separate app to look at your message. By having everything in one place, just clicking on...
Read more >
How to communicate between multiple windows of the same ...
I've looked at the messaging samples, and they seem focused on communication between two different apps, or between an app and an extension....
Read more >
How to communicate Between two lightning pages(AURA)
Your Answer · Asking for help, clarification, or responding to other answers. · Making statements based on opinion; back them up with references ......
Read more >
Collaborate on documents in Pages, Numbers, and Keynote ...
Click or tap Show All Activity to see who's worked on the document and a summary of the changes they've made. Click or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found