Skip to main content
POST
Sync Templates

Overview

Synchronize template statuses from Meta (WhatsApp Business API provider). Updates all pending templates with their current approval status.
This endpoint only syncs templates with PENDING status. It fetches the latest status from Meta and updates your local database.

How It Works

  1. Checks if workspace has any templates with status: PENDING
  2. Fetches all templates from Meta’s API
  3. Matches templates by provider_id
  4. Updates local template statuses (APPROVED, REJECTED, etc.)

Response

Success (200 OK)

No Pending Templates (404)

Sync Failed (500)


When to Use

After Template Creation

Sync after creating templates to check if they’ve been approved

After Template Update

Check status after updating existing templates

Periodic Checks

Run periodic syncs (e.g., every 30 minutes) for pending templates

Before Sending Messages

Ensure templates are approved before attempting to send

Status Transitions


Example Usage

cURL

JavaScript

Python


Workflow Example

1

Create Template

Create a new template via POST /templatesResponse: status: "PENDING"
2

Wait for Review

Meta typically reviews templates within 5-30 minutes
3

Sync Status

Call sync endpoint to update status
4

Check Result

Use GET /templates to verify new statusPossible results: APPROVED or REJECTED

Best Practices

Set up a background job to sync every 30 minutes:
Check for pending templates before syncing:

Common Issues

No Pending TemplatesIf you receive a 404 error, it means there are no templates with PENDING status to sync. This is not an error condition.
Sync Failed (500)This usually indicates:
  • Channel connection issues
  • Meta API temporarily unavailable
  • Invalid channel credentials
Solution: Wait a few minutes and try again, or check channel connection status.

Pro Tip: Combine sync with webhooks (if available) to get real-time template status updates instead of polling.

Authorizations

Authorization
string
header
required

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

Path Parameters

workspace
string<uuid>
required

ID of the workspace.

Response

data
object
required