v19

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const BatchMaxIDsSequence = 10000

BatchMaxIDsSequence we upload.

View Source
const Version = "v19.0"

Version of the graph API being used.

Variables

View Source
var Adcreativefields = []string{
	"id",
	"account_id",
	"body",
	"call_to_action_type",
	"effective_instagram_story_id",
	"effective_object_story_id",
	"image_hash",
	"image_url",
	"instagram_actor_id",
	"instagram_permalink_url",
	"instagram_story_id",
	"link_og_id",
	"link_url",
	"name",
	"object_id",
	"object_story_id",
	"object_story_spec",
	"object_type",
	"object_url",
	"status",
	"thumbnail_url",
	"title",
	"video_id",
}

Adcreativefields are the fields of an adcreative.

View Source
var AdsetFields = []string{
	"bid_amount", "attribution_spec", "bid_info",
	"billing_event", "campaign_id", "created_time",
	"daily_budget", "destination_type", "effective_status",
	"daily_spend_cap", "daily_min_spend_target", "end_time",
	"creative_sequence", "frequency_control_specs", "id",
	"configured_status", "instagram_actor_id", "lifetime_budget",
	"lifetime_imps", "lifetime_min_spend_target", "lifetime_spend_cap",
	"name", "budget_remaining", "optimization_goal", "adset_schedule",
	"adlabels", "recurring_budget_semantics",
	"rf_prediction_id", "source_adset_id", "start_time", "targeting",
	"time_based_ad_rotation_id_blocks", "time_based_ad_rotation_intervals",
	"pacing_type", "promoted_object", "recommendations",
	"source_adset", "status", "updated_time", "use_new_app_click",
	"campaign{name,objective,effective_status}", "dsa_beneficiary", "dsa_payor",
}

AdsetFields is a selection of fields to be returned.

Functions

This section is empty.

Types

type ActionTypeValue

type ActionTypeValue []struct {
	ActionType       string  `json:"action_type"`
	ActionVideoSound string  `json:"action_video_sound"`
	ActionReaction   string  `json:"action_reaction"`
	Value            float64 `json:"value,string"`

	// For action_attribution_windows
	View1d   float64 `json:"1d_view,string"`
	View7d   float64 `json:"7d_view,string"`
	View28d  float64 `json:"28d_view,string"`
	Click1d  float64 `json:"1d_click,string"`
	Click7d  float64 `json:"7d_click,string"`
	Click28d float64 `json:"28d_click,string"`
}

ActionTypeValue is a kv store.

func (ActionTypeValue) FilterByActionTypePrefix

func (atv ActionTypeValue) FilterByActionTypePrefix(prefix string) ActionTypeValue

FilterByActionTypePrefix returns a slice of ActionTypeValue for which all ActionType values starts with the input prefix.

func (ActionTypeValue) GetCustomConversion

func (atv ActionTypeValue) GetCustomConversion() float64

GetCustomConversion returns the custom conversions of the values with the given action type.

func (ActionTypeValue) GetReactions

func (atv ActionTypeValue) GetReactions() map[string]uint64

GetReactions returns a map with reactions.

func (ActionTypeValue) GetValue

func (atv ActionTypeValue) GetValue(actionType string) float64

GetValue returns the sum of the values with the given action type.

type Ad struct {
	AccountID     string                  `json:"account_id,omitempty"`
	ID            string                  `json:"id,omitempty"`
	Name          string                  `json:"name,omitempty"`
	Status        string                  `json:"status,omitempty"`
	AdsetID       string                  `json:"adset_id,omitempty"`
	Creative      *AdCreative             `json:"creative,omitempty"`
	Adset         *Adset                  `json:"adset,omitempty"`
	TrackingSpecs []ConversionActionQuery `json:"tracking_specs,omitempty"`
	Adcreatives   *struct {
		Data []AdCreative `json:"data,omitempty"`
	} `json:"adcreatives,omitempty"`
}

Ad represents a Facebook Ad.

type AdAccount

type AdAccount struct {
	Name         string `json:"name"`
	AccountID    string `json:"account_id"`
	Currency     string `json:"currency"`
	TimeZoneName string `json:"timezone_name"`
}

AdAccount represents an ad account.

type AdAccountService

type AdAccountService struct {
	// contains filtered or unexported fields
}

AdAccountService works with ad accounts.

func (*AdAccountService) List

func (aas *AdAccountService) List(ctx context.Context, businessID string) ([]AdAccount, error)

List lists all ad accounts that belong to this business.

type AdCreative

type AdCreative struct {
	ID         string `json:"id,omitempty"`
	CreativeID string `json:"creative_id,omitempty"`
	AccountID  string `json:"account_id,omitempty"`
	// PageID
	ActorID string `json:"actor_id,omitempty"`
	// Deep link fallback behavior for dynamic product ads if the app is not installed.
	ApplinkTreatment string `json:"applink_treatment,omitempty"`
	// The body of the ad. Not supported for video post creatives.
	Body string `json:"body,omitempty"`
	// Branded Content sponsor ID, creating ads using existing BC posts
	BrandedContentSponsorPageID string `json:"branded_content_sponsor_page_id,omitempty"`

	CallToActionType string `json:"call_to_action_type,omitempty"`
	// The ID of an Instagram post to use in an ad.
	EffectiveInstagramStoryID string `json:"effective_instagram_story_id,omitempty"`
	// The ID of a page post to use in an ad, regardless of whether it's an organic or unpublished page post.
	EffectiveObjectStoryID string `json:"effective_object_story_id,omitempty"`
	// Image hash for an image you can use in creatives. If provided do not provide image_url. See image library for more details
	ImageHash string `json:"image_hash,omitempty"`
	// A URL for the image for this creative. We save the image at this URL to the ad account's image library. If provided do not include image_hash.
	ImageURL string `json:"image_url,omitempty"`
	// Instagram actor ID
	InstagramActorID string `json:"instagram_actor_id,omitempty"`
	// Instagram permalink
	InstagramPermalinkURL string `json:"instagram_permalink_url,omitempty"`
	// The ID of an Instagram post for creating ads.
	InstagramStoryID string `json:"instagram_story_id,omitempty"`
	// Used for creating video polls
	InteractiveComponentsSpec *InteractiveComponentsSpec `json:"interactive_components_spec,omitempty"`
	// The Open Graph (OG) ID for the link in this creative if the landing page has OG tags
	LinkOgID string `json:"link_og_id,omitempty"`
	// Used to identify a specific landing tab on the Page (e.g. a Page tab app)
	// by the Page tab's URL. See connection objects for retrieving Page tabs' URLs.
	// The likes tab is not supported. app_data parameters may be added to the url to pass data to a tab app
	LinkURL string `json:"link_url,omitempty"`
	// The JSON string of messenger sponsored message for this creative. See (docs/messenger-platform/reference/send-api) for more detail
	MessengerSponsoredMessage string `json:"messenger_sponsored_message,omitempty"`
	// The name of the creative in the creative library.
	Name string `json:"name,omitempty"`
	// The ID of the promoted_object or object that is relevant to the ad and ad type
	ObjectID string `json:"object_id,omitempty"`
	// The ID of a page post to use in an ad. This ID can be retrieved by using
	// the graph API to query the posts of the page. If an image is used in the post,
	// it will be downloaded and available in your account's image library.
	// If you create an unpublished page post inline via object_story_spec at
	// the same time as creating the ad, this ID will be null. However the
	// effective_object_story_id will be the ID of the page post regardless of whether it's an organic or unpublished page post.
	ObjectStoryID string `json:"object_story_id,omitempty"`
	// The type of object that is being advertised.
	// PAGE, DOMAIN, EVENT, STORE_ITEM, SHARE, PHOTO, STATUS, VIDEO, APPLICATION, INVALID
	ObjectType string `json:"object_type,omitempty"`
	// Destination URL for a link ads not connected to a page
	ObjectURL string `json:"object_url,omitempty"`
	// The ID of the product set for this creative. See dynamic product ads for more detail
	ProductSetID string `json:"product_set_id,omitempty"`
	// The status of this creative.
	Status string `json:"status,omitempty"`
	// The Tracking URL for dynamic product ads. See dynamic product ads for more detail
	TemplateURL string `json:"template_url,omitempty"`
	// The URL to a thumbnail for this creative.
	ThumbnailURL string `json:"thumbnail_url,omitempty"`
	// Title for a link ad (not connected to a Page)
	Title string `json:"title,omitempty"`
	// A set of query string parameters which will replace or be appended to urls
	// clicked from page post ads, message of the post, and canvas app install creatives only
	URLTags string `json:"url_tags,omitempty"`
	// The ID of the video in this creative
	VideoID string `json:"video_id,omitempty"`
	// If this is true, we will show the page actor for mobile app ads
	UsePageActorOverride bool `json:"use_page_actor_override,omitempty"`
	// A JSON object defining crop dimensions for the image specified. See image crop reference for more details
	ImageCrops json.RawMessage `json:"image_crops,omitempty"`
	// The page id and the content to create a new unpublished page post specified using one of link_data, photo_data, video_data, text_data or template_data
	ObjectStorySpec *ObjectStorySpec `json:"object_story_spec,omitempty"`
	// Use this field to customize the media for different Facebook placements.
	// Currently you can use this field for customizing images only. The media
	// specified here replaces the original media defined in the ad creative when
	// the ad displays on those placements. For example, if you define a media
	// here for the instagram key, Facebook uses that media instead of the media
	// defined in the ad creative when showing the ad on Instagram.
	PlatformCustomizations json.RawMessage `json:"platform_customizations,omitempty"`
	// The recommender settings that can be used to control recommendations for Dynamic Ads.
	RecommenderSettings json.RawMessage `json:"recommender_settings,omitempty"`
	// Use this field to create url templates for dynamic product ads. See dynamic product ads for more detail
	TemplateURLSpec json.RawMessage `json:"template_url_spec,omitempty"`
	// Ad Labels that are associated with this creative
	Adlabels []json.RawMessage `json:"adlabels,omitempty"`
	// DegreesOfFreedomSpec Specifies the types of transformations that are enabled for the given creative. For more information, see Ad Creative Degrees Of Freedom Spec, Reference.
	DegreesOfFreedomSpec *DegreesOfFreedomSpec `json:"degrees_of_freedom_spec,omitempty"`
}

AdCreative https://developers.facebook.com/docs/marketing-api/reference/ad-creative

func (AdCreative) GetLandingPageURL

func (ac AdCreative) GetLandingPageURL() string

GetLandingPageURL returns the landing page URL of the creative.

type AdCreativeLinkData

type AdCreativeLinkData struct {
	// The index (zero based) of the image from the additional images array to use as the ad image for a dynamic product ad
	AdditionalImageIndex int32 `json:"additional_image_index,omitempty"`
	// Native deeplinks attached to the post
	AppLinkSpec *AdCreativeLinkDataAppLinkSpec `json:"app_link_spec,omitempty"`
	// The style of the attachment
	AttachmentStyle string `json:"attachment_style,omitempty"`
	// The branded content shared to sponsor option
	BrandedContentSharedToSponsorStatus string `json:"branded_content_shared_to_sponsor_status,omitempty"`
	// The branded content sponsor page id
	BrandedContentSponsorPageID string `json:"branded_content_sponsor_page_id,omitempty"`
	// The branded content sponsor relationship option
	BrandedContentSponsorRelationship string `json:"branded_content_sponsor_relationship,omitempty"`
	// An optional call to action button. If not specified, on Instagram, a default CTA would be used, {"type":"LEARN_MORE","value": {"link":<LINK VALUE OF LINK_DATA>,}}. Note that LIKE_PAGE is not supported
	CallToAction *AdCreativeLinkDataCallToAction `json:"call_to_action,omitempty"`
	// Link caption. Overwrites the caption under the title in the link. The caption must be an actual URLs and should accurately reflect the URL and associated advertiser or business someone visits when they click on it. See post for more info. This setting is not used on Instagram
	Caption string `json:"caption,omitempty"`
	// A 2-5 element array of link objects required for carousel ads. If multi_share_optimized is set to true, this array could have up to 10 objects. Facebook will automatically optimize the order in which the carousel cards are shown and display the top 5. We strongly recommend that you use at least 3 attachments for achieving optimal performance; allowing minimum of 2 attachments is for enabling lightweight integrations and using 2 objects might result in sub-optimal campaign results. If this ad creative is used for an Instagram Carousel ad, you will need to have at least 3 attachments for MOBILE_APP_INSTALLS ads and 2 for the other objectives. If more than 5 are given, only the first 5 will be shown on Instagram, even if multi_share_optimized is true.
	ChildAttachments []AdCreativeLinkDataChildAttachment `json:"child_attachments,omitempty"`
	// Customization rules for a dynamic ad
	// CustomizationRulesSpec []AdCustomizationRuleSpec `json:"customization_rules_spec,omitempty"`
	// Link description. Overwrites the description in the link on Facebook. See post for more info. This setting is not used on Instagram
	Description string `json:"description,omitempty"`
	// The id of a Facebook event. This is only to be used if this creative is for a Website Clicks campaign, the Call To Action is Buy Tickets, and the link points to the ticketing website of this Facebook event
	EventID string `json:"event_id,omitempty"`
	// Whether to force the post to render in a single link format
	ForceSingleLink bool `json:"force_single_link,omitempty"`
	// How to the image should be cropped. Different placements use different crop specs. For example, Facebook News Feed uses the crop spec with 191x100 key, and Instagram uses 100x100 crop spec
	// ImageCrops *AdsImageCrops `json:"image_crops,omitempty"`
	// Hash of an image in your image library with Facebook. Specify this field or picture but not both
	ImageHash string `json:"image_hash,omitempty"`
	// How to render image overlays on a dynamic item in Dynamic Ads
	// ImageOverlaySpec *AdCreativeLinkDataImageOverlaySpec `json:"image_overlay_spec,omitempty"`
	// Link url. This url is required to be the same as the CTA link url. See post for more info. This field is required for a carousel ad
	Link string `json:"link,omitempty"`
	// The main body of the post. See post for more info. This field is required for a carousel ad
	Message string `json:"message,omitempty"`
	// If set to false, removes the end card which displays the page icon. Default is true. Used by carousel ads
	MultiShareEndCard bool `json:"multi_share_end_card,omitempty"`
	// If set to true, automatically select and order images and links. Default is true. Used by carousel ads
	MultiShareOptimized bool `json:"multi_share_optimized,omitempty"`
	// Name of the link. Overwrites the title of the link preview. See post for more info
	Name string `json:"name,omitempty"`
	// The id of a Facebook native offer
	OfferID string `json:"offer_id,omitempty"`
	// A welcome text from page to user on Messenger once a user performs send message action on an ad
	PageWelcomeMessage string `json:"page_welcome_message,omitempty"`
	// URL of a picture to use in the post. Specify this field or image_hash but not both. See post for more info. The image specified at the URL will be saved into the ad accounts image library
	Picture string `json:"picture,omitempty"`
	// Customized contents provided by the advertiser for the ad post-click experience
	// PostClickConfiguration AdCreativePostClickConfiguration `json:"post_click_configuration,omitempty"`
	// List of product IDs provided by the advertiser for Collections
	RetailerItemIDs []string `json:"retailer_item_ids,omitempty"`
	// Use with force_single_link = true in order to show a single dynamic item but in carousel format using multiple images from the catalog. See dynamic product ad
	ShowMultipleImages bool `json:"show_multiple_images,omitempty"`
}

AdCreativeLinkData see https://developers.facebook.com/docs/marketing-api/reference/ad-creative-link-data/

type AdCreativeLinkDataAppLinkSpec

type AdCreativeLinkDataAppLinkSpec struct {
	// Native deeplinks to use on Android
	Android []AndroidAppLink `json:"android,omitempty"`
	// Native deeplinks to use on iOS
	Ios []IosAppLink `json:"ios,omitempty"`
	// Native deeplinks to use on iPad
	Ipad []IosAppLink `json:"ipad,omitempty"`
	// Native deeplinks to use on iPhone
	Iphone []IosAppLink `json:"iphone,omitempty"`
}

AdCreativeLinkDataAppLinkSpec see https://developers.facebook.com/docs/marketing-api/reference/ad-creative-link-data-app-link-spec/

type AdCreativeLinkDataCallToAction

type AdCreativeLinkDataCallToAction struct {
	// The type of the action. Not all types can be used for all ads. Check Ads Product Guide to see which type can be used based on the objective of your campaign.
	Type string `json:"type,omitempty"`
	// JSON containing the call to action data.
	Value *AdCreativeLinkDataCallToActionValue `json:"value,omitempty"`
}

AdCreativeLinkDataCallToAction see https://developers.facebook.com/docs/marketing-api/reference/ad-creative-link-data-call-to-action/

type AdCreativeLinkDataCallToActionValue

type AdCreativeLinkDataCallToActionValue struct {
	// The app destination type.
	AppDestination string `json:"app_destination,omitempty"`
	// Deep link to the app.
	AppLink string `json:"app_link,omitempty"`
	// Application related to the action.
	Application string `json:"application,omitempty"`
	// ID of the Facebook event which the attachement show event info
	EventID string `json:"event_id,omitempty"`
	// The Lead Ad form id.
	LeadGenFormID string `json:"lead_gen_form_id,omitempty"`
	// The destination link when the CTA button is clicked. This is required to be same as the link url of the creative.
	Link string `json:"link,omitempty"`
	// Caption shown in the attachment. The caption must be an actual URL and should accurately reflect the URL and associated advertiser or business someone visits when they click on it.
	LinkCaption string `json:"link_caption,omitempty"`
	// Link format of video.
	LinkFormat string `json:"link_format,omitempty"`
	// ID of the Facebook page which the CTA button links to
	Page string `json:"page,omitempty"`
	// Open graph object url for canvas virtual good ads.
	ProductLink string `json:"product_link,omitempty"`
}

