User guide - Publish post to Facebook

A stepwise build to a Facebook publishing workflow

🚧

WIP

this page is a work in progress

First, let's begin with the Creating a Facebook post - API documentation

Part 1 - make a text post to your Facebook page

The input we need for the below steps:

{
	"page_id":"<FB-page-ID>",
  "page_access_token":"<FB-page-access-token>",
  "post_caption":"<text to go on the post as caption>"
}

Workflow of these 3 steps:

{
                'name': 'create-facebook-post',
                'scope': 'global',
                "flow":{
                    {
                        "apispec": {
                            "url": "https://graph.facebook.com/v12.0/{{INPUT.page_id}}/feed?message={{"
                                   "INPUT.post_caption}}&access_token={{INPUT.page_access_token}}",
                            "method": "post"
                        },
                        "name": "make_an_unpublished_post"
                    },
                    {
                        "apispec": {
                            "url": "https://graph.facebook.com/v12.0/{{STEPS.make_an_unpublished_post.id}}?&access_token={{INPUT.page_access_token}}&message={{INPUT.post_caption}}",
                            "method": "post"
                        },
                        "name": "publish_post_to_fb_page"
                    }

                ],
                "default_retry": {
                    "total": 4,
                    "connect": 3,
                    "read": 3,
                    "redirect": 3,
                    "status": 3,
                    "other": 0,
                    "allowed_methods": [
                        "GET",
                        "PUT",
                        "POST"
                    ],
                    "status_forcelist": [
                        413,
                        429,
                        503
                    ],
                    "backoff_factor": 1,
                    "raise_on_redirect": True,
                    "respect_retry_after_header": True,
                    "raise_on_status": True
                }
            }
        }

Part 2 - make an image post with text to your Facebook page

The input would now include a creative-url

{
	"page_id":"<FB-page-ID>",
  "page_access_token":"<FB-page-access-token>",
  "creative_url":"<image-url>",
  "post_caption":"<text to go on the post as caption>"
}

Now let's upload this image, make an unpublish post and then publish it.

{
                'name': 'create-facebook-post',
                'scope': 'global',
                "flow": [
                    {
                        "concurrency": 2,
                        "apispec": {
                            "url": "https://graph.facebook.com/{{INPUT.page_id}}/photos",
                            "method": "post",
                            "data": "url={{INPUT.image_url}}&published=false&access_token={{INPUT.page_access_token}}",
                            "headers": {
                                "content_type": "application/x-www-form-urlencoded"
                            }
                        },
                        "name": "fb_page_photo_upload"
                    },
                    {
                        "apispec": {
                            "url": "https://graph.facebook.com/v12.0/{{INPUT.page_id}}/feed?message={{"
                                   "INPUT.post_caption}}&access_token={{INPUT.page_access_token}}",
                            "method": "post"
                        },
                        "name": "make_an_unpublished_post"
                    },
                    {
                        "apispec": {
                            "url": "https://graph.facebook.com/v12.0/{{STEPS.make_an_unpublished_post.id}}?attachment_string=attached_media[0]={'media_fbid':'{{STEPS.fb_page_photo_upload.id}}}'&access_token={{INPUT.page_access_token}}&message={{INPUT.post_caption}}",
                            "method": "post"
                        },
                        "name": "publish_post_to_fb_page"
                    }

                ],
                "default_retry": {
                    "total": 4,
                    "connect": 3,
                    "read": 3,
                    "redirect": 3,
                    "status": 3,
                    "other": 0,
                    "allowed_methods": [
                        "GET",
                        "PUT",
                        "POST"
                    ],
                    "status_forcelist": [
                        413,
                        429,
                        503
                    ],
                    "backoff_factor": 1,
                    "raise_on_redirect": True,
                    "respect_retry_after_header": True,
                    "raise_on_status": True
                }
            }
        }