2
0

🐛 (whatsapp) Fix WA preview not starting and accept audio and documents messages

This commit is contained in:
Baptiste Arnaud
2023-12-20 10:35:34 +01:00
parent a6536461e5
commit 780b4dee18
28 changed files with 619 additions and 192 deletions

View File

@ -56965,6 +56965,551 @@
}
}
}
},
"/v1/typebots/{typebotId}/whatsapp/start-preview": {
"post": {
"operationId": "whatsApp-startWhatsAppPreview",
"summary": "Start preview",
"tags": [
"WhatsApp"
],
"security": [
{
"Authorization": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"to": {
"type": "string",
"minLength": 1
},
"startFrom": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"group"
]
},
"groupId": {
"type": "string"
}
},
"required": [
"type",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"event"
]
},
"eventId": {
"type": "string"
}
},
"required": [
"type",
"eventId"
],
"additionalProperties": false
}
]
}
},
"required": [
"to"
],
"additionalProperties": false
}
}
}
},
"parameters": [
{
"name": "typebotId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},
"/v1/whatsapp/preview/webhook": {
"get": {
"operationId": "whatsApp-subscribePreviewWebhook",
"summary": "Subscribe webhook",
"tags": [
"WhatsApp"
],
"parameters": [
{
"name": "hub.challenge",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "hub.verify_token",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "number"
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
},
"post": {
"operationId": "whatsApp-receiveMessagePreview",
"summary": "Message webhook",
"tags": [
"WhatsApp"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"entry": {
"type": "array",
"items": {
"type": "object",
"properties": {
"changes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "object",
"properties": {
"metadata": {
"type": "object",
"properties": {
"phone_number_id": {
"type": "string"
}
},
"required": [
"phone_number_id"
],
"additionalProperties": false
},
"contacts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"profile": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
],
"additionalProperties": false
}
},
"required": [
"profile"
],
"additionalProperties": false
}
},
"messages": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"text"
]
},
"text": {
"type": "object",
"properties": {
"body": {
"type": "string"
}
},
"required": [
"body"
],
"additionalProperties": false
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"text",
"timestamp"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"button"
]
},
"button": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"payload": {
"type": "string"
}
},
"required": [
"text",
"payload"
],
"additionalProperties": false
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"button",
"timestamp"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"interactive"
]
},
"interactive": {
"type": "object",
"properties": {
"button_reply": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"id",
"title"
],
"additionalProperties": false
}
},
"required": [
"button_reply"
],
"additionalProperties": false
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"interactive",
"timestamp"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"image"
]
},
"image": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"additionalProperties": false
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"image",
"timestamp"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"video"
]
},
"video": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"additionalProperties": false
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"video",
"timestamp"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"audio"
]
},
"audio": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"additionalProperties": false
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"audio",
"timestamp"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"document"
]
},
"document": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
],
"additionalProperties": false
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"document",
"timestamp"
],
"additionalProperties": false
}
]
}
}
},
"required": [
"metadata"
],
"additionalProperties": false
}
},
"required": [
"value"
],
"additionalProperties": false
}
}
},
"required": [
"changes"
],
"additionalProperties": false
}
}
},
"required": [
"entry"
],
"additionalProperties": false
}
}
}
},
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
}
},
"components": {