AdCreativeLinkDataCallToActionValue see https://developers.facebook.com/docs/marketing-api/reference/ad-creative-link-data-call-to-action-value/

type AdCreativeLinkDataChildAttachment

type AdCreativeLinkDataChildAttachment struct {
	// Call to action of this attachment. On Facebook, we support one optional CTA per attachment. If it not specified, there will be no CTA for this attachment. On Instagram, there is one CTA per attachment. If the CTA is not specified, a CTA will be created by the system, using "Learn more" as the type, and the link from this child attachment as the link. If the CTA is specified, its link must be the same as the link of this child attachment.
	CallToAction *AdCreativeLinkDataCallToAction `json:"call_to_action,omitempty"`
	// The display url shown at the end of a video, if the attachment is a video
	Caption string `json:"caption,omitempty"`
	// Overwrites the description of each attachment on Facebook, not used on Instagram.
	Description string `json:"description,omitempty"`
	// Image crops, using the crop spec with 100x100 key for Carousel ads. If no 100x100 crop spec is provided, the image would be cropped automatically, unless the image is square already. The final cropped image size needs to be at least 200x200 pixels for Facebook, or 600x600 for Instagram.
	// ImageCrops *AdsImageCrops `json:"image_crops,omitempty"`
	// The image hash of an uploaded image for this attachment. For an ad on Facebook, if neither picture nor image_hash is set, the image of link_data above will be used. For an ad on Instagram, either picture or image_hash is required.
	ImageHash string `json:"image_hash,omitempty"`
	// The link of this attachment.
	Link string `json:"link,omitempty"`
	// Overwrites the title of the attachment on Facebook, not used on Instagram.
	Name string `json:"name,omitempty"`
	// The url of an image for this attachment. For an ad on Facebook, if neither picture nor image_hash is set, the image specified in link_data above will be used. For an ad on Instagram, either picture or image_hash is required.
	Picture string `json:"picture,omitempty"`
	// Whether to force the card to render statically, even in a dynamic ad.
	StaticCard bool `json:"static_card,omitempty"`
	// ID of an uploaded video, if this attachment is a video. Not supported for Instagram ads.
	VideoID string `json:"video_id,omitempty"`
}

AdCreativeLinkDataChildAttachment see https://developers.facebook.com/docs/marketing-api/reference/ad-creative-link-data-child-attachment/

type AdCreativeListCall

type AdCreativeListCall struct {
	*fb.RouteBuilder
	// contains filtered or unexported fields
}

func (*AdCreativeListCall) Do

Do calls the graph API.

func (*AdCreativeListCall) ReadList

func (s *AdCreativeListCall) ReadList(ctx context.Context, act string, res chan<- AdCreative) error

ReadList writes all adcreatives from an account to res.

type AdCreativePhotoData

type AdCreativePhotoData struct {
	BrandedContentSharedToSponsorStatus string `json:"branded_content_shared_to_sponsor_status"`
	BrandedContentSponsorPageID         string `json:"branded_content_sponsor_page_id"`
	BrandedContentSponsorRelationship   string `json:"branded_content_sponsor_relationship"`
	Caption                             string `json:"caption"`
	ImageHash                           string `json:"image_hash"`
	PageWelcomeMessage                  string `json:"page_welcome_message"`
	URL                                 string `json:"url"`
}

AdCreativePhotoData is the specific part of a creative that only photo posts do have.

type AdCreativeService

type AdCreativeService struct {
	*fb.StatsContainer
	// contains filtered or unexported fields
}

AdCreativeService works on adcreatives.

func (*AdCreativeService) Create

Create uploads a new adcreative and returns the ID.

func (*AdCreativeService) Get

func (as *AdCreativeService) Get(ctx context.Context, id string) (*AdCreative, error)

Get return a single creative.

func (*AdCreativeService) GetPreviewURL

func (as *AdCreativeService) GetPreviewURL(ctx context.Context, id, format string) (string, error)

GetPreviewURL returns the preview URL of a creative.

func (*AdCreativeService) List

func (s *AdCreativeService) List(act string, fields []string) *AdCreativeListCall

type AdGeoLocation

type AdGeoLocation struct {
	Key            string `json:"key"`
	Name           string `json:"name"`
	Type           string `json:"type"`
	CountryCode    string `json:"country_code"`
	SupportsRegion bool   `json:"supports_region"`
	SupportsCity   bool   `json:"supports_city"`
}

AdGeoLocation contains different geolocation types to be used for adset targeting.

type AdListCall

type AdListCall struct {
	*fb.RouteBuilder
	// contains filtered or unexported fields
}

AdListCall is used for Listing ads.

func (*AdListCall) Do

func (as *AdListCall) Do(ctx context.Context) ([]Ad, error)

Do calls the graph API.

func (*AdListCall) Read

func (as *AdListCall) Read(ctx context.Context, c chan<- Ad) error

Do calls the graph API.

type AdLocale

type AdLocale struct {
	Key  int    `json:"key"`
	Name string `json:"name"`
}

AdLocale can be used for locale adset targeting.

type AdService

type AdService struct {
	// contains filtered or unexported fields
}

AdService works with Ads.

func (*AdService) Create

func (as *AdService) Create(ctx context.Context, a Ad) (string, error)

Create uploads a new ad, returns the fields and returns the created ad.

func (*AdService) Get

func (as *AdService) Get(ctx context.Context, id string) (*Ad, error)

Get returns a single ad.

func (*AdService) List

func (as *AdService) List(act string) *AdListCall

List returns all ads of an account.

func (*AdService) ListOfAdset

func (as *AdService) ListOfAdset(adsetID string) *AdListCall

ListOfAdset returns all ads of an adset.

func (*AdService) Update

func (as *AdService) Update(ctx context.Context, a Ad) error

Update updates an ad.

type Adaccounts

type Adaccounts struct {
	Data []json.Number `json:"data,omitempty"`
}

Adaccounts https://developers.facebook.com/docs/marketing-api/reference/custom-audience/adaccounts/

type Adset

type Adset struct {
	AccountID                  string                 `json:"account_id,omitempty"`
	AttributionSpec            json.RawMessage        `json:"attribution_spec,omitempty"`
	BidAmount                  uint64                 `json:"bid_amount,omitempty"`
	BidStrategy                string                 `json:"bid_strategy,omitempty"`
	BillingEvent               string                 `json:"billing_event,omitempty"`
	BudgetRemaining            float64                `json:"budget_remaining,omitempty,string"`
	Campaign                   *Campaign              `json:"campaign,omitempty"`
	CampaignID                 string                 `json:"campaign_id,omitempty"`
	ConfiguredStatus           string                 `json:"configured_status,omitempty"`
	CreatedTime                fb.Time                `json:"created_time,omitempty"`
	DailyBudget                float64                `json:"daily_budget,omitempty,string"`
	DailyMinSpendTarget        uint64                 `json:"daily_min_spend_target,omitempty,string"`
	DailySpendCap              uint64                 `json:"daily_spend_cap,omitempty,string"`
	DestinationType            string                 `json:"destination_type,omitempty"`
	DeliveryEstimate           *DeliveryEstimate      `json:"delivery_estimate,omitempty"`
	EffectiveStatus            string                 `json:"effective_status,omitempty"`
	EndTime                    fb.Time                `json:"end_time,omitempty"`
	FrequencyControlSpecs      []FrequencyControlSpec `json:"frequency_control_specs,omitempty"`
	ID                         string                 `json:"id,omitempty"`
	LifetimeBudget             float64                `json:"lifetime_budget,omitempty,string"`
	LifetimeMinSpendTarget     uint64                 `json:"lifetime_min_spend_target,omitempty,string"`
	LifeTimeSpendCap           uint64                 `json:"lifetime_spend_cap,omitempty,string"`
	LifetimeImps               uint64                 `json:"lifetime_imps,omitempty"`
	Name                       string                 `json:"name,omitempty"`
	OptimizationGoal           string                 `json:"optimization_goal,omitempty"`
	PacingType                 []string               `json:"pacing_type,omitempty"`
	PromotedObject             *PromotedObject        `json:"promoted_object,omitempty"`
	RecurringBudgetSemantics   bool                   `json:"recurring_budget_semantics,omitempty"`
	StartTime                  fb.Time                `json:"start_time,omitempty"`
	Status                     string                 `json:"status,omitempty"`
	Targeting                  *Targeting             `json:"targeting,omitempty"`
	UpdatedTime                fb.Time                `json:"updated_time,omitempty"`
	TargetingOptimizationTypes map[string]int32       `json:"targeting_optimization_types,omitempty"`
	DSABeneficiary             string                 `json:"dsa_beneficiary,omitempty"`
	DSAPayor                   string                 `json:"dsa_payor,omitempty"`
}

Adset from https://developers.facebook.com/docs/marketing-api/reference/ad-campaign

type AdsetListCall

