1. Home
  2. Docs
  3. WhatsApp
  4. Send WhatsApp Message

Send WhatsApp Message

API URL Endpoint:
https://api.geniq.io/rest/v1/whatsapp/messages

General Parameter

PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
recipientintegerYesRecipient’s mobile number including country code without “+” prefix
referencestringOptionalA unique reference ID for keeping track of requests and responses
typebooleanYesMessage type:
– text
– image
– video
– audio
– document
– location
– template
– sticker

Please refer to the following tables for more info.
  • Send Text Message
PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
bodystringYesMessage to be sent out
previewUrlbooleanYesTo generate link previews if any URL exists in the messagefalse

Sample request using CURL:

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/messages \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-H 'Content-Type: application/json' \
-d '{
    "recipient":"6591234567",                
    "type":"text",
    "body":"This is a test message. https://www.youtube.com/watch?v=EngW7tLk6R8",
    "previewUrl":true,
    "reference": "12345"
}' \
  • Send Image/Video/Audio/Sticker Message
PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
urlstringYesURL that your image or video file is uploaded to and should be publicly accessible to the file.
Supported image type:
-image/jpeg
image/png

Supported video type:
video/mp4
video/3gp

Supported audio type:
audio/aac
audio/mp4
audio/mpeg
audio/amr
audio/ogg

Supported sticker type:
image/webp
captionstringOptionalImage/video/audio/sticker caption

Sample request using CURL:

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/messages \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-H 'Content-Type: application/json' \
-d '{
    "recipient":"6591234567",                
    "type":"image",
    "url":"https://images.pexels.com/photos/11742011/pexels-photo-11742011.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
    "caption":"Sample Image",
    "reference": "12345"
}' \
  • Send Document Message
PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
urlstringYesURL that your document file is uploaded to and should be publicly accessible to the file.
Supported document type:
text/plain
application/pdf
application/vnd.ms-powerpoint
application/msword
application/vnd.ms-excel
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/vnd.openxmlformats-officedocument.presentationml.presentation
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
captionstringOptionalDocument caption
filenamestringOptionalFilename

Sample request using CURL:

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/messages \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-H 'Content-Type: application/json' \
-d '{
    "recipient":"6591234567",                
    "type":"document",
    "url":"https://filesamples.com/samples/document/pdf/sample2.pdf",
    "caption":"Test Doc",
    "filename":"sample2.pdf",
    "reference": "12345",
}' \
  • Send Location Message
PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
latitudedoubleYesLatitude
longitudedoubleYesLongitude
locationNameStringOptionalLocation Name
addressStringOptionalAddress

Sample request using CURL:

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/messages \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-H 'Content-Type: application/json' \
-d '{
    "recipient":"6591234567",                
    "type":"location",
    "latitude": 55.7047,
    "longitude": 13.191,
    "locationName": "Test Location",
    "address": "Scheelevägen 17",
    "reference": "12345",
}' \
  • Send Template Message
PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
templateNamestringYesTemplate name
languagestringYesTemplate language
headerParamsarrayOptionalParameter(s) that will be used to replace the dynamic field in the message header
bodyParamsarrayOptionalParameter(s) that will be used to replace the dynamic field in the message body

Sample request using CURL:

Sample 1:

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/messages \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-H 'Content-Type: application/json' \
-d '{
    "recipient":"6591234567",                
    "type":"location",
    "templateName":"template1",
    "language": "en",
    "reference": "12345",
}' \

Sample 2:

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/messages \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-H 'Content-Type: application/json' \
-d '{
    "recipient":"6591234567",                
    "type":"location",
    "templateName":"template1",
    "headerParams": [
        "Header Param 1"
    ],
    "bodyParams": [
        "Body Param 1",
        "Body Param 2"
    ],
    "language": "en",
    "reference": "12345",
}' \

Parameters returned in the API response:

PARAMETERFORMATDESCRIPTION
referencestringIf reference parameter is submitted during the API request, the same value will be returned
responseMessagestringResponse message returned from the API call
responseCodeintegerResponse code returned from the API call. Refer to section “Response Codes” for list of possible values
messageIdstringA unique ID for the sent SMS

Sample Response:

{
    "reference":"12345",
    "responseMessage":"Success",
    "responseCode":"0",
    "messageId":"76CEEFFFD89C9193391D631A9EE74E27"
}