Professional Documents
Culture Documents
The Facebook Marketing API is a powerful tool that can help businesses of
all sizes reach their target audiences more effectively. By integrating the API
into your app, you can Create and Manage Ads, Target your ads, Track your
results. the Facebook Marketing API is a valuable tool that can help
businesses to grow their reach and increase their ROI. If you are looking for
a way to improve your marketing efforts, I encourage you to explore the API
from — Meta Marketing API (facebook.com). It is a powerful tool that can
help you to reach your target audiences more effectively, track the results of
your campaigns, and optimize your campaigns for better results.
Before starting with Meta Marketing API, I would highly recommend you go
through this article to publish any post to Facebook (Meta) Page-
So, now you have an business app created in your developer account with
Facebook (Meta). Now go to left section of your App Dashboard page. Click
Add Products and choose Marketing Api and click on Set up.
After this, Marketing API would appear on the left section under Products.
Click on that to expand and show the options. From that, click on tools. Now
you would see something like this -
App Dashboard
From ‘Get Access Token’ section, click on ‘Get Token’ to get access token and
keep note of it in somewhere safely. We will use this token while calling
marketing api.
Now the setup to call Marketing API is complete. But before jumping into
showing the calling steps, I will tell you about Facebook (Meta) Ad Campaign
structure.
Campaign
These objects contain your advertising objective and one or more ad sets. This helps
you optimize and measure results for each advertising objective.
Ad Sets
Ad sets have one or more ads. You define budget and schedule for each ad set.
Create an ad set for each target audience with your bid; ads in the set target the
same audience with the same bid. This helps control the amount you spend on each
audience, determine when the audience will see your ads, and provides metrics for
each audience.
Ads
Contains ad creative. Create multiple ads in each ad set to optimize ad delivery
based different images, links, video, text, or placements.
Ad creatives
Contain just the visual elements of the ad and you can’t change them once they’re
created. Each ad account has a creative library to store creatives for reuse in ads.
Note: A lot of customization is possible by calling these same api with different
purpose and expecting different outcome. But to keep it simple, I have avoided
Open those
in app steps and tried to keep it minimalistic. Sign up Sign in
Search Write
Note: It is mandatory to add a payment method to complete the last step i.e. create
ad.
Read here to know more about different parameters you can pass to create
your ad set — https://developers.facebook.com/docs/marketing-
api/reference/ad-campaign/
{
"page_id":"114132124974698",
"link_data":{
"image_hash":"9935dd57c2ce958f98c5d17035603b2f",
"link":"https://facebook.com/114132124974698",
"message":"Try it out"
}
}
Step 5: Create Ad
At last, you simply have to the following endpoint with adset_id and
creative_id received from earlier steps and Bam! your ad is created.
Create Ad
To check, you can navigate to Ad Manager of Facebook and under the section
of campaigns, you would find the campaign, ad set and ad which you have
just created by calling API.
While creating Facebook ads through calling marketing API, you can face
different kind of error messages. Most of them occurs due to mismatch of
objective in campaign and ad set or sometimes it happens that you are not
sending one parameter with the API call which is expected.
So, feel free to reach out to me in case you require any kind of consultation
according to your needs.
Follow me on Medium.
24 Followers
Software Engineer 2 at Lexmark (India), Passionate about Technology, Startup and Love to
travel
4 min read · May 27, 2023 2 min read · May 19, 2023
8 23 1
Sayantan Sarkar Sayantan Sarkar
9 1 4 1
7K 93
Lists
5 min read · Dec 31, 2023 4 min read · Aug 30, 2023
37K 972 6
3 187