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

Read campaign recipient outcomes

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

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

GET/v1/management/campaigns/{campaignId}/recipients

בדקו נמען יחיד ושמרו כוונת שליחה אחת

למסמך, ודאו תחילה שהוא מוכן עבור הלקוח המיועד. תור שנוצר בידי הצוות חייב כבר להיות CONFIRMED ועדיין להתאים לתור שנבדק. אישור בקשת לקוח במצב PENDING משתמש באישור האוטומטי של CRAD במקום בשליחה הנפרדת הזאת.

הציגו תצוגה מקדימה לפרופיל CRAD אמיתי יחיד, דרשו בדיוק את הנמען הזה וללא נמענים שדולגו, והציגו את נוסח ההודעה לפני אישור מפורש של הצוות. לפני POST /campaigns שמרו את ה־draft המדויק, ETag מסוג cp עם מירכאות ו־UUID אחד באירוע outbox ייחודי לכוונת השליחה. אישור ראשוני לתור צוות ייחודי לפי מרפאה, מטרה ותור; לשליחת מסמך מוסיפים גם sendIntentId מפורש.

פעולת ״שליחה חוזרת״ מכוונת של מסמך, אחרי שתוצאת השליחה הקודמת ידועה, יוצרת sendIntentId ו־UUID חדשים לאחר בדיקת גרסת הדוח השמורה והנמען. sendIntentId שייך ל־outbox של האתר, ולא לגוף בקשת CRAD. לחיצות מקבילות וניסיונות חוזרים של אותה פעולה שומרים את הכוונה וה־UUID המקוריים. מצב queued, פסק זמן, not_found או unknown אינם סיבה ליצור כוונה חדשה.

אחרי timeout השתמשו ב־/campaign-operations/{savedUuid}. תוצאת not_found אינה מבטלת בקשה שעדיין מתבצעת: שחזרו, או חזרו במפורש על אותו UUID/body/ETag; אל תייצרו UUID שליחה חדש ואל תשלחו שוב אוטומטית כשמצב השליחה unknown. עקבו אחר /campaigns/{campaignId}/recipients; מצב sent מציין קבלת ספק, ולא מסירה. הודעה שנכשלה או דוכאה אינה מבטלת תור או מסמך שנשמרו.

הרשאות לשלב הזה

campaigns:read

המשך לתהליך ההודעות של הקליניקה

Behavior

Reads retained campaign recipient history. unknown means an attempted send may have succeeded and must not be automatically retried. A deleted contact can have profileId:null. Follow nextCursor for remaining recipients; a partial page is not the full campaign.

Authentication

ManagementCredential

Credential rules

One server-only owner-issued wbm_ API key can carry both management and integration permissions. Additional permissions require an explicit owner-issued grant. GET /v1/management returns the management discovery view, which may be empty for a booking-only key. For credentials with appointments:read, this discovery view omits whatsapp-templates:read, whatsapp-templates:write, whatsapp-profile:read and whatsapp-profile:write to preserve calendar-client compatibility. Discover these grants through GET /v1/management/messaging-capabilities. Template/profile command authorization still uses the stored grants. Server-only owner-issued Management authority with explicit application permissions. Calling this API does not expand a credential's grants. contacts:read/write/block/sync/fields:read/fields:write are separate approvals for canonical business contacts; fields also require current typed owner grants. contacts:record remains contact recording/recovery only. These grants create no customer phone proof, booking authority, messaging consent or automatic synchronization. Hours/blocks retain their independent resource grants. booking-policy:read/write separately delegate whole-business booking settings, without schedule/provider grants; write requires read. They preserve existing appointments and create no duration-rewrite authority. Provider duration policy additionally requires explicit provider-booking-policy:read/write and exact current providerIds; booking-duration:rewrite is separately approved and does not itself grant policy read/write. Service catalogue requires explicit services:read/write, independent of provider/calendar/schedule resources; write requires read. These operations do not expand an existing credential's grants. Public presentation and reviewed service selection require explicit website-content:read/write; write requires read, independently from services:* and provider resources. Existing provider metadata/activity/assignment additionally requires providers:read/write and a nonempty explicit current providerIds grant; write requires read. This grants no provider creation, deletion, login, invitation or schedule authority. WhatsApp template/profile management requires separate whatsapp-templates:read, whatsapp-templates:write, whatsapp-profile:read and whatsapp-profile:write application scopes. Write requires its matching read scope. These grants require explicit owner approval; Meta OAuth permissions remain separate.

Required application permissions

campaigns:read

An owner must separately grant campaign access to the whole business or selected active providers. Calendar and customer grants do not imply campaign access. A provider-scoped campaign uses one granted provider and appointment customers. Keep this Management key on your backend.

Request

  • campaignIdpath · stringRequired
    Format and constraints
    campaignId schema
    {
      "type": "string",
      "format": "uuid"
    }
  • statequery · stringOptional
    Format and constraints
    state schema
    {
      "type": "string",
      "enum": [
        "pending",
        "sending",
        "sent",
        "failed",
        "unknown"
      ]
    }
  • limitquery · integerOptional
    Format and constraints
    limit schema
    {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "default": 50
    }
  • cursorquery · stringOptional

    Use the prior nextCursor with the same query. Omit on the first page; an invalid cursor requires restarting the read.

    Format and constraints
    cursor schema
    {
      "type": "string",
      "maxLength": 4096,
      "pattern": "^[A-Za-z0-9_-]+$"
    }

Successful responses

200 · BusinessCampaignRecipientPage

Current authorized result.

Cache-Control
Cache-Control schema
{
  "const": "no-store"
}

application/json · BusinessCampaignRecipientPage

  • itemsarrayRequired

    maxItems: 100

    View nested fields
    • []objectArray item

      Retained campaign-purpose history. A deleted contact may have profileId:null. unknown means a send may have occurred and is never eligible for automatic retry.

      View nested fields
      • recipientIdstring · uuidRequired
      • profileIdanyOf (string | null)Required

        At least one of these variants must match.

        View nested fields
        • anyOf 1string · uuidSchema branch
        • anyOf 2nullSchema branch
      • fullNameanyOf (string | null)Required

        At least one of these variants must match.

        View nested fields
        • anyOf 1stringSchema branch

          maxLength: 1024

        • anyOf 2nullSchema branch
      • phoneNumberstringRequired

        maxLength: 64

      • languageanyOf (string | null)Required

        At least one of these variants must match.

        View nested fields
        • anyOf 1stringSchema branch

          maxLength: 16

        • anyOf 2nullSchema branch
      • languageSentanyOf (string | null)Required

        At least one of these variants must match.

        View nested fields
        • anyOf 1stringSchema branch

          maxLength: 16

        • anyOf 2nullSchema branch
      • statestringRequired

        Allowed values: ["pending","sending","sent","failed","unknown"]

      • erroranyOf (string | null)Required

        At least one of these variants must match.

        View nested fields
        • anyOf 1stringSchema branch

          maxLength: 2048

        • anyOf 2nullSchema branch
      • errorCodeanyOf (integer | null)Required

        At least one of these variants must match.

        View nested fields
        • anyOf 1integerSchema branch

          minimum: -9007199254740991maximum: 9007199254740991

        • anyOf 2nullSchema branch
      • sentAtanyOf (string | null)Required

        At least one of these variants must match.

        View nested fields
        • anyOf 1string · date-timeSchema branch
        • anyOf 2nullSchema branch
      • updatedAtstring · date-timeRequired
      • additionalPropertiesno value allowedSchema rule
  • nextCursoranyOf (string | null)Required

    At least one of these variants must match.

    View nested fields
    • anyOf 1stringSchema branch

      maxLength: 4096pattern: "^[A-Za-z0-9_-]+$"

    • anyOf 2nullSchema branch
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "recipientId": {
            "type": "string",
            "format": "uuid"
          },
          "profileId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "fullName": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1024
              },
              {
                "type": "null"
              }
            ]
          },
          "phoneNumber": {
            "type": "string",
            "maxLength": 64
          },
          "language": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 16
              },
              {
                "type": "null"
              }
            ]
          },
          "languageSent": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 16
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "pending",
              "sending",
              "sent",
              "failed",
              "unknown"
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2048
              },
              {
                "type": "null"
              }
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "sentAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "recipientId",
          "profileId",
          "fullName",
          "phoneNumber",
          "language",
          "languageSent",
          "state",
          "error",
          "errorCode",
          "sentAt",
          "updatedAt"
        ],
        "description": "Retained campaign-purpose history. A deleted contact may have profileId:null. unknown means a send may have occurred and is never eligible for automatic retry."
      },
      "maxItems": 100
    },
    "nextCursor": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 4096,
          "pattern": "^[A-Za-z0-9_-]+$"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "items",
    "nextCursor"
  ]
}

Errors and recovery

Error responses declared in the contract (7)

The pinned contract shares generic error definitions across operations. This list is not an exhaustive list of runtime errors.

401 · Missing, invalid or expired Management credential.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
403 · Current integration/key/scope/resource authority denied, including a browser Origin. Old keys gain no campaign authority.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
404 · Campaign or resource is not available under the current grant. A missing operation lookup returns 200 with status:not_found.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
405 · Unsupported method.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
422 · Invalid request, UUID, query, cursor or precondition format.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
429 · Request rate limit; honor Retry-After.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
503 · Temporary failure. Reads may be retried; for an uncertain command, retain its UUID and exact request and read campaign-operations first.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}