Skip to content

VNBot-Developers/quick-api-messenger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QUICK API MESSENGER

Tự build chon bạn api gửi tin nhắn facebook một cách nhanh chóng .

INSTALL

  • Cài đặt môi trường node js cho server của bạn :
  • Cài đặt package:
npm install --save quick-api-messenger
  • Run code
const api = require('../index');
api({
    email: "EMAIL",
    password: "PASS"
}, { /*
 //nếu sài webhook thì thêm
 webhook: 'http://localhost/trywebhook/' 
 */ });

CHẠY THÔI

PORT=1234 node server.js

Trong đó 1234 là port bạn muốn server listen.

Nếu login bị lỗi vui lòng tắt xác thực và accept login trên facebook.

HOW TO USE

Sau khi build thành công api sẽ lắng nghe request ở PORT bạn đặt.

GỬI TIN NHẮN

url: http://www.domain.com/sendMessage/?body=<nội dung>&target<ID người nhận>&attachment=<url ảnh hoặc âm thanh>&type<audio||image>

LISTEN WEBHOOK

Cấu hình url webhook như sau

const api = require('../index');
api({ email: "EMAIL", password: "PASS" }, { webhook: 'http://localhost/routerWebhook/' });

Server webhook demo (NODEJS);

const app = require('express')();
const bodyParser = require('body-parser');
const urlencodeParser = bodyParser.urlencoded({ extended: false })
const { PORT = 80 } = process.env;
app.listen(PORT, () => console.log('Listen in port', PORT));
app.post('/trywebhook', urlencodeParser, function (req, res) {
    console.log(req.body);
    res.end();
});

Thanks for used

Contributors

Trần ĐứcÝ
Trần Đức Cường (notekunn)

About

Simple api to send message and webhook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published