Facebook page creation

16 views Asked by At

I need nodejs code to create post request to make a fb page from url. Must code has error and I cant find it. The error message is Request failed with status code 400. I dont include the accessToken string but it's existed in my real code.

import axios from "axios";
var form = {
      name: "George The Great",
      category: "1201",
      category_enum: "SONG"
    };

    var options = {
      url: `https://graph.facebook.com/v12.0/me/accounts?access_token=${accessToken}`,
      method: 'post',
      data: form,
      headers: {
        'content-type': 'application/json',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36',
      }
    }

axios.request(options).then(async(response) => {console.log(response.data) }).catch((error) => {console.error(error) });

The error message is Request failed with status code 400.

0

There are 0 answers