{
    "openapi": "3.0.3",
    "info": {
        "title": "WisChat API",
        "version": "1.0.0",
        "description": "Envío de mensajes de WhatsApp (compatible con el formato de Meta)."
    },
    "servers": [
        {
            "url": "http://v2.wis.chat"
        }
    ],
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer"
            }
        }
    },
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "paths": {
        "/api/v22.0/{tid}/messages": {
            "post": {
                "summary": "Enviar un mensaje",
                "parameters": [
                    {
                        "name": "tid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Phone Number ID o id interno de la línea"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "to": {
                                        "type": "string",
                                        "example": "593999999999"
                                    },
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "text",
                                            "template",
                                            "image",
                                            "document",
                                            "video",
                                            "audio"
                                        ]
                                    },
                                    "text": {
                                        "type": "object",
                                        "properties": {
                                            "body": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "to",
                                    "type"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Enviado",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "wa_message_id": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Token inválido"
                    }
                }
            }
        }
    }
}