Topic: whatsapp api message send

whatsapp api message send exampale code please.......
api websites list

Re: whatsapp api message send

HELP ME

Re: whatsapp api message send

We don't understand your message, no one will answer you.

Destiny

Re: whatsapp api message send

Hello epancard, salut Destiny

In France, we have a maxim that says:

' What is well conceived is clearly expressed
and the words to express it come easily' .

So, correctly reformulate the problem you want to present to us and what you expect from us.
JB

Re: whatsapp api message send

<?php
//The idInstance and apiTokenInstance values are available in your account, double brackets must be removed
$url = 'https://7105.api.greenapi.com/waInstanc … 0b4e4146a5';

//chatId is the number to send the message to (@c.us for private chats, @g.us for group chats)
$data = array(
'chatId' => '@c.us'
);

$options = array(
    'http' => array(
        'header' => "Content-Type: application/json\r\n",
        'method' => 'POST',
        'content' => json_encode($data)
    )
);

$context = stream_context_create($options);

$response = file_get_contents($url, false, $context);

echo $response;
?>

Re: whatsapp api message send

this code php     convert mvd code please

Re: whatsapp api message send

api whatsapp massage send code
website is https://green-api.com/en

8 (edited by prahousefamily 2025-05-28 07:56:44)

Re: whatsapp api message send

The example I made, is it the one you want?




https://i.ibb.co/s9QPNXjm/D20250528-T142607.png

My Visual Database : I Love You
Easy For Beginner Student For Me

9 (edited by prahousefamily 2025-05-29 06:18:35)

Re: whatsapp api message send

Try Code

procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
var
WinHttpReq  : Variant;
url : String ;
body : TStringlist;
begin
    Try
        WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
        url := Form1.Edit6.Text ;
        body := Tstringlist.create ;
        body.add('{"chatId": "'+Form1.Edit4.Text+'","message": "'+Form1.Edit5.Text+'"}');
        WinHttpReq.Open('Post',url,False);
        WinHttpReq.SetRequestHeader('Content-Type', 'application/json');
        WinHttpReq.Send(body.Text);
        Form1.Edit7.Text := WinHttpReq.StatusText ;
        Form1.Memo1.Text := WinHttpReq.ResponseText ;
        body.Free ;
        Except
    End;
end;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
    Form1.Edit6.Text :=
    Form1.Edit1.Text+'/waInstance'+Form1.Edit2.Text+'/sendMessage/'+Form1.Edit3.Text ;
end;
begin
end.

https://i.ibb.co/0RQm65vN/D20250529-T112502.png



Reference From https://green-api.com/en/docs/api/sending/SendMessage/

Delphi

program sendMessage;

{$APPTYPE CONSOLE}

uses
System.SysUtils,
System.Classes, System.Net.HttpClient, System.Net.URLClient, System.Net.HttpClientComponent;

var
HttpClient: TNetHTTPClient;
RequestBody: TStringStream;
RequestHeaders: TNetHeaders;
Response: IHTTPResponse;
EndpointURL, ID_INSTANCE, API_TOKEN_INSTANCE: string;

begin
ID_INSTANCE := '110100001';
API_TOKEN_INSTANCE := 'd75b3a66374942c5b3c019c698abc2067e151558acbd451234';

EndpointURL := 'https://api.greenapi.com/waInstance' + ID_INSTANCE + '/sendMessage/' + API_TOKEN_INSTANCE;

HttpClient := TNetHTTPClient.Create(nil);
RequestBody := TStringStream.Create('{ "chatId": "71234567890@c.us", "message": "test" }', TEncoding.UTF8);
RequestHeaders := [
    TNetHeader.Create('Content-Type', 'application/json')
];

try
    Response := HTTPClient.Post(EndpointURL, RequestBody, nil, RequestHeaders);

    if Response.StatusCode = 200 then
    Writeln('[Response]: ' + Response.ContentAsString)
    else
    Writeln('[ERROR ' + IntToStr(Response.StatusCode) + ']:' + Response.StatusText + '' + Response.ContentAsString);

    readln;
except
    on E: Exception do
    Writeln(E.ClassName, ': ', E.Message);
end;

HttpClient.Free;
RequestBody.Free;

end.
Post's attachments

Attachment icon Green-API.zip 4.5 kb, 32 downloads since 2025-05-29 

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: whatsapp api message send

Thankyou very much all