Encola un plan. No devuelve publicaciones: devuelve el plan en pending y el
presupuesto que se calculó para aceptarlo.
Falla ANTES de gastar nada si no hay créditos para el coste imprescindible (941), si no queda
cupo de publicaciones (924), si alguna cuenta no publica —WhatsApp, Google Business— (942), o
si con los días elegidos no queda ningún hueco futuro en la semana (2108).
const { ai_plan, estimate } = awaitpv.aiPlans.create(clientId, orgId, { prompt:"Pan de masa madre, horno de leña, barrio", accounts: [accountId], options: { publish_days: [1, 3, 5], timezone:"Europe/Madrid" }, });
Whether images may be generated. Each image costs 70 AI credits. Optional; defaults to true.
Optionalgallery_uploads?: string[]
Description
Upload ids from the organization's gallery used as visual reference for the generated images.
Optionallanguage?: string
Description
Language of the generated texts. Optional; defaults to "es".
Optionalmax_images?: number
Description
Optional cap on the number of images; the credit budget may reduce it further.
Optionalpublish_days?: number[]
Description
Days of the week the plan publishes on, in ISO 8601 numbering (1 = Monday ... 7 = Sunday). Defaults to the whole week. There is still at most ONE publication per day and account, so this is what bounds the size and the cost of the plan: the number of generated posts is (selected days x accounts). Must be a non-empty array of unique integers between 1 and 7, or the request is rejected with 2106. The 7-day window starts at week_start, so each ISO day appears exactly once: with a week_start in mid-week, day 1 (Monday) is the FOLLOWING Monday. If the selected days leave no future slot at all, the request is rejected with 2108. Optional; defaults to [1,2,3,4,5,6,7].
Optionalshared?: boolean
Description
Generate ONE piece of content per day and replicate it across every account, each scheduled at the best hour for ITS network, instead of one publication per account and day. Cheaper — one text and one image per day — and it caps images at 7. Optional; defaults to false.
Optionaltimezone?: string
Description
IANA timezone for the optimal publish slots (typically the user's browser timezone). publish_date is stored in UTC. Optional; defaults to "Europe/Madrid".
Optionaltone?: string
Description
Optional tone (e.g. 'cercano', 'profesional') passed to the prompt.
Optionaluse_organization_context?: boolean
Description
Use the organization's brand context in the prompts. It is copied into the plan as a SNAPSHOT when the plan is created, so a retry or a regeneration uses the context the plan was asked with even if the configuration changed meanwhile. Optional; defaults to true.
Optionalweek_start?: string
Format: date-time
Description
Start of the week to plan (slots are generated between this date and +7 days). Defaults to now.
Acepta el plan: las drafts generadas SIN errores pasan a ready y a partir de ahí las publica
el robot como cualquier publicación programada.
Sólo desde generated (error 2102 en cualquier otro estado). Las drafts que sí tienen
errores se quedan en draft: se arreglan o se borran con pv.publications.
Encola un plan. No devuelve publicaciones: devuelve el plan en
pendingy el presupuesto que se calculó para aceptarlo.Falla ANTES de gastar nada si no hay créditos para el coste imprescindible (941), si no queda cupo de publicaciones (924), si alguna cuenta no publica —WhatsApp, Google Business— (942), o si con los días elegidos no queda ningún hueco futuro en la semana (2108).