Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Creating a multi-platform bot v4 #1912

Closed
ricagurgel opened this issue Feb 9, 2020 · 5 comments
Closed

Creating a multi-platform bot v4 #1912

ricagurgel opened this issue Feb 9, 2020 · 5 comments

Comments

@ricagurgel
Copy link

I'm trying to create a multi-bot using web & facebook

it's seems impossible to configure two simultaneous adapters as example, and it's understandable, of course I cant create a second socket using a same port... But anyone knows the right way to do that? Any doc about it?

const fbadapter = new FacebookAdapter({
enable_incomplete: true,
verify_token: process.env.FACEBOOK_VERIFY_TOKEN,
access_token: process.env.FACEBOOK_ACCESS_TOKEN,
app_secret: process.env.FACEBOOK_APP_SECRET,
})

fbadapter.use(new FacebookEventTypeMiddleware());

const fbcontroller = new Botkit({
webhook_uri: '/api/messages',
adapter: fbadapter,
storage
});

controller.ready(() => {
controller.loadModules(__dirname + '/features');
});


Error:

events.js:187
throw er; // Unhandled 'error' event
^

Error: listen EADDRINUSE: address already in use :::5000
at Server.setupListenHandle [as _listen2] (net.js:1306:14)
at listenInCluster (net.js:1354:12)
at Server.listen (net.js:1442:7)
at new Botkit (/Users/ricagurgel/GitHub/botkit4/web/node_modules/botkit/lib/core.js:146:27)
at Object. (/Users/ricagurgel/GitHub/botkit4/web/bot.js:30:22)
at Module._compile (internal/modules/cjs/loader.js:1121:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
at Module.load (internal/modules/cjs/loader.js:976:32)
at Function.Module._load (internal/modules/cjs/loader.js:884:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:67:12)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1333:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'EADDRINUSE',
errno: -48,
syscall: 'listen',
address: '::',
port: 5000
}
npm

@ricagurgel ricagurgel changed the title Creating a multi-bot issue Creating a multi-platform bot v4 Feb 10, 2020
@maxmeinberg
Copy link

Same here. It seems that v4 does not support multiple platforms.

@benbrown
Copy link
Contributor

benbrown commented Mar 3, 2020

Yes it does!

You can create 2 web endpoints on the same Express webserver, and pass in different adapters to each.

This requires either setting up your own Express, or extending controller.webserver (which is an Express instance)

@benbrown
Copy link
Contributor

benbrown commented Mar 3, 2020

Duplicate of #1910

@benbrown benbrown marked this as a duplicate of #1910 Mar 3, 2020
@benbrown
Copy link
Contributor

benbrown commented Mar 3, 2020

Alright yall, here is an example:

https://github.com/howdyai/botkit/blob/master/packages/testbot/multiadapter.js

@benbrown
Copy link
Contributor

Improvements to this will also be in the next release -> #1929

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants