Package: facebook-feed-sync
facebook_feed_syncUpdate a google sheet with data from the Plentymarkets API for a Facebook catalog feed.Installation:Prepare the folder structure and get google sheet API accessPlace the credentials file from :Google Sheet APIas'credentials.json'(example: mv ~/Downloads/credentials.json /home/$USER/.config/gspread/credentials.json) into the config folder forgspread.Place theconfig.inifile into thefacebook_feed_syncconfig folderLinux: /home/$USER/.config/facebook_feed_sync/config.iniWindows: C:\\$USER\.config\facebook_feed_sync\config.iniHere is an example for the config file:[General]google_sheet_id=plenty_api_url=lang=[Mapping]facebook_referrer=image_match_criteria=item_name_number=gender_item_property=age_item_property=google_product_category_item_property=material_variation_property=url_variation_property=sales_price_id=color_attribute_id=size_attribute_id=main_warehouse=Get the ID of the target marketplace or Create a new marketplace availability:{plenty-cloud-domain}/plenty/terra/system/orders/referreractivate it and add the ID to the configuration.Set the marketplace availability for every variation you want to present on facebook.Create new variation or item properties(characteristics) for these fields or link existing properties:Item properties (characteristics){plenty-cloud-domain}/plenty/terra/system/item/charactergender_item_property[facebook:gender] (target audience gender: 'Men', 'Women', 'Unisex')age_item_property[facebook:age_group] (target audience age group: 'Adult' or 'Child')google_product_category_item_property[facebook:google_product_category] (Text value of your google product category, see:list)Variation properties{plenty-cloud-domain}/plenty/terra/system/settings/properties/configuration/overviewmaterial_variation_property[facebook:material] (material type of the product e.g. Cotton, Hemp etc.)url_variation_property[facebook:link] (Link to your webshop)Choose the criteria by which valid pictures are chosen for each variation, the picture with the lowest position of the images found is used for Facebook.Example values:image_match_criteria=mandant;12345,image_match_criteria=marketplace;4.01.Add the IDs of the properties to the matching configuration entryAssign the facebook market availability to on of your prices:{plenty-cloud-domain}/plenty/terra/system/item/sales-priceand make sure that all variations contain a price. Then add the ID of the price to the configuration field:sales_price_idChoose one of the three possible item names:name1,name2orname3and add the number of the name to the configuration field:item_name_numberAssign the IDs of your color and size attribute to the configuration fields:color_attribute_idandsize_attribute_idAssign the ID of the warehouse used for shipping to the configuration field:main_warehouseFill the properties with values and then add the IDs of the properties to the configurationCreate a google sheet and add the following header to it:id,title,description,availability,inventory,condition,price,link,image_link,brand,google_product_category,sale_price,sale_price_effective_date,item_group_id,gender,color,size,age_group,material,pattern,product_type,shipping,shipping_weightInsert the text then select the field and go toData->Split text into columnsGet your Google Sheet ID:Example URL:https://docs.google.com/spreadsheets/d/{SHEET ID}/edit?pli=1#gid=0Insert it into the configuration.Make an initial setup of the sheet with:python3 -m facebook_feed_sync -t allCheck if the google sheet looks good and go onShareat the top right and change access rights to anyone with the linkGo to your business manager (catalogs)https://business.facebook.com/products/catalogs/, create a new datafeed: Catalog -> data-feeds -> Add products -> Use bulk upload -> Google Spreadsheets -> Next -> Insert the full link -> Choose the upload schedule.Setup the cronjob to run the script preferably on a device, which has a constant uptime (I use a raspberry Pi for example),Noticecronjobs don't go well with the Keyring authentication, so please provide the credentials within the configuration like this:Write the PlentyMarkets REST-API password into an empty fileencrypt itgpg --output test_file.gpg --encrypt --recipient {YOUR_GPG_RECIPIENT} test_file.txtAdd the PlentyMarkets REST-API username to the config under the section[Credentials]as optionuserAdd the path to the GnuPG encrypted file to the config under the section[Credentials]as optionpw_file