All API calls must be authenticated with an Acccess Token. Developers can authenticate their API calls with the access token generated in App Dashboard > WhatsApp > Getting Started
The API calls return the Message Id as a string.
When you send a File using the WhatsApp API, first the message is uploaded to WhatsApp servers and then a new message is sent with the object id returned after upload the file.
Call the method SendMessageImage and pass the following parameters:
oClient := TsgcWhatsApp_Client.Create(nil);
oClient.WhatsappOptions.PhoneNumberId := '107809351952205';
oClient.WhatsappOptions.Token := 'EAAO4OpgZAs98BAGj3nCFGr...ZB2t8mmLB2LRXJkte2Y5PMNh2';
oClient.SendFileImage('34605889421', 'c:\images\image.png', 'image/png');
Call the method SendMessageDocument and pass the following parameters:
oClient := TsgcWhatsApp_Client.Create(nil);
oClient.WhatsappOptions.PhoneNumberId := '107809351952205';
oClient.WhatsappOptions.Token := 'EAAO4OpgZAs98BAGj3nCFGr...ZB2t8mmLB2LRXJkte2Y5PMNh2';
oClient.SendFileDocument('34605889421', 'c:\MyDocuments\invoice.pdf', 'application/pdf');
Call the method SendMessageAudio and pass the following parameters:
oClient := TsgcWhatsApp_Client.Create(nil);
oClient.WhatsappOptions.PhoneNumberId := '107809351952205';
oClient.WhatsappOptions.Token := 'EAAO4OpgZAs98BAGj3nCFGr...ZB2t8mmLB2LRXJkte2Y5PMNh2';
oClient.SendFileAudio('34605889421', 'c:\Music\audio.mp3', 'audio/mp4');
Call the method SendMessageVideo and pass the following parameters:
oClient := TsgcWhatsApp_Client.Create(nil);
oClient.WhatsappOptions.PhoneNumberId := '107809351952205';
oClient.WhatsappOptions.Token := 'EAAO4OpgZAs98BAGj3nCFGr...ZB2t8mmLB2LRXJkte2Y5PMNh2';
oClient.SendFileVideo('34605889421', 'c:\Videos\video.mp4', 'video/mp4');
Call the method SendMessageSticker and pass the following parameters:
oClient := TsgcWhatsApp_Client.Create(nil);
oClient.WhatsappOptions.PhoneNumberId := '107809351952205';
oClient.WhatsappOptions.Token := 'EAAO4OpgZAs98BAGj3nCFGr...ZB2t8mmLB2LRXJkte2Y5PMNh2';
oClient.SendFileSticker('34605889421', 'c:\Stickers\MySicker.webp', 'image/webp');