Image messages are messages that display a single image and an optional caption.
Image objects:
Parameter
Type
Description
Value / Pattern
*type
String
Type of the attachment you want to send. For Image messages its image
image
*url
String
URL for the image. The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URL. Supported image formates: .jpeg, .png, .webp with max size 5MB
constClient=require('direct7')constclient=newClient(apiToken="Your API token")constresponse=awaitclient.whatsapp.sendWhatsAppFreeformMessage({originator:"{registered_phonenumber}",recipients:[{"recipient":"{recipient}","recipient_type":"individual"}],message_type:"ATTACHMENT",type:"image",url:"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg",caption:"Natural Beauty"});console.log(response);
fromdirect7importClientclient=Client(api_token="Your API token")client.whatsapp.send_whatsapp_freeform_message(originator="{registered phone_number}",recipients=[{"recipient":"{recipient}","recipient_type":"individual"}],message_type="ATTACHMENT",type="image",url="https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg",caption="Natural Beauty")
require_once__DIR__.'/vendor/autoload.php';usedirect7\Direct7\Client;$client=newClient(api_token="Your API token")$response=$direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}",recipients:[["recipient"=>"{recipient}","recipient_type"=>"individual"]],message_type:"ATTACHMENT",type:"image",url:"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg",
caption:"Natural Beauty");var_dump($response);
import("github.com/d7networks/direct7-go-sdk/direct7")apiToken:="Your Api Token"client:=direct7.NewClient(apiToken)whatsapp:=direct7.NewWhatsApp(client)originator:="{registered_phonenumber}"recipients:=[]map[string]string{"recipient":"{recipient}","recipient_type":"individual",}messageType:="ATTACHMENT"optParams:=&OptionalParams{attachmentType:"image",url:"https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg",caption:"Natural Beauty",}response,err:=whatsapp.SendWhatsAppFreeformMessage(originator,recipients,messageType,optParams)
require'direct7'client=Direct7::Client.new('Your API token')client.whatsapp.send_whatsapp_freeform_message(originator='{originator}',recipients=[{'recipient'=>'{recipient}','recipient_type'=>'individual'}],message_type='ATTACHMENT',body=nil,first_name=nil,last_name=nil,formatted_name=nil,middle_name=nil,suffix=nil,prefix=nil,birthday=nil,phones=nil,emails=nil,urls=nil,latitude=nil,longitude=nil,name=nil,address=nil,type='image',url='https://t4.ftcdn.net/jpg/01/43/23/83/360_F_143238306_lh0ap42wgot36y44WybfQpvsJB5A1CHc.jpg',caption='Tet')
Video messages display a thumbnail preview of a video image with an optional caption. When the WhatsApp user taps the preview, it loads the video and displays it to the user.
Video objects
Parameter
Type
Description
Value / Pattern
*type
String
Type of the attachment you want to send. For Video messages its video
video
*url
String
URL for the video. The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URL. Supported image formates: .3gp, .mp4 with max size 16MB
constClient=require('direct7')constclient=newClient(apiToken="Your API token")constresponse=awaitclient.whatsapp.sendWhatsAppFreeformMessage({originator="91906152XXXX",recipients=[{"recipient":"{recipient}","recipient_type":"individual"}],message_type:"ATTACHMENT",type:"video",url:"https://www.onirikal.com/videos/mp4/nestlegold.mp4",caption="D7 Video Test"});console.log(response);
fromdirect7importClientclient=Client(api_token="Your API token")client.whatsapp.send_whatsapp_freeform_message(originator="{registered phone_number}",recipients=[{"recipient":"{recipient}","recipient_type":"individual"}],message_type="ATTACHMENT",type="video",url="http://www.onirikal.com/videos/mp4/nestlegold.mp4",caption="D7 Video Test")
require_once__DIR__.'/vendor/autoload.php';usedirect7\Direct7\Client;$client=newClient(api_token="Your API token")$response=$direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}",recipients:[["recipient"=>"{recipient}","recipient_type"=>"individual"]],message_type:"ATTACHMENT",type:"video",url:"http://www.onirikal.com/videos/mp4/nestlegold.mp4",caption:"D7 Video test");var_dump($response);
import("github.com/d7networks/direct7-go-sdk/direct7")apiToken:="Your Api Token"client:=direct7.NewClient(apiToken)whatsapp:=direct7.NewWhatsApp(client)originator:="{registered_phonenumber}"recipients:=[]map[string]string{"recipient":"{recipient}","recipient_type":"individual",}messageType:="ATTACHMENT"optParams:=&OptionalParams{attachmentType:"video",url:"http://www.onirikal.com/videos/mp4/nestlegold.mp4",caption:"D7 Video Test",}response,err:=whatsapp.SendWhatsAppFreeformMessage(originator,recipients,messageType,optParams)
varheaders={'Content-Type':'application/json','Authorization':'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoLWJhY2tlbmQ6YXBwIiwic3ViIjoiZjM0N2JhMDktMTllMi00MmIxLWE3ZjYtZDIyOGNlOTczN2U2In0.-ECRlIIiXGoF01JJEf7lmZjHCzny0vAKSlTFGbHQuwc'};varrequest=http.Request('POST',Uri.parse('https://apialpha.d7networks.com/whatsapp/v2/send'));request.body=json.encode({"messages":[{"originator":"{registered phone_number}","content":{"message_type":"ATTACHMENT","attachment":{"type":"video","url":"http://www.onirikal.com/videos/mp4/nestlegold.mp4","caption":"D7 Video Test"}},"recipients":[{"recipient":"{recipient}","recipient_type":"individual"}],"report_url":"https://webhook.site/f2615b62-1f28-4215-963d-117280cc6c4e"}]});request.headers.addAll(headers);http.StreamedResponseresponse=awaitrequest.send();if(response.statusCode==200){print(awaitresponse.stream.bytesToString());}else{print(response.reasonPhrase);}
require'direct7'client=Direct7::Client.new('Your API token')client.whatsapp.send_whatsapp_freeform_message(originator='{originator}',recipients=[{"recipient"=>"{recipient}","recipient_type"=>"individual"}],message_type='ATTACHMENT',body=nil,first_name=nil,last_name=nil,formatted_name=nil,middle_name=nil,suffix=nil,prefix=nil,birthday=nil,phones=nil,emails=nil,urls=nil,latitude=nil,longitude=nil,name=nil,address=nil,type='video',url='https://www.onirikal.com/videos/mp4/nestlegold.mp4',caption='Tet')
Document messages are messages that display a document icon, linked to a document, that a WhatsApp user can tap to download.
Document objects
Parameter
Type
Description
Value / Pattern
*type
String
Type of the attachment you want to send. For Document messages its document
document
*url
String
URL for the document. The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URL. Supported document formates: .txt, .xls, .xlsx, .doc, .docx, .ppt, .pptx, .pdf with max size 100 MB
constClient=require('direct7')constclient=newClient(apiToken="Your API token")constresponse=awaitclient.whatsapp.sendWhatsAppFreeformMessage({originator:"{registered_phone_number}",recipients:[{"recipient":"{recipient}","recipient_type":"individual"}],message_type:"ATTACHMENT",type:"document",url:"https://www.clickdimensions.com/links/TestPDFfile.pdf",caption:"Test PDF file pdf",filename:"TestPDFfile.pdf"});console.log(response);
fromdirect7importClientclient=Client(api_token="Your API token")client.whatsapp.send_whatsapp_freeform_message(originator="{registered_phonenumber}",recipients=[{"recipient":"{recipient}","recipient_type":"individual"}],message_type="ATTACHMENT",type="document",url="https://www.clickdimensions.com/links/TestPDFfile.pdf",caption="Test PDF file pdf",filename="TestPDFfile.pdf")
require_once__DIR__.'/vendor/autoload.php';usedirect7\Direct7\Client;$client=newClient(api_token="Your API token")$response=$direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}",recipients:[["recipient"=>"{recipient}","recipient_type"=>"individual"]],
message_type:"ATTACHMENT",type:"document",
url:"https://www.clickdimensions.com/links/TestPDFfile.pdf",caption:"Test PDF file pdf",filename:"TestPDFfile.pdf");var_dump($response);
import("github.com/d7networks/direct7-go-sdk/direct7")apiToken:="Your Api Token"client:=direct7.NewClient(apiToken)whatsapp:=direct7.NewWhatsApp(client)originator:="{registered_phonenumber}"recipients:=[]map[string]string{"recipient":"{recipient}","recipient_type":"individual",}messageType:="ATTACHMENT"optParams:=&OptionalParams{attachmentType:"document",url:"https://www.clickdimensions.com/links/TestPDFfile.pdf",caption:"Test PDF file pdf",fileName:"TestPDFfile.pdf",}response,err:=whatsapp.SendWhatsAppFreeformMessage(originator,recipients,messageType,optParams)
require'direct7'client=Direct7::Client.new('Your API token')client.whatsapp.send_whatsapp_freeform_message(originator='{originator}',recipients=[{"recipient"=>"{recipient}","recipient_type"=>"individual"}],message_type='ATTACHMENT',body=nil,first_name=nil,last_name=nil,formatted_name=nil,middle_name=nil,suffix=nil,prefix=nil,birthday=nil,phones=nil,emails=nil,urls=nil,latitude=nil,longitude=nil,name=nil,address=nil,type='document',url='https://www.clickdimensions.com/links/TestPDFfile.pdf',caption="Test PDF file pdf",filename="TestPDFfile.pdf")
Audio messages display an audio icon and a link to an audio file. When the WhatsApp user taps the icon, the WhatsApp client loads and plays the audio file.
Audio objects
Parameter
Type
Description
Value / Pattern
*type
String
Type of the attachment you want to send. For Audio messages its audio
audio
*url
String
URL for the audio. The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URL. Supported audio formates: .aac, .amr, .mp3, .m4a, .ogg with max size 16 MB
constClient=require('direct7')constclient=newClient(apiToken="Your API token")constresponse=awaitclient.whatsapp.sendWhatsAppFreeformMessage({originator:"{registered_phone_number}",recipients:[{"recipient":"{recipient}","recipient_type":"individual"}],message_type:"ATTACHMENT",type:"audio",url:"http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3",});console.log(response);
fromdirect7importClientclient=Client(api_token="Your API token")client.whatsapp.send_whatsapp_freeform_message(originator="{registered_phone_number}",recipients=[{"recipient":"{recipient}","recipient_type":"individual"}],message_type="ATTACHMENT",type="audio",url="http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3")
require_once__DIR__.'/vendor/autoload.php';usedirect7\Direct7\Client;$client=newClient(api_token="Your API token")$response=$direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phone_number}",recipients:[["recipient"=>"{recipient}","recipient_type"=>"individual"]],
message_type:"ATTACHMENT",type:"audio",url:"http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3");var_dump($response);
import("github.com/d7networks/direct7-go-sdk/direct7")apiToken:="Your Api Token"client:=direct7.NewClient(apiToken)whatsapp:=direct7.NewWhatsApp(client)originator:="{registered_phonenumber}"recipients:=[]map[string]string{"recipient":"{recipient}","recipient_type":"individual",}messageType:="ATTACHMENT"optParams:=&OptionalParams{attachmentType:"audio",url:"http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3",}response,err:=whatsapp.SendWhatsAppFreeformMessage(originator,recipients,messageType,optParams)
require'direct7'client=Direct7::Client.new('Your API token')client.whatsapp.send_whatsapp_freeform_message(originator='{originator}',recipients=[{'recipient'=>'{recipient}','recipient_type'=>'individual'}],message_type='ATTACHMENT',body=nil,first_name=nil,last_name=nil,formatted_name=nil,middle_name=nil,suffix=nil,prefix=nil,birthday=nil,phones=nil,emails=nil,urls=nil,latitude=nil,longitude=nil,name=nil,address=nil,type='audio',url='http://fate-suite.ffmpeg.org/mpegaudio/extra_overread.mp3')
Sticker messages display animated or static sticker images in a WhatsApp message.
Sticker objects
Parameter
Type
Description
Value / Pattern
*type
String
Type of the attachment you want to send. For Sticker messages its sticker
sticker
*url
String
URL for the sticker. The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URL. Supported sticker formates: Animated and Static with extension .webp
constClient=require('direct7')constclient=newClient(apiToken="Your API token")constresponse=awaitclient.whatsapp.sendWhatsAppFreeformMessage({originator:"{registered_phone_number}",recipients:[{"recipient":"{recipient}","recipient_type":"individual"}],message_type:"ATTACHMENT",type:"sticker",url:"https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp"});
fromdirect7importClientclient=Client(api_token="Your API token")client.whatsapp.send_whatsapp_freeform_message(originator="{registered_phonenumber}",recipients=[{"recipient":"{recipient}","recipient_type":"individual"}],message_type="ATTACHMENT",type="sticker",url="https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp")
require_once__DIR__.'/vendor/autoload.php';usedirect7\Direct7\Client;$client=newClient(api_token="Your API token")$response=$direct7->whatsapp->sendWhatsAppFreeformMessage(originator:"{registered_phonenumber}",recipients:[["recipient"=>"{recipient}","recipient_type"=>"individual"]],
message_type:"ATTACHMENT",type:"sticker",url:"https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp");var_dump($response);
import("github.com/d7networks/direct7-go-sdk/direct7")apiToken:="Your Api Token"client:=direct7.NewClient(apiToken)whatsapp:=direct7.NewWhatsApp(client)originator:="{registered_phonenumber}"recipients:=[]map[string]string{"recipient":"{recipient}","recipient_type":"individual",}messageType:="ATTACHMENT"optParams:=&OptionalParams{attachmentType:"sticker",url:"https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp",}response,err:=whatsapp.SendWhatsAppFreeformMessage(originator,recipients,messageType,optParams)
require'direct7'client=Direct7::Client.new('Your API token')client.whatsapp.send_whatsapp_freeform_message(originator='{originator}',recipients=[{'recipient'=>'{recipient}','recipient_type'=>'individual'}],message_type='ATTACHMENT',body=nil,first_name=nil,last_name=nil,formatted_name=nil,middle_name=nil,suffix=nil,prefix=nil,birthday=nil,phones=nil,emails=nil,urls=nil,latitude=nil,longitude=nil,name=nil,address=nil,type='sticker',url='https://raw.githubusercontent.com/sagarbhavsar4328/dummys3bucket/master/sample3.webp')