@rimiti/facebook-automation

Post on facebook

Usage no npm install needed!

<script type="module">
  import rimitiFacebookAutomation from 'https://cdn.skypack.dev/@rimiti/facebook-automation';
</script>

README

facebook-automation

Dependencies License PRs Welcome

Description

This repository provides a powerful way to post on your Facebook Page without using any API (based on Playwright).

Install

yarn add @rimiti/facebook-automation

Example

import { FacebookAutomation } from '@rimiti/facebook-automation';

const facebookAutomation: FacebookAutomation = new FacebookAutomation({
  credentials: {
    login: 'facebook@dimsolution.com',
    password: '$secr€t',
  },
  pageUrl: 'https://www.facebook.com/my-page-id',
  browserConfiguration: { // Optional
    headless: false, 
    args: ['--no-sandbox']
  } 
});

await facebookAutomation.post({
  text: 'Hello world',
  imagePath: './example.jpg',
});

Default browser configuration

The below default browser configuration can be overridden through browserConfiguration constructor attribute.

{
  headless: true,
  slowMo: 50,
}

Limitation

  • To avoid scrappers (not only), Facebook isn't using "id" elements. It's why some of elements are selected from "text content". Your Facebook account must be in English.

Scripts

Run using yarn run <script> command.

clean       - Remove temporarily folders.
build       - Compile source files.
build:watch - Interactive watch mode, compile sources on change.
lint        - Lint source files.
lint:fix    - Fix lint source files.
test        - Runs all tests with coverage.
test:watch  - Interactive watch mode, runs tests on change.

License

GPL-3.0 © Dimitri DO BAIRRO