Skip to content
This repository was archived by the owner on Dec 26, 2021. It is now read-only.
This repository was archived by the owner on Dec 26, 2021. It is now read-only.

cannot reproduce xxxplatform example with slack and messenger #32

Description

@glare1062

The connections work individually
but dont mesh together like in the example
and i used a Ngrok server to test

  • so when i tried Messenger alone i get a response
  • but when i combine them like in the example i only get slacks object output
  • and messenger gives me an error

please advice cuz im quite new to node and angular
My Code :

const` Rx = `require("rxjs/Rx");
const R = require("ramda");


const BroidSlack = require("@broid/slack");
const BroidMessenger = require("@broid/messenger");
const FACEBOOK_ACCESS_TK = "EAACyaH0LpzJVuqJz4sBMZCyqpxZBKxvsz7MiLPcHGMKXZAotQsyCJN16VBLJ7rFv1ykdR2urZCmoRgNvjmRLWbHcsAR59KpcC7c3oEZBVEEpJgjT2I07BbPwb2xxpMzEWYEJik3B2R7fhJNCc4jmg3ZAb4N102yCO5ksZCkAZCQ1VIhZBeDq7ZACW4ZD" ;
const VERIFY_TK = "broidtestbot" ;
const clients = {

  messenger: new BroidMessenger({token: FACEBOOK_ACCESS_TK ,
  tokenSecret:VERIFY_TK ,
    http: {
    host: '0.0.0.0',
    port: 5000
  }}),  
  slack: new BroidSlack({token: 'xoxb-389-387469850096-Iz6XwU4u7io4dt8XhdwTkiSR',
    http: {
    host: '127.0.0.1',
    port: 5000
  }}),
 
};
console.log('point 2 rite before the merge calling');
Rx.Observable.merge(...R.map(client => client.connect(), R.values(clients)))

Rx.Observable.merge(...R.map(client => client.listen(), R.values(clients)))

.subscribe({
  next: data => console.log(JSON.stringify(data, 1, 3)),
  error: err => console.error(err),
});`

Error (only occurs when i try to send something from messenger) :

SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at MergeMapSubscriber.parseWebHookEvent [as project] (D:\Testing\testbroidfbandslack\node_modules\@broid\slack\lib\core\helpers.js:69:26) at MergeMapSubscriber._tryNext (D:\Testing\testbroidfbandslack\node_modules\@broid\slack\node_modules\rxjs\operators\mergeMap.js:122:27) at MergeMapSubscriber._next (D:\Testing\testbroidfbandslack\node_modules\@broid\slack\node_modules\rxjs\operators\mergeMap.js:112:18) at MergeMapSubscriber.Subscriber.next (D:\Testing\testbroidfbandslack\node_modules\@broid\slack\node_modules\rxjs\Subscriber.js:93:18) at EventEmitter.handler (D:\Testing\testbroidfbandslack\node_modules\@broid\slack\node_modules\rxjs\observable\FromEventObservable.js:210:46) at emitOne (events.js:116:13) at EventEmitter.emit (events.js:211:7) at router.post (D:\Testing\testbroidfbandslack\node_modules\@broid\slack\lib\core\Adapter.js:312:26) at Layer.handle [as handle_request] (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\layer.js:95:5) at next (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\route.js:137:13) at Route.dispatch (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\layer.js:95:5) at D:\Testing\testbroidfbandslack\node_modules\express\lib\router\index.js:281:22 at Function.process_params (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\index.js:335:12) at next (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\index.js:275:10) at Function.handle (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\index.js:174:3) at router (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\index.js:47:12) at Layer.handle [as handle_request] (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\layer.js:95:5) at trim_prefix (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\index.js:317:13) at D:\Testing\testbroidfbandslack\node_modules\express\lib\router\index.js:284:7 at Function.process_params (D:\Testing\testbroidfbandslack\node_modules\express\lib\router\index.js:335:12)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions