CRADמפתחים
עברית

Manage WhatsApp templates, profile and images

A controlled-pilot workflow for your backend, with explicit grants, separate image identities and recovery before retry.

לפני שימוש חי — בדקו יכולות פרוסות, הרשאות ומוכנות של החיבור שלכם.

בדקו את היכולות הפרוסות, הרשאות המפתח ומוכנות העסק בסביבה שלכם. דוגמאות HTTP נלכדו בבדיקות מבודדות; הסימון local-unreleased שלהן אינו אומר שה־API אינו פועל, ואינו מאשר את החיבור שלכם. במסלול הלקוח מאמתים טלפון בתבנית WhatsApp שהעסק הגדיר; SMS אינו נתמך. רישום בידי אדמין מורשה הוא פעולה נפרדת ללא קוד.

Discover support and request only the needed grants

These operations are available in a controlled pilot. Access requires explicitly granted scopes and a ready Meta Cloud API connection. Template approval, sender activation and successful delivery must be verified separately. Read GET management and GET messaging-capabilities for your own business. installed, providerSupported, granted and ready are separate facts; ready:null and readiness_unknown mean unknown. Discovery does not probe Meta or grant permission.

Keep the Management bearer on your server and do not send an Origin header. CRAD derives the business and current provider binding from that credential. Do not ask end users for WABA IDs, phone-number IDs or provider tokens. The current management slice supports Meta Cloud API, including supported coexistence connections. OpenWA and Twilio are not promised equivalent template/profile support.

A calendar key with appointments:read receives a compatible scope list from GET /v1/management. Read GET /v1/management/messaging-capabilities for its whatsapp-templates:read, whatsapp-templates:write, whatsapp-profile:read and whatsapp-profile:write grants. Use the same business key for both reads. Meta approval, customer permission and sender readiness are checked separately.

External messaging workspaces can use these operations independently of appointment booking. Check the current grants for the authenticated business.

WorkApplication permissions
Read managed templateswhatsapp-templates:read
Create/edit/delete, recover template operations and upload sampleswhatsapp-templates:read + whatsapp-templates:write
Read the business profilewhatsapp-profile:read
Update profile/photo, recover profile operations and upload photoswhatsapp-profile:read + whatsapp-profile:write
Read/send conversationsconversations:read + conversations:send; control writes additionally need conversations:write
Download a retained message attachmentconversations:read + conversations:media:read

Create an owned template, then inspect its approval

Use whatsapp-templates for API-owned resources. template-requests remains a request for CRAD staff assistance; it does not submit to Meta. A conversation’s templates endpoint is the approved sending catalogue, not the editable registry. The same WABA does not grant access to another business’s managed templates or allow editing shared starter templates.

POST the definition with a saved Idempotency-Key UUID. Names receive a tenant-specific provider prefix: retain the returned CRAD templateId and actual name. GET the resource to inspect current approval and save its quoted ETag. PATCH a full definition or DELETE one owned language variant with a new intended operation UUID and the current If-Match. Name, language and category are immutable after creation.

The bounded contract supports Utility and Marketing bodies with contiguous positional variables and one example per variable, a fixed text or image header, fixed footer and up to three QUICK_REPLY labels. Authentication uses its dedicated COPY_CODE definition. Check the current request schema for exact bounds. Meta may refuse or recategorize a submission and applies its own review/edit eligibility rules.

For creation and editing, buttons is an ordered array of strings, not objects: at most three distinct nonblank labels, each at most 25 Unicode code points, without controls or placeholders. examples is an array of strings with exactly one example for each body variable, in positional order. A body containing {{1}} and {{2}} needs two examples. With no variables, examples can be omitted or []. Unknown properties are rejected with INVALID_REQUEST; do not copy provider components or sending-catalogue fields into this request.

In list and detail reads, status is the current Meta status (APPROVED, PENDING, REJECTED, PAUSED and so on) whenever the template exists at Meta; providerStatus repeats it and providerCheckedAt is the time of that check. submissionStatus keeps the result CRAD stored when the template was submitted, so a template approved after submission shows status:APPROVED beside submissionStatus:PENDING. When Meta has no such template, providerStatus is null and status is the stored state of a template that never reached Meta (LOCAL_PENDING, LOCAL_REJECTED, LOCAL_UNKNOWN), DELETED for a deleted one, or UNKNOWN when CRAD holds a Meta ID that Meta no longer lists. A failed or incomplete provider read returns 503 rather than presenting a stored status as current approval. One list call is enough; no per-template refresh loop is needed.

Provider approval describes the provider resource, not necessarily the returned local definition or latest attempted edit. For example, a rejected edit can leave submissionStatus:LOCAL_REJECTED beside status:APPROVED for the older provider content. Re-read the approved sending catalogue before selecting content to send. A status read does not resolve an uncertain create operation or turn its missing provider identity into a confirmed outcome; use the matching operation recovery workflow.

A succeeded operation means Meta accepted the mutation, not that the template is approved or a message was sent. Inspect providerStatus and re-read the sending catalogue before sending. The local new-template reservation limit is ten per business per minute; it is an abuse-control limit, not a purchased allowance.

Creation request shape — replace sample values and persist your Idempotency-Key
{
  "name": "order_confirmation",
  "language": "en_US",
  "category": "UTILITY",
  "body": "Hello {{1}}, please confirm order {{2}}.",
  "examples": [
    "Example customer",
    "ORDER-123"
  ],
  "buttons": [
    "Confirm order",
    "Other inquiries"
  ]
}

Keep management images and message images separate

Management images accept one nonempty PNG/JPEG file up to 5 MiB, with a checked signature and MIME. Persist the UUID, filename, purpose and original bytes before dispatch. A ready management upload has a conservative CRAD lifetime of 24 hours and remains bound to its business, integration, connection and purpose. Uploading alone sends no message and changes no profile.

A conversation image upload can prepare an approved template header outside the customer-service window only with purpose=template_header. Normal attachment uploads and free-form text/media sends retain their current window rules. This exception does not waive consent, approval, human control or connection checks.

UseUpload and returned identity
Template creation sample or profile photoPOST whatsapp-images with file and purpose=template_header or business_profile. result.upload.uploadId is used as header.uploadId or imageUploadId for that matching purpose.
Image in an actual template messagePOST conversations/{conversationId}/uploads. result.current.mediaId is used as template.headerImageUploadId in that same conversation. An eligible still-valid ordinary JPEG/PNG conversation upload may also be reused.

Update only the intended business-profile fields

GET whatsapp-profile, preserve its quoted ETag, then PATCH only changed fields with If-Match and a persisted Idempotency-Key UUID. Supported fields are about, address, description, email, websites, vertical and a ready business_profile imageUploadId. Omitted fields are preserved. Follow the schema’s clearing rules and bounds; arbitrary picture URLs and raw provider handles are rejected.

The business-profile photo is separate from a template header. The ETag describes observed data, not a Meta transaction lock against changes through other tools. An unresolved write blocks another profile write on that connection until reconciled or explicitly reviewed.

Send with the approved catalogue and the correct image ID

Use the existing contact recording → open-contact → read thread → explicit human control → approved catalogue → send sequence. Persist the original operation UUID, body and quoted thread ETag. A catalogue headerFormat:IMAGE requires template.headerImageUploadId from the conversation image workflow; templates without that header forbid it.

Utility and Marketing templates with one to three ordered quickReplyButtons require exactly that many distinct quickReplyPayloads, each 1–128 URL-safe ASCII characters. Bind opaque action tokens to the intended business, recipient, order/revision and expiry. HMAC-verify incoming callbacks and apply business changes atomically; message statuses are not order confirmations. Marketing consent remains separate.

Keep the three shapes separate: creation definition.buttons contains label strings; the approved sending catalogue returns quickReplyButtons objects with index, type and text; sending uses template.quickReplyPayloads containing your opaque action-token strings in catalogue order. Neither catalogue objects nor send payloads belong in the creation definition.

OTP is optional. Authentication COPY_CODE accepts one 1–15 ASCII alphanumeric code; your application generates, stores, expires and verifies it and limits attempts. A template and any printed expiry footer do not implement that lifecycle.

Approve the receiver separately from registering its secret

In CRAD owner settings, the actual business owner can review and save the exact HTTPS callback destination for the integration. This is a native signed-in owner action, not a new public server-key approval endpoint. Saving the destination neither registers a subscription nor proves delivery.

Your backend then uses the existing messaging-webhook PUT with its signingSecret and explicit enabled state. Keep the API key and webhook secret separate. Receive events using the HMAC, durable eventId deduplication, acknowledgement and retry rules in the notifications guide. Read access needs conversations:read; configuration/retry additionally require conversations:write. A rotated/revoked key or changed destination requires deliberate reconfiguration.

Recover uncertainty without repeating a provider write

Save the canonical request and UUID before dispatch. After a timeout use the matching operation lookup. Exact replay returns the saved attempt; changed input under that UUID is refused. pending, unknown and a momentary not_found do not authorize a new UUID or automatic resend. Reconciliation POSTs are bodyless provider reads, not repeated writes.

Template reconciliation can remain unknown. A text-only profile update can be checked against provider state. An uncertain photo cannot be proved from a returned picture URL and needs OWNER_REVIEW_REQUIRED handling. The authenticated owner can review that uncertainty in CRAD without making a provider call or asserting it succeeded; the server key cannot review itself. The saved operation becomes reviewed. Fetch a fresh profile before deliberately choosing a new update; replaying the old UUID never repeats its write.

Stop on revoked scope or access. Treat MEDIA_UNAVAILABLE as expired, foreign, wrong-purpose or changed-binding media rather than permission to bypass validation. For 412 read again and review; for 429 respect Retry-After. An accepted send is not delivered. Verify the intended sender, provider approval, actual delivery, callbacks and failure recovery with an authorized test recipient before launch.

The portable handoff includes MESSAGING_CONNECTIVITY_DEVELOPER_GUIDE.md for this management slice and ORDER_CONFIRMATION_INTEGRATION.md for the order/callback flow. Neither the files nor recorded isolated HTTP examples establish a deployed environment.