<?php
namespace App\Controllers;

use App\Models\WhatsappModel;
use CodeIgniter\RESTful\ResourceController;

class Whatsapp extends ResourceController
{
    public function send()
    {
        $whatsapp = new WhatsappModel();

        $to = $this->request->getPost('to'); // Número destino con código de país
        $message = $this->request->getPost('message'); // Mensaje a enviar

        $response = $whatsapp->sendMessage($to, $message);

        return $this->respond($response);
    }
}
