{
  "openapi": "3.1.0",
  "info": {
    "title": "Vendschat Integration API",
    "version": "1.0",
    "description": "Workspace API for Zapier, Make, n8n, and custom HTTP clients.\nAuthenticate with a Growth+ integration API key. Keys only authorize `/v1/integrations/*`.\n",
    "contact": {
      "name": "Vendschat",
      "url": "https://vendschat.com"
    }
  },
  "servers": [
    {
      "url": "https://api.vendschat.com/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyAuth": []
    }
  ],
  "tags": [
    {
      "name": "Auth",
      "description": "Verify API keys and workspace entitlements"
    },
    {
      "name": "Messages",
      "description": "Channels, templates, and outbound sends"
    },
    {
      "name": "Contacts",
      "description": "Lookup and manage contacts"
    },
    {
      "name": "Labels",
      "description": "Workspace labels"
    },
    {
      "name": "Webhooks",
      "description": "REST Hook subscribe lifecycle for Zapier, Make, and n8n"
    },
    {
      "name": "Platform helpers",
      "description": "Dynamic form helpers for Zapier/Make connectors \u2014 prefer Messages send for custom HTTP"
    }
  ],
  "paths": {
    "/integrations/me": {
      "get": {
        "tags": [
          "Auth"
        ],
        "operationId": "getIntegrationsMe",
        "summary": "Get workspace for API key",
        "description": "Smoke-test the key and read plan entitlements.",
        "responses": {
          "200": {
            "description": "Workspace and entitlements",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                },
                "example": {
                  "workspace": {
                    "id": 42,
                    "name": "BloomBox",
                    "organization_id": 7,
                    "organization_name": "BloomBox Ltd",
                    "plan_tier": "growth_200"
                  },
                  "entitlements": {
                    "webhooks": true,
                    "integrations": true,
                    "developer_api": false,
                    "feature_access": [
                      "inbox.chat",
                      "settings.integrations",
                      "settings.webhooks"
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/integrations/messages/channels": {
      "get": {
        "tags": [
          "Messages"
        ],
        "operationId": "listIntegrationChannels",
        "summary": "List active channels",
        "responses": {
          "200": {
            "description": "Active workspace channels",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "channels"
                  ],
                  "properties": {
                    "channels": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Channel"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/integrations/messages/templates": {
      "get": {
        "tags": [
          "Messages"
        ],
        "operationId": "listIntegrationTemplates",
        "summary": "List approved templates",
        "parameters": [
          {
            "name": "channel_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Channel id from list channels"
          }
        ],
        "responses": {
          "200": {
            "description": "Approved templates for the channel",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "templates"
                  ],
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/integrations/messages/templates/{id}": {
      "get": {
        "tags": [
          "Messages"
        ],
        "operationId": "getIntegrationTemplateForm",
        "summary": "Preview template variable fields",
        "description": "Returns form field keys such as `body_1` for `template_variables` on send.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "channel_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Template form definition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateForm"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/integrations/messages/send": {
      "post": {
        "tags": [
          "Messages"
        ],
        "operationId": "sendIntegrationMessage",
        "summary": "Send a message",
        "description": "Preferred send endpoint for custom HTTP and n8n. Respects the 24-hour session window;\nuse WhatsApp templates outside the window.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendMessageRequest"
              },
              "examples": {
                "whatsappText": {
                  "summary": "WhatsApp text on a specific channel",
                  "value": {
                    "identifier_type": "phone_number",
                    "identifier_value": "+15551234567",
                    "channel_mode": "specific",
                    "channel_id": 15,
                    "message_type": "text",
                    "text": "Your BloomBox order is packed and ready."
                  }
                },
                "lastInteracted": {
                  "summary": "Last interacted channel",
                  "value": {
                    "identifier_type": "contact_id",
                    "identifier_value": "1001",
                    "channel_mode": "last_interacted",
                    "content_mode": "text",
                    "text": "Thanks for writing in \u2014 we are on it."
                  }
                },
                "whatsappTemplate": {
                  "summary": "WhatsApp template",
                  "value": {
                    "identifier_type": "phone_number",
                    "identifier_value": "+15551234567",
                    "channel_mode": "specific",
                    "channel_id": 15,
                    "message_type": "template",
                    "template_id": 88,
                    "template_variables": {
                      "body_1": "Alex",
                      "body_2": "BB-2048"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendMessageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/integrations/messages/send-form": {
      "post": {
        "tags": [
          "Platform helpers"
        ],
        "operationId": "buildSendMessageForm",
        "summary": "Build send-message form schema",
        "description": "Platform helper for Zapier/Make dynamic UIs. Prefer `POST /integrations/messages/send` for custom code.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Dynamic form schema",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/integrations/messages/send-from-form": {
      "post": {
        "tags": [
          "Platform helpers"
        ],
        "operationId": "sendMessageFromForm",
        "summary": "Send from form field state",
        "description": "Platform helper that parses Zapier/Make form fields then sends. Prefer `POST /integrations/messages/send` for custom code.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendMessageResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/integrations/contacts/lookup": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "operationId": "lookupIntegrationContact",
        "summary": "Lookup a contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactIdentifier"
              },
              "example": {
                "identifier_type": "phone_number",
                "identifier_value": "+15551234567"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contact"
                  ],
                  "properties": {
                    "contact": {
                      "$ref": "#/components/schemas/Contact"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/integrations/contacts": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "operationId": "createIntegrationContact",
        "summary": "Create a contact",
        "description": "Requires both `phone_number` and `email`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateContactRequest"
              },
              "example": {
                "name": "Alex Rivera",
                "phone_number": "+15551234567",
                "email": "alex@example.com",
                "note": "Wholesale lead from Make"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contact created or existing match returned",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "contact",
                    "created"
                  ],
                  "properties": {
                    "contact": {
                      "$ref": "#/components/schemas/Contact"
                    },
                    "created": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "patch": {
        "tags": [
          "Contacts"
        ],
        "operationId": "updateIntegrationContact",
        "summary": "Update a contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ContactIdentifier"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "nullable": true
                      },
                      "phone_number": {
                        "type": "string",
                        "nullable": true
                      },
                      "email": {
                        "type": "string",
                        "nullable": true
                      },
                      "note": {
                        "type": "string",
                        "nullable": true
                      },
                      "country": {
                        "type": "string",
                        "nullable": true
                      },
                      "language": {
                        "type": "string",
                        "nullable": true
                      },
                      "custom_fields": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated contact",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Contacts"
        ],
        "operationId": "deleteIntegrationContact",
        "summary": "Delete a contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactIdentifier"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/integrations/contacts/note": {
      "put": {
        "tags": [
          "Contacts"
        ],
        "operationId": "upsertIntegrationContactNote",
        "summary": "Set contact note",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ContactIdentifier"
                  },
                  {
                    "type": "object",
                    "required": [
                      "note"
                    ],
                    "properties": {
                      "note": {
                        "type": "string",
                        "nullable": true
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Note saved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/integrations/contacts/labels/add": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "operationId": "addIntegrationContactLabels",
        "summary": "Add labels to a contact",
        "description": "Pass `label_ids` and/or `labels` (names; missing names are created on add).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactLabelsRequest"
              },
              "example": {
                "identifier_type": "contact_id",
                "identifier_value": "1001",
                "label_ids": [
                  3
                ],
                "labels": "Wholesale, VIP"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Labels attached",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/integrations/contacts/labels/remove": {
      "post": {
        "tags": [
          "Contacts"
        ],
        "operationId": "removeIntegrationContactLabels",
        "summary": "Remove labels from a contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactLabelsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Labels removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/integrations/labels": {
      "get": {
        "tags": [
          "Labels"
        ],
        "operationId": "listIntegrationLabels",
        "summary": "List workspace labels",
        "responses": {
          "200": {
            "description": "Labels",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "labels"
                  ],
                  "properties": {
                    "labels": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Label"
                      }
                    }
                  }
                },
                "example": {
                  "labels": [
                    {
                      "id": 3,
                      "name": "VIP",
                      "color": "#059669",
                      "emoji": null
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/integrations/webhooks/events": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "listIntegrationWebhookEvents",
        "summary": "List webhook event catalog",
        "description": "Full payload shapes live in the product Webhooks guide.",
        "responses": {
          "200": {
            "description": "Event definitions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "additionalProperties": true
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/integrations/webhooks/subscribe": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "subscribeIntegrationWebhook",
        "summary": "Subscribe a webhook URL",
        "description": "Returns `signing_secret` once \u2014 store it securely.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookSubscribeRequest"
              },
              "example": {
                "url": "https://hooks.zapier.com/hooks/catch/000/xxx/",
                "events": [
                  "incoming.vendschat.messages"
                ],
                "source": "zapier",
                "name": "Zapier: inbound messages",
                "payload_style": "thin"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Subscription created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookSubscription"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/integrations/webhooks/{id}": {
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "updateIntegrationWebhook",
        "summary": "Update a webhook subscription",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "is_active": {
                    "type": "boolean"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated subscription",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "unsubscribeIntegrationWebhook",
        "summary": "Delete a webhook subscription",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "id"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "`Authorization: Bearer YOUR_API_KEY`"
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Alternative to Bearer auth"
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing or invalid API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BadRequest": {
        "description": "Invalid request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "MeResponse": {
        "type": "object",
        "required": [
          "workspace",
          "entitlements"
        ],
        "properties": {
          "workspace": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "organization_id": {
                "type": "integer"
              },
              "organization_name": {
                "type": "string"
              },
              "plan_tier": {
                "type": "string"
              }
            }
          },
          "entitlements": {
            "type": "object",
            "properties": {
              "webhooks": {
                "type": "boolean"
              },
              "integrations": {
                "type": "boolean"
              },
              "developer_api": {
                "type": "boolean"
              },
              "feature_access": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Channel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "channel_type": {
            "type": "string",
            "enum": [
              "whatsapp",
              "messenger",
              "instagram",
              "email",
              "sms"
            ]
          },
          "display_name": {
            "type": "string"
          },
          "channel_identifier": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "ContactIdentifier": {
        "type": "object",
        "required": [
          "identifier_type",
          "identifier_value"
        ],
        "properties": {
          "identifier_type": {
            "type": "string",
            "enum": [
              "contact_id",
              "email",
              "phone_number"
            ]
          },
          "identifier_value": {
            "type": "string"
          }
        }
      },
      "Contact": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "phone_number": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "note": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "language": {
            "type": "string",
            "nullable": true
          },
          "avatar_url": {
            "type": "string",
            "nullable": true
          },
          "custom_fields": {
            "type": "object",
            "additionalProperties": true
          },
          "labels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Label"
            }
          },
          "created_at": {
            "type": "string",
            "nullable": true
          },
          "updated_at": {
            "type": "string",
            "nullable": true
          },
          "last_contacted_at": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "CreateContactRequest": {
        "type": "object",
        "required": [
          "phone_number",
          "email"
        ],
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "phone_number": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "note": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "language": {
            "type": "string",
            "nullable": true
          },
          "custom_fields": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "ContactLabelsRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ContactIdentifier"
          },
          {
            "type": "object",
            "properties": {
              "label_ids": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "labels": {
                "description": "Comma-separated names or an array of names/ids",
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "integer"
                        }
                      ]
                    }
                  }
                ]
              }
            }
          }
        ]
      },
      "Label": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "emoji": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "SendMessageRequest": {
        "type": "object",
        "required": [
          "identifier_type",
          "identifier_value",
          "channel_mode"
        ],
        "properties": {
          "identifier_type": {
            "type": "string",
            "enum": [
              "contact_id",
              "email",
              "phone_number"
            ]
          },
          "identifier_value": {
            "type": "string"
          },
          "channel_mode": {
            "type": "string",
            "enum": [
              "last_interacted",
              "specific"
            ]
          },
          "channel_id": {
            "type": "integer",
            "description": "Required when channel_mode is specific"
          },
          "content_mode": {
            "type": "string",
            "enum": [
              "text",
              "attachment"
            ],
            "description": "Used with last_interacted"
          },
          "message_type": {
            "type": "string",
            "description": "Used with specific channel (text, template, image, \u2026)"
          },
          "text": {
            "type": "string"
          },
          "attachment_type": {
            "type": "string",
            "enum": [
              "image",
              "video",
              "audio",
              "document"
            ]
          },
          "media_url": {
            "type": "string",
            "format": "uri"
          },
          "caption": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "template_id": {
            "type": "integer"
          },
          "template_variables": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Keys from template form (`body_1`, `header_1`, \u2026)"
          }
        }
      },
      "SendMessageResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "thread_id": {
            "type": "integer"
          },
          "contact_id": {
            "type": "integer"
          },
          "channel_id": {
            "type": "integer"
          },
          "channel_type": {
            "type": "string"
          },
          "message_id": {
            "type": "integer"
          },
          "external_message_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "created_contact": {
            "type": "boolean"
          },
          "created_thread": {
            "type": "boolean"
          }
        }
      },
      "TemplateForm": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "variable_fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "example": "body_1"
                },
                "component": {
                  "type": "string"
                },
                "index": {
                  "type": "integer"
                },
                "label": {
                  "type": "string"
                },
                "required": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      },
      "WebhookSubscribeRequest": {
        "type": "object",
        "required": [
          "url",
          "events",
          "source"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "incoming.vendschat.messages"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "zapier",
              "make",
              "n8n"
            ]
          },
          "name": {
            "type": "string"
          },
          "api_version": {
            "type": "string"
          },
          "payload_style": {
            "type": "string",
            "enum": [
              "thin",
              "snapshot"
            ]
          }
        }
      },
      "WebhookSubscription": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "api_version": {
            "type": "string",
            "nullable": true
          },
          "payload_style": {
            "type": "string"
          },
          "is_active": {
            "type": "boolean"
          },
          "signing_secret": {
            "type": "string",
            "description": "Shown on create \u2014 store securely"
          }
        }
      }
    }
  }
}
