Creating Product Sets on Facebook using Graph API or Javascript SDK

71 views Asked by At

I am trying to create product sets from an existing catalogue on facebook. I was able to use nodejs-facebook-business-sdk well so far to fetch the catalogueID, the product ids and other fields from facebook. I wanted to move a step forward but keep failing on the nodejs-facebook-business-sdk.

This is the nodejs-facebook-business-sdk code:

const api = bizSdk.FacebookAdsApi.init(accessToken);
const business = new bizSdk.Business(businessId);
const catalogs = await new Business(businessId).getOwnedProductCatalogs();
const catalogId = catalogs[0].id;
//works well upto this point and fails below this point
const productSet = await new ProductCatalog(catalogId).createProductSet(
{},
{[ProductSet.Fields.name]: set_id}
);

Hence, I decided to try out the GraphAPI and then use that URL to insert my data into a POST URL. I am however now stuck again because I am using the below JSON-encoded URL for the fields: filter%3D%7B%22product_item_id%22%3A%7B%22eq%22%3A%5B%22prod_id1%22%2C%22prod_id2%22%5D%7D%7D

In doing this I am getting this error below:

{
  "error": {
    "message": "Product set with the same filters already exists",
    "type": "OAuthException",
    "code": 10803,
    "error_data": {
      "product_set_id": "398669932127803"
    },
    "error_subcode": 1798073,
    "is_transient": false,
    "error_user_title": "Duplicate product set already exists",
    "error_user_msg": "Error when you try to create a product set when a product set with a duplicate filter already exists",
    "fbtrace_id": "App-C-nBvtS4szCeo6dSS8_"
  }
}

Searching for these error codes yields nothing. I tried reporting a bug but they want me to post on their community platform. Trying to post there also fails because apparently my post doesnt meet their guidelines for posting.

0

There are 0 answers