跳转到主要内容
POST
Create template

请求规范

  • 方法与路径: POST /apis/v1/social/messaging/whatsapp/templates
  • 可用状态: enabled
  • 请求 URL 模板: https://api.aisa.one/apis/v1/social/messaging/whatsapp/templates
  • connectionId: query; 必填
完整 OpenAPI 定义 有效请求声明(包括认证和引用的 schema):

费用与请求规则

此操作不另收费。

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

查询参数

connectionId
string
必填

Your messaging connection (msc_...), from GET /apis/v1/social/messaging/connections. On a request with a JSON body it may be sent as a top-level body member instead.

Pattern: ^msc_[0-9A-Za-z]+$

请求体

application/json
category
enum<string>
必填

Template category

可用选项:
AUTHENTICATION,
MARKETING,
UTILITY
language
string
必填

Template language code (e.g., en_US)

name
string
必填

Template name (lowercase, letters/numbers/underscores, must start with a letter)

Pattern: ^[a-z][a-z0-9_]*$
components
object[]

Template components (header, body, footer, buttons, carousel, limited_time_offer). Required for custom templates, omit when using library_template_name.

Minimum array length: 1
connectionId
string

The connection, when not sent as the connectionId query parameter.

Pattern: ^msc_[0-9A-Za-z]+$
library_template_body_inputs
object

Optional body customizations for library templates. Available options depend on the template (e.g., add_contact_number, add_learn_more_link, add_security_recommendation, add_track_package_link, code_expiration_minutes).

library_template_button_inputs
object[]

Optional button customizations for library templates. Each item specifies button type and configuration (e.g., URL, phone number, quick reply).

library_template_name
string

Name of a pre-built template from Meta's template library (e.g., "appointment_reminder", "auto_pay_reminder_1", "address_update"). When provided, the template is pre-approved by Meta with no review wait. Omit components when using this field.

message_send_ttl_seconds
integer

Delivery validity window in seconds: a message not delivered within it is dropped. Range by category:

  • AUTHENTICATION: 30 to 900. - UTILITY: 30 to 43200 (12h). - MARKETING: 43200 to 2592000 (30 days).

-1 (create only) keeps the 30-day default on AUTHENTICATION and UTILITY. Meta defaults to 600 for AUTHENTICATION and 30 days otherwise. If Meta later recategorises the template, it clears the TTL (read it back to check).

parameter_format
enum<string>

Variable style: POSITIONAL ({{1}}, the default) or NAMED ({{customer_name}}). Named templates provide examples via body_text_named_params / header_text_named_params. Inferred as NAMED when omitted but a named-params example is present.

可用选项:
POSITIONAL,
NAMED,
positional,
named

响应

Success

success
boolean
template
object