Skip to content

Latest commit

 

History

History
929 lines (687 loc) · 27.7 KB

File metadata and controls

929 lines (687 loc) · 27.7 KB

MessageSendingApi

All URIs are relative to /api

Method HTTP request Description
sendAudio POST /instances/{instance_key}/send/audio Send raw audio.
sendButtonMessage POST /instances/{instance_key}/send/buttons Send a button message.
sendButtonWithMedia POST /instances/{instance_key}/send/button-media Send a button message with a media header.
sendContact POST /instances/{instance_key}/send/contact Send a contact message.
sendDocument POST /instances/{instance_key}/send/document Send raw document.
sendGroupInvite POST /instances/{instance_key}/send/group-invite Send a group invite message
sendImage POST /instances/{instance_key}/send/image Send raw image.
sendListMessage POST /instances/{instance_key}/send/list Send a List message.
sendLocation POST /instances/{instance_key}/send/location Send a location message.
sendMediaMessage POST /instances/{instance_key}/send/media Send a media message.
sendPollMessage POST /instances/{instance_key}/send/poll Send a Poll message.
sendTemplate POST /instances/{instance_key}/send/template Send a template message.
sendTemplateWithMedia POST /instances/{instance_key}/send/template-media Send a template message with media.
sendTextMessage POST /instances/{instance_key}/send/text Send a text message.
sendVideo POST /instances/{instance_key}/send/video Send raw video.
uploadMedia POST /instances/{instance_key}/send/upload Upload media.
uploadMediaFromUrl POST /instances/{instance_key}/send/upload-url Upload media from url.

sendAudio

APIResponse sendAudio(instanceKey, to, sendAudioRequest, caption)

Send raw audio.

Sends a audio message by uploading to the WhatsApp servers every time. This is not recommended for bulk sending.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val to : kotlin.String = to_example // kotlin.String | The recipient's number
val sendAudioRequest : SendAudioRequest =  // SendAudioRequest | 
val caption : kotlin.String = caption_example // kotlin.String | Attached caption
try {
    val result : APIResponse = apiInstance.sendAudio(instanceKey, to, sendAudioRequest, caption)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendAudio")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendAudio")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
to kotlin.String The recipient's number
sendAudioRequest SendAudioRequest
caption kotlin.String Attached caption [optional]

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendButtonMessage

APIResponse sendButtonMessage(instanceKey, data)

Send a button message.

