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. |
ModelAPIResponse 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.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
String to = "to_example"; // String | The recipient's number
SendAudioRequest sendAudioRequest = new SendAudioRequest(); // SendAudioRequest |
String caption = "caption_example"; // String | Attached caption
try {
ModelAPIResponse result = apiInstance.sendAudio(instanceKey, to, sendAudioRequest, caption);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendAudio");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
to | String | The recipient's number | |
sendAudioRequest | SendAudioRequest | ||
caption | String | Attached caption | [optional] |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
ButtonMessagePayload data = new ButtonMessagePayload(); // ButtonMessagePayload | Message data
try {
ModelAPIResponse result = apiInstance.sendButtonMessage(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendButtonMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | ButtonMessagePayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
ButtonMessageWithMediaPayload data = new ButtonMessageWithMediaPayload(); // ButtonMessageWithMediaPayload | Message data
try {
ModelAPIResponse result = apiInstance.sendButtonWithMedia(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendButtonWithMedia");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | ButtonMessageWithMediaPayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse sendContact(instanceKey, data)
Send a contact message.
Sends a contact (vcard) message to the given user.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
ContactMessagePayload data = new ContactMessagePayload(); // ContactMessagePayload | Message data
try {
ModelAPIResponse result = apiInstance.sendContact(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendContact");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | ContactMessagePayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
String to = "to_example"; // String | The recipient's number
SendDocumentRequest sendDocumentRequest = new SendDocumentRequest(); // SendDocumentRequest |
String caption = "caption_example"; // String | Attached caption
try {
ModelAPIResponse result = apiInstance.sendDocument(instanceKey, to, sendDocumentRequest, caption);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendDocument");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
to | String | The recipient's number | |
sendDocumentRequest | SendDocumentRequest | ||
caption | String | Attached caption | [optional] |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
GroupInviteMessagePayload data = new GroupInviteMessagePayload(); // GroupInviteMessagePayload | Message data
try {
ModelAPIResponse result = apiInstance.sendGroupInvite(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendGroupInvite");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | GroupInviteMessagePayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
String to = "to_example"; // String | The recipient's number
UpdateProfilePicRequest updateProfilePicRequest = new UpdateProfilePicRequest(); // UpdateProfilePicRequest |
String caption = "caption_example"; // String | Attached caption
try {
ModelAPIResponse result = apiInstance.sendImage(instanceKey, to, updateProfilePicRequest, caption);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendImage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
to | String | The recipient's number | |
updateProfilePicRequest | UpdateProfilePicRequest | ||
caption | String | Attached caption | [optional] |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse sendListMessage(instanceKey, data)
Send a List message.
Sends an interactive List message to the given user.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
ListMessagePayload data = new ListMessagePayload(); // ListMessagePayload | Message data
try {
ModelAPIResponse result = apiInstance.sendListMessage(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendListMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | ListMessagePayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
LocationMessagePayload data = new LocationMessagePayload(); // LocationMessagePayload | Message data
try {
ModelAPIResponse result = apiInstance.sendLocation(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendLocation");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | LocationMessagePayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse sendMediaMessage(instanceKey, data)
Send a media message.
Sends a media message to the given user.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
SendMediaPayload data = new SendMediaPayload(); // SendMediaPayload | Message data
try {
ModelAPIResponse result = apiInstance.sendMediaMessage(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendMediaMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | SendMediaPayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
PollMessagePayload data = new PollMessagePayload(); // PollMessagePayload | Message data
try {
ModelAPIResponse result = apiInstance.sendPollMessage(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendPollMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | PollMessagePayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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"
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
TemplateButtonPayload data = new TemplateButtonPayload(); // TemplateButtonPayload | Message data
try {
ModelAPIResponse result = apiInstance.sendTemplate(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendTemplate");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | TemplateButtonPayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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"
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
TemplateButtonWithMediaPayload data = new TemplateButtonWithMediaPayload(); // TemplateButtonWithMediaPayload | Message data
try {
ModelAPIResponse result = apiInstance.sendTemplateWithMedia(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendTemplateWithMedia");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | TemplateButtonWithMediaPayload | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse sendTextMessage(instanceKey, data)
Send a text message.
Sends a text message to the given user.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
TextMessage data = new TextMessage(); // TextMessage | Message data
try {
ModelAPIResponse result = apiInstance.sendTextMessage(instanceKey, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendTextMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
data | TextMessage | Message data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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.
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
String to = "to_example"; // String | The recipient's number
SendVideoRequest sendVideoRequest = new SendVideoRequest(); // SendVideoRequest |
String caption = "caption_example"; // String | Attached caption
try {
ModelAPIResponse result = apiInstance.sendVideo(instanceKey, to, sendVideoRequest, caption);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#sendVideo");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
to | String | The recipient's number | |
sendVideoRequest | SendVideoRequest | ||
caption | String | Attached caption | [optional] |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
String type = "image"; // String | Media type
UploadMediaRequest uploadMediaRequest = new UploadMediaRequest(); // UploadMediaRequest |
try {
ModelAPIResponse result = apiInstance.uploadMedia(instanceKey, type, uploadMediaRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#uploadMedia");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
type | String | Media type | [enum: image, video, audio, document] |
uploadMediaRequest | UploadMediaRequest |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |
ModelAPIResponse 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
// Import classes:
import WhatsAPI.ApiClient;
import WhatsAPI.ApiException;
import WhatsAPI.Configuration;
import WhatsAPI.auth.*;
import WhatsAPI.models.*;
import whatsapi.MessageSendingApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("/api");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
MessageSendingApi apiInstance = new MessageSendingApi(defaultClient);
String instanceKey = "instanceKey_example"; // String | Instance key
String type = "image"; // String | Media type
UrlMediaUploadPayload data = new UrlMediaUploadPayload(); // UrlMediaUploadPayload | Media data
try {
ModelAPIResponse result = apiInstance.uploadMediaFromUrl(instanceKey, type, data);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessageSendingApi#uploadMediaFromUrl");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
instanceKey | String | Instance key | |
type | String | Media type | [enum: image, video, audio, document] |
data | UrlMediaUploadPayload | Media data |
- Content-Type: application/json
- Accept: /
Status code | Description | Response headers |
---|---|---|
200 | Success | - |
400 | Bad Request | - |
401 | Unauthorized | - |
404 | Instance not found | - |
500 | Internal Server Error | - |