ticketz-oss / ticketz

Chat based ticket system
GNU Affero General Public License v3.0
135 stars 107 forks source link

Messages to WhatsApp groups by API Ticketz #128

Open orcapa opened 3 months ago

orcapa commented 3 months ago

Hello everyone, I need to send messages to WhatsApp groups via API. ? I currently send via API to the phone number. But it won't let me send with the group ID.

How can I change the code to send the message. ?

Code: { "number": "573148814322", "body": "Your messages" }

I need change number to group ID: 120363146269777398@g.us

orcapa commented 3 months ago

This is my code to send the message

private function enviarWhatikepSms($telefonop, $textop, $concepto) { $url = "https://myserver.openco.com/api/messages/send"; $token = "MOYOHOYPAGOS394594"; $datasend = json_encode(array('number' => $telefonop, 'body' => $textop)); $curl = curl_init($url);

    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $headers = array(
        "Accept: application/json",
        "Authorization: Bearer $token",
        "Content-Type: application/json",
    );
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $datasend);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    $resp = curl_exec($curl);
    curl_close($curl);
    return $resp;

    }

allgood commented 3 months ago

Hi @orcapa

currently this is not supported. I'm marking this issue as enhancement to see what can be done.

orcapa commented 3 months ago

Thanks @allgood