Sends an interactive button message to the given user. Make sure that all the button ids are unique

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : ButtonMessagePayload =  // ButtonMessagePayload | Message data
try {
    val result : APIResponse = apiInstance.sendButtonMessage(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendButtonMessage")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendButtonMessage")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` ButtonMessagePayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendButtonWithMedia

APIResponse sendButtonWithMedia(instanceKey, data)

Send a button message with a media header.

Sends an interactive button message to the given user. This message also has media header with it. Make sure that all the button ids are unique

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : ButtonMessageWithMediaPayload =  // ButtonMessageWithMediaPayload | Message data
try {
    val result : APIResponse = apiInstance.sendButtonWithMedia(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendButtonWithMedia")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendButtonWithMedia")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` ButtonMessageWithMediaPayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendContact

APIResponse sendContact(instanceKey, data)

Send a contact message.

Sends a contact (vcard) message to the given user.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : ContactMessagePayload =  // ContactMessagePayload | Message data
try {
    val result : APIResponse = apiInstance.sendContact(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendContact")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendContact")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` ContactMessagePayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendDocument

APIResponse sendDocument(instanceKey, to, sendDocumentRequest, caption)

Send raw document.

Sends a document message by uploading to the WhatsApp servers every time. This is not recommended for bulk sending.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val to : kotlin.String = to_example // kotlin.String | The recipient's number
val sendDocumentRequest : SendDocumentRequest =  // SendDocumentRequest | 
val caption : kotlin.String = caption_example // kotlin.String | Attached caption
try {
    val result : APIResponse = apiInstance.sendDocument(instanceKey, to, sendDocumentRequest, caption)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendDocument")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendDocument")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
to kotlin.String The recipient's number
sendDocumentRequest SendDocumentRequest
caption kotlin.String Attached caption [optional]

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendGroupInvite

APIResponse sendGroupInvite(instanceKey, data)

Send a group invite message

Sends a group invite message to the specified number. Don't include "https://chat.whatsapp.com/\" in the invite code.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : GroupInviteMessagePayload =  // GroupInviteMessagePayload | Message data
try {
    val result : APIResponse = apiInstance.sendGroupInvite(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendGroupInvite")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendGroupInvite")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` GroupInviteMessagePayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendImage

APIResponse sendImage(instanceKey, to, updateProfilePicRequest, caption)

Send raw image.

Sends a image message by uploading to the WhatsApp servers every time. This is not recommended for bulk sending.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val to : kotlin.String = to_example // kotlin.String | The recipient's number
val updateProfilePicRequest : UpdateProfilePicRequest =  // UpdateProfilePicRequest | 
val caption : kotlin.String = caption_example // kotlin.String | Attached caption
try {
    val result : APIResponse = apiInstance.sendImage(instanceKey, to, updateProfilePicRequest, caption)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendImage")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendImage")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
to kotlin.String The recipient's number
updateProfilePicRequest UpdateProfilePicRequest
caption kotlin.String Attached caption [optional]

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendListMessage

APIResponse sendListMessage(instanceKey, data)

Send a List message.

Sends an interactive List message to the given user.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : ListMessagePayload =  // ListMessagePayload | Message data
try {
    val result : APIResponse = apiInstance.sendListMessage(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendListMessage")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendListMessage")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` ListMessagePayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendLocation

APIResponse sendLocation(instanceKey, data)

Send a location message.

Sends a location message to the given user. This is static location and does not update Note: The Address and Url fields are optional

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : LocationMessagePayload =  // LocationMessagePayload | Message data
try {
    val result : APIResponse = apiInstance.sendLocation(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendLocation")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendLocation")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` LocationMessagePayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendMediaMessage

APIResponse sendMediaMessage(instanceKey, data)

Send a media message.

Sends a media message to the given user.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : SendMediaPayload =  // SendMediaPayload | Message data
try {
    val result : APIResponse = apiInstance.sendMediaMessage(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendMediaMessage")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendMediaMessage")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` SendMediaPayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendPollMessage

APIResponse sendPollMessage(instanceKey, data)

Send a Poll message.

Sends an interactive poll message to the given user. The poll message is a new feature that is currently in beta.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : PollMessagePayload =  // PollMessagePayload | Message data
try {
    val result : APIResponse = apiInstance.sendPollMessage(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendPollMessage")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendPollMessage")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` PollMessagePayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendTemplate

APIResponse sendTemplate(instanceKey, data)

Send a template message.

Sends an interactive template message to the given user. Note: The valid button types are "replyButton", "urlButton", "callButton"

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : TemplateButtonPayload =  // TemplateButtonPayload | Message data
try {
    val result : APIResponse = apiInstance.sendTemplate(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendTemplate")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendTemplate")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` TemplateButtonPayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendTemplateWithMedia

APIResponse sendTemplateWithMedia(instanceKey, data)

Send a template message with media.

Sends an interactive template message with a media header to the given user. Note: The valid button types are "replyButton", "urlButton", "callButton"

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : TemplateButtonWithMediaPayload =  // TemplateButtonWithMediaPayload | Message data
try {
    val result : APIResponse = apiInstance.sendTemplateWithMedia(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendTemplateWithMedia")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendTemplateWithMedia")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` TemplateButtonWithMediaPayload Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendTextMessage

APIResponse sendTextMessage(instanceKey, data)

Send a text message.

Sends a text message to the given user.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val `data` : TextMessage =  // TextMessage | Message data
try {
    val result : APIResponse = apiInstance.sendTextMessage(instanceKey, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendTextMessage")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendTextMessage")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
`data` TextMessage Message data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

sendVideo

APIResponse sendVideo(instanceKey, to, sendVideoRequest, caption)

Send raw video.

Sends a video message by uploading to the WhatsApp servers every time. This is not recommended for bulk sending.

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val to : kotlin.String = to_example // kotlin.String | The recipient's number
val sendVideoRequest : SendVideoRequest =  // SendVideoRequest | 
val caption : kotlin.String = caption_example // kotlin.String | Attached caption
try {
    val result : APIResponse = apiInstance.sendVideo(instanceKey, to, sendVideoRequest, caption)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#sendVideo")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#sendVideo")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
to kotlin.String The recipient's number
sendVideoRequest SendVideoRequest
caption kotlin.String Attached caption [optional]

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

uploadMedia

APIResponse uploadMedia(instanceKey, type, uploadMediaRequest)

Upload media.

Uploads media to WhatsApp servers and returns the media keys. Store the returned media keys, as you will need them to send media messages

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val type : kotlin.String = type_example // kotlin.String | Media type
val uploadMediaRequest : UploadMediaRequest =  // UploadMediaRequest | 
try {
    val result : APIResponse = apiInstance.uploadMedia(instanceKey, type, uploadMediaRequest)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#uploadMedia")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#uploadMedia")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
type kotlin.String Media type [enum: image, video, audio, document]
uploadMediaRequest UploadMediaRequest

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

uploadMediaFromUrl

APIResponse uploadMediaFromUrl(instanceKey, type, data)

Upload media from url.

Uploads media from a url to WhatsApp servers and returns the media keys. Store the returned media keys, as you will need them to send media messages

Example

// Import classes:
//import WhatsAPI.infrastructure.*
//import models.*

val apiInstance = MessageSendingApi()
val instanceKey : kotlin.String = instanceKey_example // kotlin.String | Instance key
val type : kotlin.String = type_example // kotlin.String | Media type
val `data` : UrlMediaUploadPayload =  // UrlMediaUploadPayload | Media data
try {
    val result : APIResponse = apiInstance.uploadMediaFromUrl(instanceKey, type, `data`)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling MessageSendingApi#uploadMediaFromUrl")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling MessageSendingApi#uploadMediaFromUrl")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
instanceKey kotlin.String Instance key
type kotlin.String Media type [enum: image, video, audio, document]
`data` UrlMediaUploadPayload Media data

Return type

APIResponse

Authorization

Configure ApiKeyAuth: ApiClient.apiKey["Authorization"] = "" ApiClient.apiKeyPrefix["Authorization"] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined