import type { Campaign, EmailMarketingTemplate, EmailMarketingGeneratedEmail, EmailMarketingSequence, EmailMarketingRecipient, EmailMarketingSequenceStep, EmailTemplateVersion, SocialCampaign } from "../_internal/types.gen"; import type { RequestOptions } from "../base-client"; import { RequestBuilder } from "../request-builder"; /** Attributes for creating a campaign via admin API. */ export type CreateCampaignAttributes = { workspace_id: string; name: string; template_id: string; description?: string; sender_profile_id?: string; include_tracking_pixel?: boolean; include_unsubscribe_link?: boolean; unsubscribe_message?: string; }; /** Attributes for updating a campaign via admin API (PATCH semantics). */ export type UpdateCampaignAttributes = { name?: string; scheduled_at?: string; [key: string]: unknown; }; /** Attributes for creating a follow-up campaign. */ export type CreateFollowupCampaignAttributes = { name?: string; [key: string]: unknown; }; /** Attributes for sending a campaign. */ export type SendCampaignAttributes = { workspace_id: string; connector_id: string; connector_type: string; }; /** Attributes for AI campaign analysis. */ export type AnalyzeCampaignAttributes = { campaign_stats?: Record; tracking_summary?: string; recipient_segments?: string; }; /** Attributes for send time optimization. */ export type OptimizeSendTimesAttributes = { recipient_emails: string[]; timezone_data?: Record; campaign_stats?: Record; }; /** Attributes for optimizing subject lines with AI. */ export type OptimizeSubjectsAttributes = { original_subject: string; campaign_description: string; audience_description: string; }; /** Attributes for exporting campaign data. */ export type ExportCampaignAttributes = { workspace_id: string; format?: string; export_type?: string; }; /** Attributes for creating a template via admin API. */ export type CreateTemplateAttributes = { name: string; type?: string; subject_template?: string; body_template?: string; body_mjml?: string; ai_instructions?: string; variables?: string[]; template_format?: string; }; /** Attributes for updating a template via admin API. */ export type UpdateTemplateAttributes = { name?: string; subject_template?: string; body_template?: string; ai_instructions?: string; variables?: string[]; [key: string]: unknown; }; /** Attributes for updating a generated email via admin API. */ export type UpdateGeneratedEmailAttributes = { subject?: string; body?: string; [key: string]: unknown; }; /** Attributes for creating a sequence via admin API. */ export type CreateSequenceAttributes = { workspace_id: string; name: string; [key: string]: unknown; }; /** Attributes for updating a sequence via admin API (PATCH semantics). */ export type UpdateSequenceAttributes = { name?: string; [key: string]: unknown; }; /** Attributes for creating a sequence step via admin API. */ export type CreateSequenceStepAttributes = { sequence_id: string; [key: string]: unknown; }; /** Attributes for updating a sequence step via admin API (PATCH semantics). */ export type UpdateSequenceStepAttributes = { [key: string]: unknown; }; /** Result of a stateless MJML compilation. */ export interface MjmlCompileResult { /** Compiled HTML output. Empty string if errors present. */ html: string; /** Variable names extracted from {{variable}} patterns. */ variables: string[]; /** MJML parser errors. */ errors: string[]; } /** @public Result of an AI-powered campaign performance analysis. */ export type CampaignAnalysisResult = Record; /** Attributes for creating a social campaign via admin API. */ export type CreateSocialCampaignAttributes = { name: string; content_brief?: string; target_platforms?: string[]; media_urls?: string[]; seo_keywords?: string[]; brand_identity_id?: string; }; /** Attributes for updating a social campaign via admin API (PATCH semantics). */ export type UpdateSocialCampaignAttributes = { name?: string; content_brief?: string; target_platforms?: string[]; media_urls?: string[]; seo_keywords?: string[]; brand_identity_id?: string; }; /** Attributes for scheduling a social campaign. */ export type ScheduleSocialCampaignAttributes = { scheduled_at: string; }; /** Attributes for adapting a social campaign's master copy for target platforms. */ export type AdaptForPlatformsAttributes = { campaign_id: string; workspace_id: string; social_account_id: string; }; /** Attributes for generating master copy for a social campaign. */ export type GenerateMasterCopyAttributes = { campaign_id: string; workspace_id: string; }; /** Attributes for previewing platform adaptations without creating posts. */ export type PreviewAdaptationsAttributes = { campaign_id: string; workspace_id: string; }; export declare function createCampaignsNamespace(rb: RequestBuilder): { /** * Campaigns -- email campaign orchestration. * * A campaign represents a single bulk email send (or a scheduled future * send) targeting a list of recipients. Campaigns can be created from * templates, analysed with AI for performance insights, have their send * times AI-optimised, and spawn follow-up campaigns automatically. */ campaigns: { /** * Fetch a single campaign by its unique ID. * * @param id - The unique identifier of the campaign to retrieve. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching {@link Campaign}. */ get: (id: string, options?: RequestOptions) => Promise; /** * List campaigns for a workspace with optional pagination. * * @param workspaceId - The ID of the workspace whose campaigns to list. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to an array of {@link Campaign} records. */ listByWorkspace: (workspaceId: string, options?: { page?: number; pageSize?: number; } & RequestOptions) => Promise; /** * Create a new email campaign. * * @param attributes - Campaign attributes including `workspace_id`, `name`, and `template_id`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created {@link Campaign}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const campaign = await admin.campaigns.campaigns.create({ * workspace_id: 'ws_abc123', * name: 'Q2 Product Update', * subject: 'What\'s new in Q2 2026', * template_id: 'tmpl_product_update', * sender_profile_id: 'sp_noreply', * }); * console.log(campaign.id); // 'camp_...' * ``` */ create: (attributes: CreateCampaignAttributes, options?: RequestOptions) => Promise; /** * Update an existing campaign's attributes (PATCH semantics). * * @param id - The unique identifier of the campaign to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link Campaign}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const campaign = await admin.campaigns.campaigns.update('camp_abc123', { * subject: 'Revised subject line for A/B test', * scheduled_at: '2026-04-01T09:00:00Z', * }); * ``` */ update: (id: string, attributes: UpdateCampaignAttributes, options?: RequestOptions) => Promise; /** * Trigger immediate delivery of a campaign to all recipients. * * @param id - The unique identifier of the campaign to send. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link Campaign}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * await admin.campaigns.campaigns.send('camp_abc123'); * console.log('Campaign queued for delivery'); * ``` */ send: (id: string, attributes?: SendCampaignAttributes, options?: RequestOptions) => Promise; /** * Request an AI-powered performance analysis of a sent campaign. * * @param id - The unique identifier of the campaign to analyse. * @param options - Optional request-level overrides. * @returns A promise that resolves to the AI-generated analysis report payload. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const report = await admin.campaigns.campaigns.analyze('camp_abc123'); * console.log(report); // AI narrative with metrics breakdown * ``` */ analyze: (id: string, attributes?: AnalyzeCampaignAttributes, options?: RequestOptions) => Promise; /** * Use AI to determine the optimal send time for a campaign. * * @param id - The unique identifier of the campaign to optimise. * @param options - Optional request-level overrides. * @returns A promise that resolves to the optimisation result payload. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.campaigns.campaigns.optimizeSendTimes('camp_abc123'); * // result contains recommended_send_at and supporting rationale * console.log(result); * ``` */ optimizeSendTimes: (id: string, attributes?: OptimizeSendTimesAttributes, options?: RequestOptions) => Promise; /** * Create a follow-up campaign targeted at non-engaged recipients. * * @param id - The ID of the original campaign to follow up on. * @param attributes - Additional attributes for the follow-up campaign. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created follow-up {@link Campaign}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * // Create a follow-up 3 days after the original send * const followUp = await admin.campaigns.campaigns.createFollowup( * 'camp_abc123', * { * subject: 'Did you miss our Spring Sale?', * scheduled_at: '2026-04-04T09:00:00Z', * }, * ); * console.log('Follow-up campaign:', followUp); * ``` */ createFollowup: (id: string, attributes: CreateFollowupCampaignAttributes, options?: RequestOptions) => Promise; /** * Import recipients from a CSV file stored in platform storage. * * @param id - The campaign ID to import recipients into. * @param attributes - Import configuration including `csv_storage_key` and `workspace_id`. * @param options - Optional request-level overrides. * @returns A promise resolving to the import job details. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.campaigns.campaigns.importRecipients('camp_abc', { * csv_storage_key: 'uploads/recipients.csv', * workspace_id: 'ws_abc123', * }); * console.log(result.job_id); * ``` */ importRecipients: (id: string, attributes: { csv_storage_key: string; column_mapping?: Record; workspace_id: string; }, options?: RequestOptions) => Promise>; /** * Trigger AI-powered email generation for all campaign recipients. * * @param id - The campaign ID to generate emails for. * @param workspaceId - The workspace ID. * @param options - Optional request-level overrides. * @returns A promise resolving to the generation job details. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.campaigns.campaigns.generateEmails('camp_abc', 'ws_abc123'); * console.log(result.job_id); * ``` */ generateEmails: (id: string, workspaceId: string, options?: RequestOptions) => Promise>; /** * Generate A/B test subject line variants using AI. * * @param id - The campaign ID to optimize subjects for. * @param attributes - Subject optimization parameters. * @param options - Optional request-level overrides. * @returns A promise resolving to the optimization result with variant suggestions. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.campaigns.campaigns.optimizeSubjects('camp_abc', { * original_subject: 'Spring Sale!', * campaign_description: 'Seasonal discount promotion', * audience_description: 'Existing customers aged 25-45', * }); * ``` */ optimizeSubjects: (id: string, attributes: OptimizeSubjectsAttributes, options?: RequestOptions) => Promise>; /** * Export campaign data (recipients, results, or analytics) as CSV. * * @param id - The campaign ID to export. * @param attributes - Export configuration including `workspace_id`. * @param options - Optional request-level overrides. * @returns A promise resolving to the export job details. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.campaigns.campaigns.export('camp_abc', { * workspace_id: 'ws_abc123', * export_type: 'recipients', * }); * console.log(result.job_id); * ``` */ export: (id: string, attributes: ExportCampaignAttributes, options?: RequestOptions) => Promise>; /** * Permanently delete a campaign. * * @param id - The unique identifier of the campaign to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; }; /** * Templates -- reusable MJML-based email layout templates with versioning. * * Templates define the HTML and/or plain-text structure of an email. * They support live MJML compilation, publish/unpublish lifecycle, * archive/restore, rollback, and immutable version snapshots. */ templates: { /** * Fetch a single template by its unique ID. * * @param id - The unique identifier of the template to retrieve. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching {@link EmailMarketingTemplate}. */ get: (id: string, options?: RequestOptions) => Promise; /** * List all email templates for a workspace with optional pagination. * * @param workspaceId - The ID of the workspace whose templates to list. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to an array of {@link EmailMarketingTemplate} records. */ listByWorkspace: (workspaceId: string, options?: { page?: number; pageSize?: number; } & RequestOptions) => Promise; /** * Create a new email template. * * @param attributes - Template attributes including `name`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created {@link EmailMarketingTemplate}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const template = await admin.campaigns.templates.create({ * name: "Welcome Email", * body_mjml: "...", * }); * ``` */ create: (attributes: CreateTemplateAttributes, options?: RequestOptions) => Promise; /** * Update an existing template's attributes (PATCH semantics). * * @param id - The unique identifier of the template to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingTemplate}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const updated = await admin.campaigns.templates.update("tmpl_123", { name: "New Name" }); * ``` */ update: (id: string, attributes: UpdateTemplateAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a template. * * @param id - The unique identifier of the template to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * Publish a template, creating an immutable version snapshot. * * @param id - The unique identifier of the template to publish. * @param options - Optional request-level overrides. * @returns A promise that resolves to the published {@link EmailMarketingTemplate}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const template = await admin.campaigns.templates.publish("tmpl_123"); * console.log(template.current_version); // 1 * ``` */ publish: (id: string, options?: RequestOptions) => Promise; /** * Unpublish a template, reverting it to draft state. * * @param id - The unique identifier of the template to unpublish. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingTemplate}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * await admin.campaigns.templates.unpublish("tmpl_123"); * ``` */ unpublish: (id: string, options?: RequestOptions) => Promise; /** * Archive a template, removing it from active listings. * * @param id - The unique identifier of the template to archive. * @param options - Optional request-level overrides. * @returns A promise that resolves to the archived {@link EmailMarketingTemplate}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * await admin.campaigns.templates.archive("tmpl_123"); * ``` */ archive: (id: string, options?: RequestOptions) => Promise; /** * Restore an archived template back to active state. * * @param id - The unique identifier of the template to restore. * @param options - Optional request-level overrides. * @returns A promise that resolves to the restored {@link EmailMarketingTemplate}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * await admin.campaigns.templates.restore("tmpl_123"); * ``` */ restore: (id: string, options?: RequestOptions) => Promise; /** * Roll back a template's MJML source to a previous version. * * Does NOT auto-publish. Call `publish` after reviewing the restored content. * * @param id - The unique identifier of the template to roll back. * @param versionNumber - The version number to restore from. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingTemplate}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const template = await admin.campaigns.templates.rollback("tmpl_123", 2); * ``` */ rollback: (id: string, versionNumber: number, options?: RequestOptions) => Promise; /** * Render a saved template with variable overrides for preview. * * @param id - The unique identifier of the template to preview. * @param variables - Key/value map of variable substitutions. * @param options - Optional request-level overrides. * @returns A promise that resolves to the preview result. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const { preview_html } = await admin.campaigns.templates.preview("tmpl_123", { first_name: "Jane" }); * ``` */ preview: (id: string, variables: Record, options?: RequestOptions) => Promise; /** * Stateless MJML compilation. Does not save. Use for live preview in builder UI. * * @param mjml - Raw MJML source string to compile. * @param options - Optional request-level overrides. * @returns A promise resolving to the compilation result including HTML, variables, and errors. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.campaigns.templates.compile("..."); * console.log(result.html, result.variables); * ``` */ compile: (mjml: string, options?: RequestOptions) => Promise; /** * List all version snapshots for a template, ordered by version_number descending. * * @param templateId - The ID of the template whose versions to list. * @param options - Optional request-level overrides. * @returns A promise resolving to an array of {@link EmailTemplateVersion} records. */ versions: (templateId: string, options?: RequestOptions) => Promise; /** * Fetch a specific template version by template ID and version number. * * @param templateId - The ID of the template. * @param versionNumber - The version number to fetch. * @param options - Optional request-level overrides. * @returns A promise resolving to the full {@link EmailTemplateVersion}. */ getVersion: (templateId: string, versionNumber: number, options?: RequestOptions) => Promise; }; /** * Generated Emails -- AI-personalised email drafts awaiting human review. * * When a campaign uses AI personalisation, the platform generates an * individual email draft for each recipient. These drafts sit in a review * queue until a human approves or rejects them. */ generatedEmails: { /** * Fetch a single AI-generated email draft by its unique ID. * * @param id - The unique identifier of the generated email to retrieve. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching {@link EmailMarketingGeneratedEmail}. */ get: (id: string, options?: RequestOptions) => Promise; /** * Update an AI-generated email draft before approval. * * @param id - The unique identifier of the generated email to update. * @param attributes - Key/value map of attributes to change (e.g. `subject`, `body`). * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingGeneratedEmail}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const email = await admin.campaigns.generatedEmails.update('gen_abc123', { * subject: 'Personalised just for you, Jane', * body_html: '

Hi Jane, ...

', * }); * ``` */ update: (id: string, attributes: UpdateGeneratedEmailAttributes, options?: RequestOptions) => Promise; /** * Approve a generated email draft and move it to the sending queue. * * @param id - The unique identifier of the generated email to approve. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingGeneratedEmail}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const approved = await admin.campaigns.generatedEmails.approve('gen_abc123'); * console.log(approved.attributes.status); // 'queued' * ``` */ approve: (id: string, options?: RequestOptions) => Promise; /** * Reject an AI-generated email draft. The email will not be sent. * * @param id - The unique identifier of the generated email to reject. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingGeneratedEmail}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const rejected = await admin.campaigns.generatedEmails.reject('gen_abc123'); * console.log(rejected.attributes.status); // 'rejected' * ``` */ reject: (id: string, options?: RequestOptions) => Promise; /** * Schedule a generated email for delivery at a specific time. * * @param id - The unique identifier of the generated email to schedule. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingGeneratedEmail}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const scheduled = await admin.campaigns.generatedEmails.schedule('gen_abc123'); * ``` */ schedule: (id: string, options?: RequestOptions) => Promise; /** * List all generated emails for a specific campaign. * * @param campaignId - The ID of the campaign whose generated emails to list. * @param options - Optional pagination controls and request-level overrides. * @returns A promise resolving to an array of {@link EmailMarketingGeneratedEmail}. */ listByCampaign: (campaignId: string, options?: { page?: number; pageSize?: number; } & RequestOptions) => Promise; }; /** * Sequences -- multi-step drip campaign automation. * * A sequence is a timed series of emails automatically sent to enrolled * contacts over days or weeks. Each step in the sequence has a delay and * references a template or inline content. */ sequences: { /** * Fetch a single sequence by its unique ID. * * @param id - The unique identifier of the sequence to retrieve. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching {@link EmailMarketingSequence}. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create a new email sequence. * * @param attributes - Sequence attributes including `workspace_id` and `name`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created {@link EmailMarketingSequence}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const sequence = await admin.campaigns.sequences.create({ * workspace_id: 'ws_abc123', * name: 'New User Onboarding', * }); * ``` */ create: (attributes: CreateSequenceAttributes, options?: RequestOptions) => Promise; /** * Update an existing sequence's attributes (PATCH semantics). * * @param id - The unique identifier of the sequence to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingSequence}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const updated = await admin.campaigns.sequences.update('seq_abc', { name: 'Revised Drip' }); * ``` */ update: (id: string, attributes: UpdateSequenceAttributes, options?: RequestOptions) => Promise; /** * List all sequences for a workspace with optional pagination. * * @param workspaceId - The ID of the workspace whose sequences to list. * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to an array of {@link EmailMarketingSequence} records. */ listByWorkspace: (workspaceId: string, options?: { page?: number; pageSize?: number; } & RequestOptions) => Promise; /** * Permanently delete a sequence. * * @param id - The unique identifier of the sequence to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * Activate a sequence to start delivering emails to enrolled contacts. * * @param id - The unique identifier of the sequence to activate. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingSequence}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const active = await admin.campaigns.sequences.activate('seq_abc123'); * console.log(active.attributes.status); // 'active' * ``` */ activate: (id: string, options?: RequestOptions) => Promise; /** * Pause a running sequence, suspending all pending deliveries. * * @param id - The unique identifier of the sequence to pause. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingSequence}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const paused = await admin.campaigns.sequences.pause('seq_abc123'); * console.log(paused.attributes.status); // 'paused' * ``` */ pause: (id: string, options?: RequestOptions) => Promise; /** * Mark a sequence as complete, finalizing all deliveries. * * @param id - The unique identifier of the sequence to complete. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingSequence}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const completed = await admin.campaigns.sequences.complete('seq_abc123'); * ``` */ complete: (id: string, options?: RequestOptions) => Promise; /** * Resume a paused sequence from where it left off. * * @param id - The unique identifier of the sequence to resume. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link EmailMarketingSequence}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const sequence = await admin.campaigns.sequences.resume('seq_abc123'); * console.log(sequence); // sequence with status: 'active' * ``` */ resume: (id: string, options?: RequestOptions) => Promise; }; /** * Recipients -- campaign audience members. * * Each recipient represents one email address on a campaign's send list, * with optional merge fields for personalisation. */ recipients: { /** * Fetch a single recipient by its unique ID. * * @param id - The unique identifier of the recipient. * @param options - Optional request-level overrides. * @returns A promise resolving to the {@link EmailMarketingRecipient}. */ get: (id: string, options?: RequestOptions) => Promise; /** * List all recipients for a specific campaign. * * @param campaignId - The ID of the campaign whose recipients to list. * @param options - Optional pagination controls and request-level overrides. * @returns A promise resolving to an array of {@link EmailMarketingRecipient} records. */ listByCampaign: (campaignId: string, options?: { page?: number; pageSize?: number; } & RequestOptions) => Promise; }; /** * Sequence Steps -- individual steps within a drip sequence. * * Each step defines a timed email delivery within a sequence, with a * delay offset and template or inline content. */ sequenceSteps: { /** * Fetch a single sequence step by its unique ID. * * @param id - The unique identifier of the sequence step. * @param options - Optional request-level overrides. * @returns A promise resolving to the {@link EmailMarketingSequenceStep}. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create a new step within a sequence. * * @param attributes - Step attributes including `sequence_id`. * @param options - Optional request-level overrides. * @returns A promise resolving to the newly created {@link EmailMarketingSequenceStep}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const step = await admin.campaigns.sequenceSteps.create({ * sequence_id: 'seq_abc123', * delay_days: 3, * template_id: 'tmpl_reminder', * }); * ``` */ create: (attributes: CreateSequenceStepAttributes, options?: RequestOptions) => Promise; /** * Update an existing sequence step's attributes (PATCH semantics). * * @param id - The unique identifier of the sequence step to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise resolving to the updated {@link EmailMarketingSequenceStep}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const step = await admin.campaigns.sequenceSteps.update('step_abc123', { * delay_days: 5, * }); * ``` */ update: (id: string, attributes: UpdateSequenceStepAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a sequence step. * * @param id - The unique identifier of the sequence step to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * List all steps in a specific sequence. * * @param sequenceId - The ID of the sequence whose steps to list. * @param options - Optional pagination controls and request-level overrides. * @returns A promise resolving to an array of {@link EmailMarketingSequenceStep} records. */ listBySequence: (sequenceId: string, options?: { page?: number; pageSize?: number; } & RequestOptions) => Promise; }; /** * Social Campaigns -- AI-powered social media campaign management. * * A social campaign takes a content brief, generates master copy via AI, * adapts it for each target platform (Facebook, Instagram, LinkedIn, etc.) * with appropriate tone and constraints, and creates individual SocialPost * records for scheduling and publishing. */ socialCampaigns: { /** * Fetch a single social campaign by its unique ID. * * @param id - The unique identifier of the social campaign to retrieve. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching {@link SocialCampaign}. */ get: (id: string, options?: RequestOptions) => Promise; /** * List all social campaigns with optional pagination. * * @param options - Optional pagination controls and request-level overrides. * @returns A promise that resolves to an array of {@link SocialCampaign} records. */ list: (options?: { page?: number; pageSize?: number; } & RequestOptions) => Promise; /** * Create a new social campaign. * * The campaign starts in `draft` status. Use {@link generateMasterCopy} * to produce AI-generated content from the content brief, then * {@link adaptForPlatforms} to create platform-specific posts. * * @param attributes - Social campaign attributes including `name`. * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created {@link SocialCampaign}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const campaign = await admin.campaigns.socialCampaigns.create({ * name: 'Product Launch', * content_brief: 'Exciting new features for Q2', * target_platforms: ['instagram', 'linkedin'], * }); * ``` */ create: (attributes: CreateSocialCampaignAttributes, options?: RequestOptions) => Promise; /** * Update an existing social campaign's attributes (PATCH semantics). * * @param id - The unique identifier of the social campaign to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link SocialCampaign}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const updated = await admin.campaigns.socialCampaigns.update('sc_abc123', { * content_brief: 'Updated brief with new messaging', * target_platforms: ['instagram', 'linkedin', 'twitter'], * }); * ``` */ update: (id: string, attributes: UpdateSocialCampaignAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a social campaign. * * @param id - The unique identifier of the social campaign to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves to `true` on successful deletion. */ delete: (id: string, options?: RequestOptions) => Promise; /** * Schedule a social campaign for future publishing. * * Transitions the campaign to `scheduled` status with the given timestamp. * * @param id - The unique identifier of the social campaign to schedule. * @param attributes - Must include `scheduled_at` (ISO 8601 datetime). * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link SocialCampaign}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const scheduled = await admin.campaigns.socialCampaigns.schedule('sc_abc123', { * scheduled_at: '2026-04-01T09:00:00Z', * }); * ``` */ schedule: (id: string, attributes: ScheduleSocialCampaignAttributes, options?: RequestOptions) => Promise; /** * Cancel a social campaign. * * Only campaigns in `draft`, `generating`, `review`, or `scheduled` * status can be cancelled. * * @param id - The unique identifier of the social campaign to cancel. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated {@link SocialCampaign}. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const cancelled = await admin.campaigns.socialCampaigns.cancel('sc_abc123'); * console.log(cancelled.attributes.status); // 'cancelled' * ``` */ cancel: (id: string, options?: RequestOptions) => Promise; /** * Generate master copy from the campaign's content brief using AI. * * Transitions the campaign to `review` status on success. The generated * master copy is stored on the campaign and can then be adapted for * individual platforms via {@link adaptForPlatforms}. * * @param id - The unique identifier of the social campaign. * @param attributes - Must include `campaign_id` and `workspace_id`. * @param options - Optional request-level overrides. * @returns A promise resolving to the generation result including master copy text. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.campaigns.socialCampaigns.generateMasterCopy('sc_abc', { * campaign_id: 'sc_abc', * workspace_id: 'ws_abc123', * }); * console.log(result.master_copy); * ``` */ generateMasterCopy: (id: string, attributes: GenerateMasterCopyAttributes, options?: RequestOptions) => Promise>; /** * Adapt the campaign's master copy for each target platform. * * Creates individual SocialPost draft records for each platform with * platform-appropriate tone, length, and formatting. * * @param id - The unique identifier of the social campaign. * @param attributes - Must include `campaign_id`, `workspace_id`, and `social_account_id`. * @param options - Optional request-level overrides. * @returns A promise resolving to the adaptation result with post creation counts. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.campaigns.socialCampaigns.adaptForPlatforms('sc_abc', { * campaign_id: 'sc_abc', * workspace_id: 'ws_abc123', * social_account_id: 'sa_xyz', * }); * console.log(result.posts_created, result.failures); * ``` */ adaptForPlatforms: (id: string, attributes: AdaptForPlatformsAttributes, options?: RequestOptions) => Promise>; /** * Preview adapted copy for each target platform without creating posts. * * Useful for reviewing AI-generated adaptations before committing them * as SocialPost records. * * @param id - The unique identifier of the social campaign. * @param attributes - Must include `campaign_id` and `workspace_id`. * @param options - Optional request-level overrides. * @returns A promise resolving to preview adaptations per platform. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.campaigns.socialCampaigns.previewAdaptations('sc_abc', { * campaign_id: 'sc_abc', * workspace_id: 'ws_abc123', * }); * console.log(result.adaptations); // [{platform: 'instagram', content: '...'}, ...] * ``` */ previewAdaptations: (id: string, attributes: PreviewAdaptationsAttributes, options?: RequestOptions) => Promise>; }; }; //# sourceMappingURL=campaigns.d.ts.map