#facebook #bot #bot-api

rmessenger

A Rust Wrapper for the FaceBook Messenger Bot API

4 releases

Uses old Rust 2015

0.0.4 Oct 4, 2016
0.0.3 Sep 29, 2016
0.0.2 Sep 29, 2016
0.0.1 Sep 29, 2016

#47 in #facebook

MIT license

7KB
127 lines

rmessenger

MIT License

##A Rust Wrapper for the FaceBook Messenger Bot API Facebook's Messenger Platform
crates.io: rmessenger

###About you can:

  • send text message
  • send generic message
  • send button message
  • send file url
  • send audio url

###Installation

####Cargo.toml

rmessenger = "0.0.3"

###Usage

####Send text message https://developers.facebook.com/docs/messenger-platform/send-api-reference/text-message

extern crate rmessenger;
use rmessenger::bot;

fn main() {
    let bot = bot::Bot::new("<YOUR ACCESS TOKEN>", "<YOUR APP SECRET>");
    bot.send_text_message("<recipient_id>", "<message>");
}

####Send generic message

extern crate rmessenger;
use rmessenger::bot;

fn main() {
    let bot = bot::Bot::new("<YOUR ACCESS TOKEN>", "<YOUR APP SECRET>");
    bot.send_generic_message("<recipient_id>>",
                             "[{'title': 'example',
                                'image_url': 'https://petersfancybrownhats.com/company_image.png'
                                }]");
}

elements param is &str

###TODO

  • send image
  • send file
  • send audio
  • send video

Dependencies

~6MB
~124K SLoC