fb_poster 0.1.4

An unofficial Rust API client for Facebook post uploads.
Documentation

An unofficial Rust API client for Facebook post uploads.

⚙️ Requirements

  • Create a Fecebook app on Developer Page

  • Your Facebook app must be in Live mode to make your posts visible for others.

  • Take ACCESS_TOKEN from Graph API Explorer. You can get 2 months token by pressing info "i" icon _

  • Add the desired permissions to allow your app to make posts.

    • pages_manage_engagement
    • pages_manage_posts
    • pages_read_engagement
    • pages_read_user_engagement
    • publish_video permission, if you want to publish a video
  • Take PAGE_ID from page that you planning to do post.

  • More useful information you can find in Offical Facebook API Documentation Current version v19.0

🗣️ Usage

Post

use fb_poster::*;
use anyhow::{Ok, Result};

const ACCESS_TOKEN: &str = "YOUR_ACCESS_TOKEN";
const PAGE_ID: &str = "YOUR_PAGE_ID";


#[tokio::main]
async fn main() -> Result<()> {
    // Bring your secrets into a scope
    let secrets = Secrets::new(ACCESS_TOKEN, PAGE_ID);

    // Build a body for a request
    let message = "Your message".to_string();
    let your_link = "www.internet.net".to_string(); // You can left this field as None,
    let body = Post::new(&secrets, Some(message), Some(your_link)); // if you don't want upload a link

    // Sending and get repsonse
    body.send(&secrets).await?;

    Ok(())
}

Photo

use fb_poster::*;
use anyhow::{Ok, Result};

const ACCESS_TOKEN: &str = "YOUR_ACCESS_TOKEN";
const PAGE_ID: &str = "YOUR_PAGE_ID";


#[tokio::main]
async fn main() -> Result<()> {
    // Bring your secrets into a scope
    let secrets = Secrets::new(ACCESS_TOKEN, PAGE_ID);

    // Build a body for a request
    let path = "/path/to/photo.png".to_string();
    let body = Video::new(&secrets, path);

    // Sending and get repsonse
    body.send(&secrets).await?;

    Ok(())
}

✅ Features

  • Post
  • Photo
  • Video
  • Live Video