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.

can't reproduce examples #21

Description

@casanovarodrigo

Hello. I didn't know where to ask this, sorry if this isn't the place for it.

I'm trying to reproduce the examples on the readme file, but despite my efforts, I cant. I first created an app on heroku, then created a simple bot directly using methods that fb gives in its documentation. Now i'm trying to make broid-kit work but looks like i'm missing something.

index.js on heroku

const Bot = require("@broid/kit");
const BroidMessenger = require("@broid/messenger");

const token = process.env.FB_PAGE_ACCESS_TOKEN
const vtoken = process.env.FB_VERIFY_ACCESS_TOKEN

const express = require('express')
const app = express()

const bot = new Bot({
  logLevel: "info"
});

bot.use(new BroidMessenger({token: token, tokenSecret: vtoken}));

app.use("/", bot.getRouter());

app.listen(process.env.PORT || 5000);

// Listening for public starting by regex match for `hello`
bot.hear(".*", "Group")
  .subscribe((data) => {
    console.log("Data:", JSON.stringify(data, null, 2));

    // Reply to the message
    bot.sendText("Hi, How are you?", data.message);
  });

This should return a message at every message sent, right?

Activity

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions