This doc provides examples for the schedule_type
of CUSTOM
in more detail.
As referenced from the main documentation:
If the schedule_type
is CUSTOM
, you must also specify the list of custom schedules, or times when the rule will run. In the schedule
list, each individual specification can be composed of a combination of the following fields, with the only requirement that at least one of start_minute
or days
must exist in each entry.
Field | Description |
---|---|
| Time in minutes after 12:00AM. Must be a multiple of 30 minutes.
If this is set and there is no |
| Time in minutes after 12:00AM. Must be a multiple of 30 minutes
and after |
| List of days to run the rule. Each day must be a value from |
Here's an example of using Advanced Scheduling to schedule the rule to run every day at 10 AM. By omitting the days
, we automatically infer that this schedule specification will apply to every day.
curl \ -F 'name=Test Advanced Scheduling Rule' \ -F 'schedule_spec={ "schedule_type": "CUSTOM", "schedule": [ { "start_minute": 600, } ] }' \ -F 'evaluation_spec={ ... }' \ -F 'execution_spec={ ... }' \ -F "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<VERSION>/<AD_ACCOUNT_ID>/adrules_library
Here's an example of a rule that runs every 30 minutes only on weekends. By omitting start_minute
, we infer the rule to run as SEMI_HOURLY
for the specified days.
curl \ -F 'name=Test Advanced Scheduling Rule' \ -F 'schedule_spec={ "schedule_type": "CUSTOM", "schedule": [ { "days": [0, 6] } ] }' \ -F 'evaluation_spec={ ... }' \ -F 'execution_spec={ ... }' \ -F "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<VERSION>/<AD_ACCOUNT_ID>/adrules_library
Here's an example of a rule that only runs on Wednesdays at 2 AM. By omitting end_minute
, we infer that the rule only runs at one specific time instead of a range of times.
curl \ -F 'name=Test Advanced Scheduling Rule' \ -F 'schedule_spec={ "schedule_type": "CUSTOM", "schedule": [ { "start_minute": 120, "days": [3] } ] }' \ -F 'evaluation_spec={ ... }' \ -F 'execution_spec={ ... }' \ -F "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<VERSION>/<AD_ACCOUNT_ID>/adrules_library
Each individual schedule is calculated independently as an OR with the other schedules. Here's an example of a rule that runs all day on the weekdays, but only from 12-1PM on the weekends. By having an end_minute
here, we now look at the range of time from the start_minute
to end_minute
.
curl \ -F 'name=Test Advanced Scheduling Rule' \ -F 'schedule_spec={ "schedule_type": "CUSTOM", "schedule": [ { "days": [1, 2, 3, 4, 5] }, { "start_minute": 720, "end_minute": 780, "days": [0, 6] } ] }' \ -F 'evaluation_spec={ ... }' \ -F 'execution_spec={ ... }' \ -F "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<VERSION>/<AD_ACCOUNT_ID>/adrules_library
Note that not specifying days
in the second schedule specification will also work equivalently, since the first specification includes 12-1PM on weekdays.