Are you looking for how to auto publish post in Facebook Page-using Graph API? You can get all the instruction on how to auto-publish posts on the Facebook page – using Graph API by reading this blog. The Expertise of Data Matric help you to publish auto-posts on your Facebook Page.
What are we going to achieve ?
Suppose, you have a Facebook page. But you don’t have enough time to publish thousands of posts. You want auto post in Facebook page? Yes, you can automate the process completely. A software system or bot will be posting frequently on your behalf. You just need to set which contents (Text, Image, Video etc.) you want to post automatically.
- You can set the interval between postings. You can post something every hour, every 2 hours or every 12 hours etc. Or even every minute, though it’s not a good idea at all.
- Does it cost money ? Not a single penny !
- Anyway I will show you an example. I am giving you a Facebook page link which manage all their posts with the help of Facebook Graph API.

Not only auto posting from predefined content, but also you can query database or scrape web, prepare data and then post in Facebook automatically. That will be more complex, but easy if you are an experienced developer. The marked content in the above emails has been queried from MySQL database, then processed and then posted in Facebook page automatically
Initial setup
- At first, you have to create a Facebook app from Facebook developer console . For your convenience I will give you a YouTube tutorial which shows every step comprehensively.
- After you finish this video I will provide you some code sample that works seamlessly.
API Key
From the above video you have got the API key, please save the API key with proper security. Then we will send a Http POST request to the API URL using CURL. Notice the API URL structure:
$url = "https://graph.facebook.com/$pageId/photos?url=$imagePath&caption=$content&access_token=$accessToken";To call this API, you need the Facebook page ID. Now question is how you can find the page ID ?
How to get / find Facebook page ID ?
- Go to your Facebook page
- Press CTRL + U . This will open page source code.
- Press CTRL + F and write delegate_page_id . Then you will find an object which looks like
"user":{"id":"61550xxxx580","delegate_page_id":"12210xxxx71200696"} Note that searching for delegate_page_id we’ll find multiple match. Search for next match until you find an object like this. For your convenience I am also attaching a screenshot :

Auto posting code
Now read the code with attention:
<?php /** * Post to Facebook Page using Graph API. * *@paramstring $pageId The ID of the Facebook page to post to. *@paramstring $accessToken The access token with the necessary permissions. *@paramstring $content The message or caption to post. *@paramstring $imagePath The URL of the image to post (optional). * *@returnmixed The API response as a JSON-decoded object or array. */ functionpostToFacebookPage($pageId, $accessToken, $content, $imagePath=null){ // Encode content as URL-safe string $content=urlencode($content); // Determine the endpoint and payload if ($imagePath) { // If an image path is provided, post as a photo $url="https://graph.facebook.com/$pageId/photos?url=$imagePath&caption=$content&access_token=$accessToken"; }else { // Otherwise, post as a regular feed message $url="https://graph.facebook.com/$pageId/feed?message=$content&access_token=$accessToken"; } // Initialize cURL session $ch=curl_init(); // Set cURL options curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_POST,true); // Execute cURL session and capture the response $response=curl_exec($ch); // Check for cURL errors if (curl_errno($ch)) { thrownewException('cURL Error:'.curl_error($ch)); } // Close cURL session curl_close($ch); // Decode JSON response and return it returnjson_decode($response,true); } This will publish a post in Facebook on behalf of the user who allowed permission while generating API.
Here we have demonstrated using PHP language. But notice that we used CURL which can be used with any language like Python, Javascript, Java, C# (.Net), Go, Rust, Ruby etc. Just use the CURL library of your favorite language. Then you can auto post in Facebook page with in language .
Publish post every hour
Now if you want to auto post in Facebook page like this every hour or particular period of time, you can simply use cron job. But mind that every API has a rate limit. Do not cross that limit least you should be imposed restriction from Facebook.
If you face any problem feel free to comment .
Practical example
I publish all the blog posts of mindila.xyz/blog using Facebook auto-publish mechanism.
Business solution
If you need business solution regarding Facebook page, groups etc. and graph API, you can contact our company email.

Thank you. Helped me a lot. Got some proper guideline after hours of searching google
How to do the same thing using Python language ?
Please sir answer. It will be a great help . Thank you.