type AdsetListCall struct {
	*fb.RouteBuilder
	// contains filtered or unexported fields
}

AdsetListCall is used for Listing adsets.

func (*AdsetListCall) Do

func (as *AdsetListCall) Do(ctx context.Context) ([]Adset, error)

Do calls the graph API.

type AdsetService

type AdsetService struct {
	// contains filtered or unexported fields
}

AdsetService is used for working with adsets.

func (*AdsetService) CountAdSets

func (as *AdsetService) CountAdSets(ctx context.Context, accountID string) (uint64, error)

CountAdSets returns the total amount of active adsets.

func (*AdsetService) Create

func (as *AdsetService) Create(ctx context.Context, a Adset) (string, fb.Time, error)

Create uploads a new adset, returns the fields and returns the created adset.

func (*AdsetService) Get

func (as *AdsetService) Get(ctx context.Context, id string, fields ...string) (*Adset, error)

Get returns a single Adset.

func (*AdsetService) GetDeliveryEstimate

func (as *AdsetService) GetDeliveryEstimate(ctx context.Context, id string, t *Targeting) (uint64, error)

GetDeliveryEstimate returns the delivery_estimate mau for a given adset.

func (*AdsetService) List

func (as *AdsetService) List(account string, fields []string) *AdsetListCall

List returns a list of adsets for an account.

func (*AdsetService) ListOfCampaign

func (as *AdsetService) ListOfCampaign(campaignID string, fields []string) *AdsetListCall

ListOfCampaign returns an adsetlistcall for listing the adsets of a campaign id.

func (*AdsetService) Update

func (as *AdsetService) Update(ctx context.Context, a Adset) (fb.Time, error)

Update updates an adset.

type AndroidAppLink struct {
	// The native apps name in the Android store.
	AppName string `json:"app_name,omitempty"`
	// The fully classified class name of the app for intent generation.
	Class string `json:"class,omitempty"`
	// The fully classified package name of the app for intent generation.
	Package string `json:"package,omitempty"`
	// The native Android URL that will be navigated to.
	URL string `json:"url,omitempty"`
}

AndroidAppLink see https://developers.facebook.com/docs/graph-api/reference/android-app-link/

type AudienceService

type AudienceService struct {
	// contains filtered or unexported fields
}

AudienceService contains all methods for working on audiences.

func (*AudienceService) Create

func (as *AudienceService) Create(ctx context.Context, act string, a CustomAudience) (string, error)

Create uploads a new custom audience and returns the id of the custom audience.

func (*AudienceService) CreateLookalike

func (as *AudienceService) CreateLookalike(ctx context.Context, adaccountID, orginAudienceID, customAudienceName string, lookalikeSpec *LookalikeSpec) (string, error)

CreateLookalike creates new lookalike

func (*AudienceService) Delete

func (as *AudienceService) Delete(ctx context.Context, id string) error

Delete removes a single audience.

func (*AudienceService) DeleteLookalikes

func (as *AudienceService) DeleteLookalikes(ctx context.Context, id string) error

DeleteLookalikes removes all lookalikes of an audience.

func (*AudienceService) EditIDs

func (as *AudienceService) EditIDs(ctx context.Context, audienceID string, c <-chan string, doRemove bool) error

EditIDs starts adding or removing ids from a custom audience.

func (*AudienceService) Get

Get returns a single audience.

func (AudienceService) GetAudienceSize

func (as AudienceService) GetAudienceSize(ctx context.Context, accountID string, t *Targeting) (uint64, error)

func (*AudienceService) ListAdAccounts

func (as *AudienceService) ListAdAccounts(ctx context.Context, audienceID string) ([]string, error)

ListAdAccounts lists the accounts an audience is shared to.

func (*AudienceService) ListCustom

func (as *AudienceService) ListCustom(ctx context.Context, act string) ([]CustomAudience, error)

ListCustom returns all custom audiences for that account.

func (*AudienceService) ListCustomFiltered

func (as *AudienceService) ListCustomFiltered(ctx context.Context, act string, filtering []fb.Filter) ([]CustomAudience, error)

ListCustomFiltered returns a filtered list of custom audiences for that account. ...&filtering=[{field:'subtype',operator:'EQUAL',value:'WEBSITE'}].

func (*AudienceService) Share

func (as *AudienceService) Share(ctx context.Context, customAudienceID string, adaccountIDs []string) error

Share shares a custom audience with the provided adaccounts.

func (*AudienceService) ShareCustom

func (as *AudienceService) ShareCustom(ctx context.Context, customAudienceID string, adaccountIDs, relationshipTypes []string) error

ShareCustom shares a custom audience with the provided adaccounts.

func (*AudienceService) UnshareCustom

func (as *AudienceService) UnshareCustom(ctx context.Context, customAudienceID string, adaccountIDs, relationshipTypes []string) error

UnshareCustom unshares a custom audience with the provided adaccounts.

func (*AudienceService) Update

func (as *AudienceService) Update(ctx context.Context, a CustomAudience) error

Update updates an audience.

type Business

type Business struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Business is part of a CustomConversion.

type Campaign

type Campaign struct {
	AccountID           string   `json:"account_id,omitempty"`
	BuyingType          string   `json:"buying_type,omitempty"`
	CampaignGroupID     string   `json:"campaign_group_id,omitempty"`
	BidStrategy         string   `json:"bid_strategy,omitempty"`
	BidAmount           uint64   `json:"bid_amount,omitempty"`
	CanUseSpendCap      bool     `json:"can_use_spend_cap,omitempty"`
	ConfiguredStatus    string   `json:"configured_status,omitempty"`
	CreatedTime         string   `json:"created_time,omitempty"`
	DailyBudget         uint64   `json:"daily_budget,omitempty,string"`
	EffectiveStatus     string   `json:"effective_status,omitempty"`
	ID                  string   `json:"id,omitempty"`
	LifeTimeBudget      uint64   `json:"lifetime_budget,omitempty,string"`
	Name                string   `json:"name,omitempty"`
	Objective           string   `json:"objective,omitempty"`
	SpendCap            uint64   `json:"spend_cap,omitempty,string"`
	StartTime           fb.Time  `json:"start_time,omitempty"`
	Status              string   `json:"status,omitempty"`
	StopTime            fb.Time  `json:"stop_time,omitempty"`
	UpdatedTime         fb.Time  `json:"updated_time,omitempty"`
	SpecialAdCategories []string `json:"special_ad_categories,omitempty"`
}

Campaign from https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group

type CampaignListCall

type CampaignListCall struct {
	*fb.RouteBuilder
	// contains filtered or unexported fields
}

CampaignListCall is used for listing campaigns.

func (*CampaignListCall) Do

func (csc *CampaignListCall) Do(ctx context.Context) ([]Campaign, error)

Do function performs the CampaignListCall and returns all campaigns as slice.

type CampaignService

type CampaignService struct {
	// contains filtered or unexported fields
}

CampaignService works with campaigns.

func (*CampaignService) Create

func (cs *CampaignService) Create(ctx context.Context, c Campaign) (string, error)

Create uploads a new campaign, returns the fields and returns the created campaign.

func (*CampaignService) Get

func (cs *CampaignService) Get(ctx context.Context, id string, fields ...string) (*Campaign, error)

Get returns a single campaign.

func (*CampaignService) List

func (cs *CampaignService) List(act string) *CampaignListCall

List creates a new CampaignListCall.

func (*CampaignService) Update

func (cs *CampaignService) Update(ctx context.Context, c Campaign) error

Update updates an campaign.

type City

type City struct {
	Country      string `json:"country"`
	DistanceUnit string `json:"distance_unit"`
	Key          string `json:"key"`
	Name         string `json:"name"`
	Radius       int    `json:"radius"`
	Region       string `json:"region"`
	RegionID     string `json:"region_id"`
}

City can be targeted.

type Comment

type Comment struct {
	ID                       string          `json:"id,omitempty"`
	Attachment               json.RawMessage `json:"attachment,omitempty"`
	CanComment               bool            `json:"can_comment,omitempty"`
	CanRemove                bool            `json:"can_remove,omitempty"`
	CanHide                  bool            `json:"can_hide,omitempty"`
	CanLike                  bool            `json:"can_like,omitempty"`
	CanReplyPrivately        bool            `json:"can_reply_privately,omitempty"`
	CommentCount             int32           `json:"comment_count,omitempty"`
	CreatedTime              fb.Time         `json:"created_time,omitempty"`
	From                     *User           `json:"from,omitempty"`
	LikeCount                int32           `json:"like_count,omitempty"`
	Message                  string          `json:"message,omitempty"`
	MessageTags              []MessageTag    `json:"message_tags,omitempty"`
	Object                   json.RawMessage `json:"object,omitempty"`
	Parent                   *Comment        `json:"parent,omitempty"`
	PrivateReplyConversation json.RawMessage `json:"private_reply_conversation,omitempty"`
	UserLikes                bool            `json:"user_likes,omitempty"`
}

Comment represents a comment on a facebook post.

type CommentListCall

type CommentListCall struct {
	*fb.RouteBuilder

	*fb.StatsContainer
	// contains filtered or unexported fields
}

CommentListCall is used for listing comments of a post.

func (*CommentListCall) List

func (clc *CommentListCall) List(ctx context.Context) ([]Comment, error)

List performs the CommentListCall and returns all comments as slice.

func (*CommentListCall) Read

func (clc *CommentListCall) Read(ctx context.Context, c chan<- Comment) error

type Component

type Component struct {
	Type         string        `json:"type"`
	PositionSpec *PositionSpec `json:"position_spec"`
	PollSpec     *PollSpec     `json:"poll_spec"`
}

Component of the Interactive component struct.

type ConversionActionQuery

type ConversionActionQuery struct {
	ActionType []string `json:"action.type,omitempty"`
	FbPixel    []string `json:"fb_pixel,omitempty"`
	Page       []string `json:"page,omitempty"`
	Post       []string `json:"post,omitempty"`
}

ConversionActionQuery contains tracking specs.

type CreativeFeaturesSpec

type CreativeFeaturesSpec struct {
	StandardEnhancements StandardEnhancements `json:"standard_enhancements"`
}

type CustomAudience

type CustomAudience struct {
	ID                         string `json:"id,omitempty"`
	Name                       string `json:"name,omitempty"`
	AccountID                  string `json:"account_id,omitempty"`
	Description                string `json:"description,omitempty"`
	Subtype                    string `json:"subtype,omitempty"`
	ApproximateCountUpperBound int    `json:"approximate_count_upper_bound,omitempty"`
	ApproximateCountLowerBound int    `json:"approximate_count_lower_bound,omitempty"`

	Rule               string         `json:"rule,omitempty"`
	CustomerFileSource string         `json:"customer_file_source,omitempty"`
	Lookalikes         []string       `json:"lookalike_audience_ids,omitempty"`
	Adaccounts         *Adaccounts    `json:"adaccounts,omitempty"`
	LookalikeSpec      *LookalikeSpec `json:"lookalike_spec,omitempty"`
	OriginAudienceID   string         `json:"origin_audience_id,omitempty"`
}

CustomAudience https://developers.facebook.com/docs/marketing-api/reference/custom-audience unused fields: ApproximateCount int `json:"approximate_count,omitempty"`.

type CustomConversion

type CustomConversion struct {
	ID                       string       `json:"id"`
	AccountID                string       `json:"account_id"`
	AggregationRule          string       `json:"aggregation_rule"`
	Business                 Business     `json:"business"`
	Name                     string       `json:"name"`
	Rule                     string       `json:"rule"`
	CustomEventType          string       `json:"custom_event_type"`
	CreationTime             fb.Time      `json:"creation_time"`
	DataSources              []DataSource `json:"data_sources"`
	Description              string       `json:"description"`
	DefaultConversionValue   int          `json:"default_conversion_value"`
	LastFiredTime            fb.Time      `json:"last_fired_time"`
	IsUnavailable            bool         `json:"is_unavailable"`
	IsArchived               bool         `json:"is_archived"`
	FirstFiredTime           fb.Time      `json:"first_fired_time"`
	Pixel                    Pixel        `json:"pixel"`
	OfflineConversionDataSet interface{}  `json:"offline_conversion_data_set"`
	EventSourceType          string       `json:"event_source_type"`
	RetentionDays            int          `json:"retention_days"`
}

CustomConversion https://developers.facebook.com/docs/marketing-api/reference/custom-conversion/

type CustomConversionService

type CustomConversionService struct {
	// contains filtered or unexported fields
}

CustomConversionService contains all methods for working on custom conversions.

func (*CustomConversionService) Create

func (ccs *CustomConversionService) Create(ctx context.Context, businessID string, cc CustomConversion) (string, error)

Create uploads a new custom conversion and returns the id of the custom conversion.

func (*CustomConversionService) List

List returns all custom conversions for the specified account.

type DailyOutcomesCurve

type DailyOutcomesCurve struct {
	Spend       float64 `json:"spend"`
	Reach       float64 `json:"reach"`
	Impressions float64 `json:"impressions"`
	Actions     float64 `json:"actions"`
}

DailyOutcomesCurve talk to phillip.

type Data

type Data struct {
	DailyOutcomesCurve    []DailyOutcomesCurve `json:"daily_outcomes_curve"`
	EstimateDau           int64                `json:"estimate_dau"`
	EstimateMau           int64                `json:"estimate_mau"`
	EstimateMauLowerBound int64                `json:"estimate_mau_lower_bound"`
	EstimateMauUpperBound int64                `json:"estimate_mau_upper_bound"`
	EstimateReady         bool                 `json:"estimate_ready"`
}

Data is a single delivery estimate.

type DataSource

type DataSource struct {
	ID         string `json:"id"`
	SourceType string `json:"source_type"`
}

DataSource is part of a CustomConversion.

type DegreesOfFreedomSpec

type DegreesOfFreedomSpec struct {
	CreativeFeaturesSpec CreativeFeaturesSpec `json:"creative_features_spec"`
}

type DeliveryEstimate

type DeliveryEstimate struct {
	Data []Data `json:"data"`
}

DeliveryEstimate is a collection of Data structs.

type Device

type Device struct {
	Name         string `json:"name"`
	Description  string `json:"description"`
	Platform     string `json:"platform"`
	AudienceSize int    `json:"audience_size"`
	Type         string `json:"type"`
}

Device contains device information to be used for adset targeting.

type EventService

type EventService struct {
	// contains filtered or unexported fields
}

EventService contains all methods for working on events.

func (*EventService) SimpleList

func (es *EventService) SimpleList(ctx context.Context, pixelID string) ([]string, error)

SimpleList returns event names for a given pixel id.

type FlexibleSpec

type FlexibleSpec struct {
	Interests            []IDContainer `json:"interests,omitempty"`
	Behaviors            []IDContainer `json:"behaviors,omitempty"`
	LifeEvents           []IDContainer `json:"life_events,omitempty"`
	WorkEmployers        []IDContainer `json:"work_employers,omitempty"`
	FamilyStatuses       []IDContainer `json:"family_statuses,omitempty"`
	WorkPositions        []IDContainer `json:"work_positions,omitempty"`
	Politics             []IDContainer `json:"politics,omitempty"`
	EducationMajors      []IDContainer `json:"education_majors,omitempty"`
	EducationStatuses    []int         `json:"education_statuses,omitempty"`
	RelationshipStatuses []int         `json:"relationship_statuses,omitempty"`
}

FlexibleSpec is used for targeting

type FrequencyControlSpec

type FrequencyControlSpec struct {
	Event        string `json:"event"`
	IntervalDays uint64 `json:"interval_days"`
	MaxFrequency uint64 `json:"max_frequency"`
}

FrequencyControlSpec controls the frequency of an adset.

type GeoLocation

type GeoLocation struct {
	Countries     []string `json:"countries,omitempty"`
	CountryGroups []string `json:"country_groups,omitempty"`
}

GeoLocation ...

type GeoLocations

type GeoLocations struct {
	Countries     []string `json:"countries,omitempty"`
	LocationTypes []string `json:"location_types,omitempty"`
	Cities        []City   `json:"cities,omitempty"`
	Regions       []Region `json:"regions,omitempty"`
	Zips          []Zip    `json:"zips,omitempty"`
}

GeoLocations is a set of countries, cities, and regions that can be targeted.

type IDContainer

type IDContainer struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

IDContainer contains an ID and a name.

type Image

type Image struct {
	ID                              string   `json:"id,omitempty"`
	Height                          int      `json:"height,omitempty"`
	Hash                            string   `json:"hash,omitempty"`
	IsAssociatedCreativesInAdgroups bool     `json:"is_associated_creatives_in_adgroups,omitempty"`
	Name                            string   `json:"name,omitempty"`
	OriginalHeight                  int      `json:"original_height,omitempty"`
	OriginalWidth                   int      `json:"original_width,omitempty"`
	PermalinkURL                    string   `json:"permalink_url,omitempty"`
	Status                          string   `json:"status,omitempty"`
	UpdatedTime                     string   `json:"updated_time,omitempty"`
	CreatedTime                     string   `json:"created_time,omitempty"`
	URL                             string   `json:"url,omitempty"`
	AccountID                       string   `json:"account_id,omitempty"`
	URL128                          string   `json:"url_128,omitempty"`
	Width                           int      `json:"width,omitempty"`
	Creatives                       []string `json:"creatives,omitempty"`
}

Image represents an image being uploaded to the creative library.

type ImageService

type ImageService struct {
	// contains filtered or unexported fields
}

ImageService works with ad images.

func (*ImageService) ReadList

func (is *ImageService) ReadList(ctx context.Context, act string, res chan<- Image) error

ReadList writes all ad images from an account to res.

func (*ImageService) Upload

func (is *ImageService) Upload(ctx context.Context, act, name string, r io.Reader) (*Image, error)

Upload uploads an image to Facebook.

type Insight

type Insight struct {
	AccountID                        string                 `json:"account_id"`
	AccountName                      string                 `json:"account_name"`
	Actions                          ActionTypeValue        `json:"actions"`
	UniqueActions                    ActionTypeValue        `json:"unique_actions"`
	AdsetID                          string                 `json:"adset_id"`
	AdID                             string                 `json:"ad_id"`
	Objective                        string                 `json:"objective"`
	AdsetName                        string                 `json:"adset_name"`
	AdName                           string                 `json:"ad_name"`
	Age                              string                 `json:"age"`
	CampaignID                       string                 `json:"campaign_id"`
	CampaignName                     string                 `json:"campaign_name"`
	PublisherPlatform                string                 `json:"publisher_platform"`
	PlatformPosition                 string                 `json:"platform_position"`
	Clicks                           uint64                 `json:"clicks,string"`
	DateStart                        string                 `json:"date_start"`
	DateStop                         string                 `json:"date_stop"`
	Frequency                        float64                `json:"frequency,string"`
	Gender                           string                 `json:"gender"`
	Impressions                      uint64                 `json:"impressions,string"`
	Reach                            float64                `json:"reach,string"`
	Spend                            float64                `json:"spend,string"`
	Cpc                              float64                `json:"cpc,string"`
	Cpp                              float64                `json:"cpp,string"`
	Cpm                              float64                `json:"cpm,string"`
	Ctr                              float64                `json:"ctr,string"`
	InlineLinkClicks                 uint64                 `json:"inline_link_clicks,string"`
	UniqueClicks                     uint64                 `json:"unique_clicks,string"`
	UniqueInlineLinkClicks           uint64                 `json:"unique_inline_link_clicks,string"`
	UniqueCtr                        float64                `json:"unique_ctr,string"`
	OutboundClicks                   ActionTypeValue        `json:"outbound_clicks"`
	UniqueOutboundClicks             ActionTypeValue        `json:"unique_outbound_clicks"`
	OutboundClicksCtr                ActionTypeValue        `json:"outbound_clicks_ctr"`
	UniqueOutboundClicksCtr          ActionTypeValue        `json:"unique_outbound_clicks_ctr"`
	PurchaseRoas                     ActionTypeValue        `json:"purchase_roas"`
	VideoContinues2SecWatchedActions ActionTypeValue        `json:"video_continuous_2_sec_watched_actions"`
	Video15SecWatchedActions         ActionTypeValue        `json:"video_15_sec_watched_actions"`
	VideoThruplayWatchedActions      ActionTypeValue        `json:"video_thruplay_watched_actions"`
	Video30SecWatchedActions         ActionTypeValue        `json:"video_30_sec_watched_actions"`
	VideoAvgTimeWatchedActions       ActionTypeValue        `json:"video_avg_time_watched_actions"`
	VideoP100WatchedActions          ActionTypeValue        `json:"video_p100_watched_actions"`
	VideoP25WatchedActions           ActionTypeValue        `json:"video_p25_watched_actions"`
	VideoP50WatchedActions           ActionTypeValue        `json:"video_p50_watched_actions"`
	VideoP75WatchedActions           ActionTypeValue        `json:"video_p75_watched_actions"`
	VideoP95WatchedActions           ActionTypeValue        `json:"video_p95_watched_actions"`
	VideoPlayActions                 ActionTypeValue        `json:"video_play_actions"`
	WebsitePurchaseRoas              ActionTypeValue        `json:"website_purchase_roas"`
	InteractiveComponentTap          []InteractiveComponent `json:"interactive_component_tap"`
	DeviceType                       string                 `json:"impression_device"`
	Region                           string                 `json:"region"`
	Country                          string                 `json:"country"`
}

Insight contains insight data for an facebook graph API object, broken down by the desired day.

func (Insight) GetAge

func (i Insight) GetAge() (uint64, uint64, error)

GetAge returns the min and max age from the insights age field.

type InsightsRequest

type InsightsRequest struct {
	*InsightsService
	*fb.RouteBuilder
}

InsightsRequest is used to build a new request for creating an insights run.

func (*InsightsRequest) Download

func (ir *InsightsRequest) Download(ctx context.Context) ([]Insight, error)

Download returns all insights from the request in one slice.

func (*InsightsRequest) GenerateReport

func (ir *InsightsRequest) GenerateReport(ctx context.Context, c chan<- Insight) (uint64, error)

GenerateReport creates the insights report, waits until it's finished building, reads to c and then deletes it.

type InsightsService

type InsightsService struct {
	*fb.StatsContainer
	// contains filtered or unexported fields
}

InsightsService contains all methods for working on audiences.

func (*InsightsService) NewReport

func (is *InsightsService) NewReport(account string) *InsightsRequest

NewReport creates a new InsightsRequest.

func (*InsightsService) NewReportOfCampaign

func (is *InsightsService) NewReportOfCampaign(campaignID string) *InsightsRequest

NewReportOfCampaign creates a new InsightsRequest.

type InstagramActor

type InstagramActor struct {
	ID       string `json:"id"`
	Username string `json:"username"`
}

InstagramActor represents an instagram actor.

type InteractiveComponent

type InteractiveComponent struct {
	InteractiveComponentStickerID       string `json:"interactive_component_sticker_id"`
	InteractiveComponentStickerResponse string `json:"interactive_component_sticker_response"`
	Value                               string `json:"value"`
}

InteractiveComponent represents poll results.

type InteractiveComponentsSpec

type InteractiveComponentsSpec struct {
	Components []*Component `json:"components"`
}

InteractiveComponentsSpec is mainly used for Video Poll Ads.

type InterestService

type InterestService struct {
	// contains filtered or unexported fields
}

InterestService works with ads interests.

func (*InterestService) Search

func (is *InterestService) Search(ctx context.Context, query string, limit int) ([]InterestTargeting, error)

Search returns a list of InterestTargetings.

func (*InterestService) TargetingSearch

func (is *InterestService) TargetingSearch(ctx context.Context, act string, query string) ([]InterestTargeting, error)

TargetingSearch searches for a targeting.

type InterestTargeting

type InterestTargeting struct {
	ID           string   `json:"id"`
	Name         string   `json:"name"`
	AudienceSize uint64   `json:"audience_size_upper_bound"`
	Type         string   `json:"type"`
	Path         []string `json:"path"`
}

InterestTargeting represents an ad interest to be used in an adset targeting.

type IosAppLink struct {
	// The native apps name in the iTunes store.
	AppName string `json:"app_name,omitempty"`
	// The native apps ID in the iTunes store.
	AppStoreID string `json:"app_store_id,omitempty"`
	// The native iOS URL that will be navigated to.
	URL string `json:"url,omitempty"`
}

IosAppLink see https://developers.facebook.com/docs/graph-api/reference/ios-app-link/

type LocationSpec

type LocationSpec struct {
	GeoLocations         *GeoLocation `json:"geo_locations,omitempty"`
	ExcludedGeoLocations *GeoLocation `json:"excluded_geo_locations,omitempty"`
}

LocationSpec ...

type LookalikeOrigion

type LookalikeOrigion struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

LookalikeOrigion tells which audience a lookalike one is related to.

type LookalikeSpec

type LookalikeSpec struct {
	Country string             `json:"country,omitempty"`
	Origin  []LookalikeOrigion `json:"origin,omitempty"`
	Ratio   float64            `json:"ratio,omitempty"`
	Type    string             `json:"type,omitempty"`
}

LookalikeSpec contains the metadata of lookalike audiences.

type MessageTag

type MessageTag struct {
	ID     string `json:"id,omitempty"`
	Name   string `json:"name,omitempty"`
	Type   string `json:"type,omitempty"`
	Offset int    `json:"offset,omitempty"`
	Length int    `json:"length,omitempty"`
}

MessageTag represents a tagged user or site in a comment.

type ObjectStorySpec

type ObjectStorySpec struct {
	PageID           string               `json:"page_id,omitempty"`
	InstagramActorID string               `json:"instagram_actor_id,omitempty"`
	VideoData        *VideoData           `json:"video_data,omitempty"`
	LinkData         *AdCreativeLinkData  `json:"link_data,omitempty"`
	PhotoData        *AdCreativePhotoData `json:"photo_data,omitempty"`
}

ObjectStorySpec contains the media of a creative.

type OperatingSystem

type OperatingSystem struct {
	Type        string `json:"type"`
	Name        string `json:"name"`
	Platform    string `json:"platform"`
	Description string `json:"description"`
}

OperatingSystem contains information about an user OS to be used for adset targeting.

type OptionCallToAction

type OptionCallToAction struct {
	Value *OptionCallToActionValue `json:"value"`
	Type  string                   `json:"type"`
}

OptionCallToAction represents the action and call to action of an answer of a poll.

type OptionCallToActionValue

type OptionCallToActionValue struct {
	Link       string `json:"link"`
	LinkFormat string `json:"link_format,omitempty"`
}

OptionCallToActionValue describes the link of a call to action answer.

type Page

type Page struct {
	ID                  string `json:"id"`
	GlobalBrandPageName string `json:"global_brand_page_name"`
}

Page represents a facebook page.

type PageService

type PageService struct {
	// contains filtered or unexported fields
}

PageService contains all methods for working on pages.

func (*PageService) Get

func (ps *PageService) Get(ctx context.Context, id string) (*Page, error)

Get returns a single page.

func (*PageService) GetClientPages

func (ps *PageService) GetClientPages(ctx context.Context, businessID string) ([]Page, error)

GetClientPages returns all client pages.

func (*PageService) GetInstagramActor

func (ps *PageService) GetInstagramActor(ctx context.Context, id string) (*InstagramActor, error)

GetInstagramActor returns a single instagram actor.

func (*PageService) GetInstagramActors

func (ps *PageService) GetInstagramActors(ctx context.Context, businessID string) ([]InstagramActor, error)

GetInstagramActors returns all instagram accounts.

func (*PageService) GetOwnedPages

func (ps *PageService) GetOwnedPages(ctx context.Context, businessID string) ([]Page, error)

GetOwnedPages returns all owned pages.

func (*PageService) GetPageBackedInstagramAccounts

func (ps *PageService) GetPageBackedInstagramAccounts(ctx context.Context, pageID string) (*InstagramActor, error)

GetPageBackedInstagramAccounts returns the instagram actor associated with a facebook page.

func (*PageService) SetPageAccessToken

func (ps *PageService) SetPageAccessToken(ctx context.Context, pageID string) (context.Context, error)

SetPageAccessToken tries to retrieve the access token for a facebook page and includes it in the passed context so the fb.Client can use it for making requests.

type Pixel

type Pixel struct {
	ID string `json:"id"`
}

Pixel is part of a CustomConversion.

type PollSpec

type PollSpec struct {
	QuestionText        string              `json:"question_text"`
	OptionAText         string              `json:"option_a_text"`
	OptionBText         string              `json:"option_b_text"`
	ThemeColor          string              `json:"theme_color,omitempty"`
	OptionACallToAction *OptionCallToAction `json:"option_a_call_to_action,omitempty"`
	OptionBCallToAction *OptionCallToAction `json:"option_b_call_to_action,omitempty"`
	LinkDisplay         string              `json:"link_display,omitempty"`
}

PollSpec represents the questions and answers of a poll.

type PositionSpec

type PositionSpec struct {
	X        float64 `json:"x"`
	Y        float64 `json:"y"`
	Width    float64 `json:"width"`
	Height   float64 `json:"height"`
	Rotation float64 `json:"rotation"`
}

PositionSpec describes the position of an interactive component.

type Post

type Post struct {
	CreatedTime            string                          `json:"created_time"`
	ContentCategory        string                          `json:"content_category"`
	Description            string                          `json:"description"`
	EmbedHTML              string                          `json:"embed_html"`
	Embeddable             bool                            `json:"embeddable"`
	ID                     string                          `json:"id"`
	Icon                   string                          `json:"icon"`
	IsInstagramEligible    bool                            `json:"is_instagram_eligible"`
	Picture                string                          `json:"picture"`
	PermalinkURL           string                          `json:"permalink_url"`
	MonetizationStatus     string                          `json:"monetization_status"`
	Length                 float64                         `json:"length"`
	Link                   string                          `json:"link"`
	Name                   string                          `json:"name"`
	Type                   string                          `json:"type"`
	Published              bool                            `json:"published"`
	UpdatedTime            string                          `json:"updated_time"`
	Message                string                          `json:"message"`
	InstagramEligibility   string                          `json:"instagram_eligibility"`
	FullPicture            string                          `json:"full_picture"`
	MultiShareEndCard      bool                            `json:"multi_share_end_card"`
	MultiShareOptimized    bool                            `json:"multi_share_optimized"`
	ObjectID               string                          `json:"object_id"`
	PromotableID           string                          `json:"promotable_id"`
	PromotionStatus        string                          `json:"promotion_status"`
	StatusType             string                          `json:"status_type"`
	Subscribed             bool                            `json:"subscribed"`
	TimelineVisibility     string                          `json:"timeline_visibility"`
	VideoBuyingEligibility []string                        `json:"video_buying_eligibility"`
	IsHidden               bool                            `json:"is_hidden"`
	IsAppShare             bool                            `json:"is_app_share"`
	IsExpired              bool                            `json:"is_expired"`
	IsPopular              bool                            `json:"is_popular"`
	IsPublished            bool                            `json:"is_published"`
	IsSpherical            bool                            `json:"is_spherical"`
	CallToAction           *AdCreativeLinkDataCallToAction `json:"call_to_action"`
	Format                 []struct {
		EmbedHTML string `json:"embed_html"`
		Filter    string `json:"filter"`
		Height    int    `json:"height"`
		Picture   string `json:"picture"`
		Width     int    `json:"width"`
	} `json:"format"`
	From    IDContainer `json:"from"`
	Privacy struct {
		Allow       string `json:"allow"`
		Deny        string `json:"deny"`
		Description string `json:"description"`
		Friends     string `json:"friends"`
		Networks    string `json:"networks"`
		Value       string `json:"value"`
	} `json:"privacy"`
	Status struct {
		VideoStatus string `json:"video_status"`
	} `json:"status"`
	Application struct {
		Category string `json:"category"`
		Link     string `json:"link"`
		Name     string `json:"name"`
		ID       string `json:"id"`
	} `json:"application"`
	Coordinates struct{} `json:"coordinates"`
	Actions     []struct {
		Name string `json:"name"`
		Link string `json:"link"`
	} `json:"actions"`
	Properties []struct {
		Name string `json:"name"`
		Text string `json:"text"`
	} `json:"properties"`
}

Post represents the fb graph api response for a fb video post https://developers.facebook.com/docs/graph-api/reference/v5.0/page-post

type PostService

type PostService struct {
	*fb.StatsContainer
	// contains filtered or unexported fields
}

PostService works on posts.

func (*PostService) CountComments

func (ps *PostService) CountComments(ctx context.Context, postID string) (uint64, error)

CountComments returns the total amount of parent comments.

func (*PostService) Get

func (ps *PostService) Get(ctx context.Context, id string) (*Post, error)

Get returns a single post.

func (*PostService) GetReactions

func (ps *PostService) GetReactions(ctx context.Context, postID string) (Reactions, error)

GetReactions returns the amount of reactions for a post.

func (*PostService) ListComments

func (ps *PostService) ListComments(postID, filter string) *CommentListCall

ListComments creates a new CommentListCall Filters may be "stream" or "toplevel".

type PromotedObject

type PromotedObject struct {
	PageID             string `json:"page_id,omitempty"`
	PixelID            string `json:"pixel_id,omitempty"`
	PixelRule          string `json:"pixel_rule,omitempty"`
	CustomEventType    string `json:"custom_event_type,omitempty"`
	CustomConversionID string `json:"custom_conversion_id,omitempty"`
}

PromotedObject contains the id of a promoted page.

type ReachEstimate

type ReachEstimate struct {
	Data ReachEstimateData `json:"data"`
}

ReachEstimate is a collection of Data structs.

type ReachEstimateData

type ReachEstimateData struct {
	LowerBound    int64 `json:"users_lower_bound"`
	UpperBound    int64 `json:"users_upper_bound"`
	EstimateReady bool  `json:"estimate_ready"`
}

Data is a single reach estimate.

type Reactions

type Reactions map[string]uint64

Reactions contains a reation and how often it was performed on an object.

type Region

type Region struct {
	Key     string `json:"key"`
	Name    string `json:"name"`
	Country string `json:"country"`
}

Region can be targeted.

type SearchService

type SearchService struct {
	// contains filtered or unexported fields
}

SearchService performs searches on the graph API.

func (*SearchService) GetAdGeoLocations

func (s *SearchService) GetAdGeoLocations(ctx context.Context) ([]AdGeoLocation, error)

GetAdGeoLocations returns all AdGeoLocations.

func (*SearchService) GetAdLocales

func (s *SearchService) GetAdLocales(ctx context.Context) ([]AdLocale, error)

GetAdLocales returns all ad locales.

func (*SearchService) GetDevices

func (s *SearchService) GetDevices(ctx context.Context) ([]Device, error)

GetDevices returns all devices.

func (*SearchService) GetOperatingSystems

func (s *SearchService) GetOperatingSystems(ctx context.Context) ([]OperatingSystem, error)

GetOperatingSystems returns all operating systems.

func (*SearchService) GetRegions

func (s *SearchService) GetRegions(ctx context.Context, country string) ([]AdGeoLocation, error)

func (*SearchService) ValidateInterests

func (s *SearchService) ValidateInterests(ctx context.Context, externalIDs []string) (validIDs []string, invalidIDs []string, err error)

ValidateInterests validates a list of interests and returns a list of valid and a list of invalid IDs.

type Service

type Service struct {
	*fb.Client
	AdAccounts        *AdAccountService
	AdCreatives       *AdCreativeService
	Adsets            *AdsetService
	Ads               *AdService
	Audiences         *AudienceService
	Campaigns         *CampaignService
	CustomConversions *CustomConversionService
	Events            *EventService
	Insights          *InsightsService
	Interests         *InterestService
	Images            *ImageService
	Pages             *PageService
	Posts             *PostService
	Search            *SearchService
	Videos            *VideoService
}

Service interacts with the Facebook Marketing API.

func New

func New(l log.Logger, accessToken, appSecret string) (*Service, error)

New initializes a new Service and all the Services contained.

func (*Service) GetMetadata

func (s *Service) GetMetadata(ctx context.Context, id string) (*fb.Metadata, error)

GetMetadata returns the metadata of a graph API object.

type StandardEnhancements

type StandardEnhancements struct {
	EnrollStatus string `json:"enroll_status"`
}

type StoryAttachment

type StoryAttachment struct {
	Description         string                 `json:"description,omitempty"`
	Media               *StoryAttachmentMedia  `json:"media,omitempty"`
	MediaType           string                 `json:"media_type,omitempty"`
	Title               string                 `json:"title,omitempty"`
	StoryAttachmentType string                 `json:"type,omitempty"`
	UnshimmedURL        string                 `json:"unshimmed_url,omitempty"`
	URL                 string                 `json:"url,omitempty"`
	Name                string                 `json:"name,omitempty"`
	Target              *StoryAttachmentTarget `json:"target,omitempty"`
}

StoryAttachment holds information about a post, used since v3.3 https://developers.facebook.com/docs/graph-api/reference/story-attachment/

type StoryAttachmentMedia

type StoryAttachmentMedia struct {
	Image  interface{} `json:"image,omitempty"`
	Source string      `json:"source,omitempty"`
}

StoryAttachmentMedia https://developers.facebook.com/docs/graph-api/reference/v5.0/story-attachment-media

type StoryAttachmentTarget

type StoryAttachmentTarget struct {
	ID           string `json:"id,omitempty"`
	UnshimmedURL string `json:"unshimmed_url,omitempty"`
	URL          string `json:"url,omitempty"`
}

StoryAttachmentTarget https://developers.facebook.com/docs/graph-api/reference/story-attachment-target/

type StoryAttachments

type StoryAttachments struct {
	Data []StoryAttachment `json:"data,omitempty"`
}

StoryAttachments wraps the data slice around the StoryAttachment(s).

type Targeting

type Targeting struct {
	// inventories
	PublisherPlatforms []string `json:"publisher_platforms,omitempty"`
	// sub inventories
	FacebookPositions        []string `json:"facebook_positions,omitempty"`
	InstagramPositions       []string `json:"instagram_positions,omitempty"`
	AudienceNetworkPositions []string `json:"audience_network_positions,omitempty"`
	MessengerPositions       []string `json:"messenger_positions,omitempty"`

	AgeMin  uint64 `json:"age_min,omitempty"`
	AgeMax  uint64 `json:"age_max,omitempty"`
	Genders []int  `json:"genders,omitempty"`

	AppInstallState string `json:"app_install_state,omitempty"`

	CustomAudiences         []IDContainer  `json:"custom_audiences,omitempty"`
	ExcludedCustomAudiences []IDContainer  `json:"excluded_custom_audiences,omitempty"`
	GeoLocations            *GeoLocations  `json:"geo_locations,omitempty"`
	ExcludedGeoLocations    *GeoLocations  `json:"excluded_geo_locations,omitempty"`
	FlexibleSpec            []FlexibleSpec `json:"flexible_spec,omitempty"`
	Exclusions              *FlexibleSpec  `json:"exclusions,omitempty"`

	DevicePlatforms             []string                 `json:"device_platforms,omitempty"`
	ExcludedPublisherCategories []string                 `json:"excluded_publisher_categories,omitempty"`
	Locales                     []int                    `json:"locales,omitempty"`
	TargetingOptimization       string                   `json:"targeting_optimization,omitempty"`
	UserDevice                  []string                 `json:"user_device,omitempty"`
	UserOs                      []string                 `json:"user_os,omitempty"`
	WirelessCarrier             []string                 `json:"wireless_carrier,omitempty"`
	TargetingRelaxationTypes    TargetingRelaxationTypes `json:"targeting_relaxation_types,omitempty"`
}

Targeting contains all the targeting information of an adset.

type TargetingOptionStatus

type TargetingOptionStatus struct {
	ID            string `json:"id"`
	CurrentStatus string `json:"current_status"`
	FuturePlan    []struct {
		Key   string `json:"key"`
		Value string `json:"value"`
	} `json:"future_plan"`
}

TargetingOptionStatus is the json response of the ValidateInterest request.

type TargetingRelaxationTypes

type TargetingRelaxationTypes struct {
	CustomAudience int8 `json:"custom_audience"`
	Lookalike      int8 `json:"lookalike"`
}

Advantage custom audience and Advantage lookalike can be enabled or disabled. if a value of 0 is passed, it will be disabled. If a value of 1 is passed, it will be enabled. If no key/value pair is passed, it will be considered as enabled. https://developers.facebook.com/docs/graph-api/changelog/version15.0/

type UploadError

type UploadError struct {
	Total    uint64
	Received uint64
	Failed   uint64
}

UploadError gets returned when the number of total lines does not match the number of received lines or when the number of failed lines is greater than zero.

func (*UploadError) Error

func (ue *UploadError) Error() string

type User

type User struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

User represents a facebook user.

type Video

type Video struct {
	ContentCategory        string  `json:"content_category"`
	CreatedTime            string  `json:"created_time"`
	Description            string  `json:"description"`
	EmbedHTML              string  `json:"embed_html"`
	Embeddable             bool    `json:"embeddable"`
	ID                     string  `json:"id"`
	Icon                   string  `json:"icon"`
	Length                 float64 `json:"length"`
	MonetizationStatus     string  `json:"monetization_status"`
	Picture                string  `json:"picture"`
	IsCrosspostVideo       bool    `json:"is_crosspost_video"`
	IsCrosspostingEligible bool    `json:"is_crossposting_eligible"`
	IsInstagramEligible    bool    `json:"is_instagram_eligible"`
	PermalinkURL           string  `json:"permalink_url"`
	Published              bool    `json:"published"`
	Source                 string  `json:"source"`
	UpdatedTime            string  `json:"updated_time"`
	Title                  string  `json:"title,omitempty"`
	AutoGeneratedCaptions  struct {
		Data []struct {
			ID string `json:"id"`
		} `json:"data"`
		Paging struct {
			Cursors struct {
				Before string `json:"before"`
				After  string `json:"after"`
			} `json:"cursors"`
		} `json:"paging"`
	} `json:"auto_generated_captions,omitempty"`
	Format []struct {
		EmbedHTML string `json:"embed_html"`
		Filter    string `json:"filter"`
		Height    int    `json:"height"`
		Picture   string `json:"picture"`
		Width     int    `json:"width"`
	} `json:"format"`
	From struct {
		Name string `json:"name"`
		ID   string `json:"id"`
	} `json:"from"`
	Privacy struct {
		Allow       string `json:"allow"`
		Deny        string `json:"deny"`
		Description string `json:"description"`
		Friends     string `json:"friends"`
		Networks    string `json:"networks"`
		Value       string `json:"value"`
	} `json:"privacy"`
	Status struct {
		VideoStatus string `json:"video_status"`
	} `json:"status"`
}

Video represents an ad video.

type VideoData

type VideoData struct {
	ImageHash       string                          `json:"image_hash,omitempty"`
	ImageURL        string                          `json:"image_url,omitempty"`
	LinkDescription string                          `json:"link_description,omitempty"`
	Message         string                          `json:"message,omitempty"`
	Title           string                          `json:"title,omitempty"`
	VideoID         string                          `json:"video_id,omitempty"`
	CallToAction    *AdCreativeLinkDataCallToAction `json:"call_to_action,omitempty"`
}

VideoData is the specific part of a creative that only video posts do have.

type VideoService

type VideoService struct {
	// contains filtered or unexported fields
}

VideoService works with advideos.

func (*VideoService) Get

func (vs *VideoService) Get(ctx context.Context, id string) (*Video, error)

Get returns a single Video.

func (*VideoService) ReadList

func (vs *VideoService) ReadList(ctx context.Context, act string, res chan<- Video) error

ReadList returns all videos from an account and writes them to a channel.

func (*VideoService) Upload

func (vs *VideoService) Upload(ctx context.Context, act, title string, size int64, r io.Reader) (*Video, error)

Upload uploads a video from r into an account.

type Zip

type Zip struct {
	Key           string `json:"key"`
	Name          string `json:"name"`
	PrimaryCityID int    `json:"primary_city_id"`
	RegionID      int    `json:"region_id"`
	Country       string `json:"country"`
}

Zip can be targeted.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL