UNPKG

ws-cloud-api

Version:

WhatsApp Cloud API for NodeJS

104 lines (102 loc) 3.25 kB
type templateFields = 'id' | 'category' | 'components' | 'correct_category' | 'cta_url_link_tracking_opted_out' | 'language' | 'library_template_name' | 'message_send_ttl_seconds' | 'name' | 'previous_category' | 'quality_score' | 'rejected_reason' | 'status' | 'sub_category'; interface Templates { data: Template[]; paging: Paging; } interface Template { id: string; name: string; status: TemplateStatus; category: Category; language: string; message_send_ttl_seconds?: string; components: Component[]; sub_category?: string; previous_category?: PreviousCategory; allow_category_change?: boolean; } type CreateTemplate = Omit<Template, 'id' | 'status' | 'sub_category' | 'previous_category' | 'allow_category_change'>; type CreateTemplateResponse = Pick<Template, 'id' | 'status' | 'category'>; type Category = 'MARKETING' | 'UTILITY' | 'AUTHENTICATION'; type PreviousCategory = 'ISSUE_RESOLUTION' | 'APPOINTMENT_UPDATE' | 'MARKETING'; type TemplateStatus = 'APPROVED' | 'PENDING' | 'REJECTED'; interface Paging { cursors: Cursors; next: string; } interface Cursors { before: string; after: string; } type Component = TextHeader | MediaHeader | LocationHeader | Body | Footer | Buttons; type ExamplePositionalParams = string[]; type ExampleNamedParams = Array<{ param_name: string; example: string; }>; interface TextHeader { type: 'HEADER'; format: 'TEXT'; text: string; example?: { header_text: ExamplePositionalParams; } | { header_text_named_params: ExampleNamedParams; }; } interface MediaHeader { type: 'HEADER'; format: 'IMAGE' | 'VIDEO' | 'DOCUMENT'; example: { header_handle: string; }; } interface LocationHeader { type: 'HEADER'; format: 'LOCATION'; } interface Body { type: 'BODY'; text: string; example?: { body_text: ExamplePositionalParams | ExampleNamedParams; }; } interface Footer { type: 'FOOTER'; text: string; } interface CopyCodeButton { type: 'COPY_CODE'; example: string; } interface FlowButton { type: 'FLOW'; text: string; flow_id: string; flow_name: string; flow_json: Record<string, unknown>; flow_action?: 'navigate' | 'data_exchange'; navigate_screen?: string; } interface PhoneNumberButton { type: 'PHONE_NUMBER'; text: string; phone_number: string; } interface QuickReplyButton { type: 'QUICK_REPLY'; text: string; } interface UrlButton { type: 'URL'; text: string; url: string; example?: string[]; } type TemplateButton = CopyCodeButton | FlowButton | PhoneNumberButton | QuickReplyButton | UrlButton; interface Buttons { type: 'BUTTONS'; buttons: TemplateButton[]; } export type { Body as B, CreateTemplate as C, ExamplePositionalParams as E, Footer as F, LocationHeader as L, MediaHeader as M, PreviousCategory as P, QuickReplyButton as Q, Templates as T, UrlButton as U, Template as a, CreateTemplateResponse as b, Category as c, TemplateStatus as d, Paging as e, Cursors as f, Component as g, ExampleNamedParams as h, TextHeader as i, CopyCodeButton as j, FlowButton as k, PhoneNumberButton as l, TemplateButton as m, Buttons as n, templateFields as t };