Skip to main content
Message calls live under client.messages(). The Java SDK sends instanceId in the URL and instanceToken as X-Instance-Token; neither field is included in the JSON body.

Text

client.messages().sendText(SendTextMessageRequest.builder()
    .instanceId(instanceId)
    .instanceToken(instanceToken)
    .phone("5511999999999")
    .message("Hello from Java")
    .build());
Return: envelope { code, success, data.message_id } — message accepted/queued.

Dynamic message payloads

Use GenericInstanceRequest for media and interactive payloads:
client.messages().sendImage(GenericInstanceRequest.builder()
    .instanceId(instanceId)
    .instanceToken(instanceToken)
    .put("phone", "5511999999999")
    .put("image", "https://example.com/image.png")
    .put("caption", "Image from Java")
    .build());

Returns for other methods

MethodReturn
sendImage, sendAudio, sendDocument, sendVideo, sendSticker, sendGif, sendLocation, sendContact, sendButtons, sendList, sendLink, sendPollenvelope { code, success, data.message_id }
pollVote, reactenvelope { code, success, data } with confirmation (details, timestamp, id)
removeReaction, presence, markRead, edit, deleteenvelope { code, success, data.details }
downloadImage, downloadVideo, downloadAudio, downloadDocumentenvelope { code, success, data.mimetype, data.data }
send(instanceId, path, body, token)same HTTP contract as the proxied path
Use GenericInstanceRequest for media and interactive payloads:
client.messages().sendImage(GenericInstanceRequest.builder()
    .instanceId(instanceId)
    .instanceToken(instanceToken)
    .put("phone", "5511999999999")
    .put("image", "https://example.com/image.png")
    .put("caption", "Image from Java")
    .build());
Return: envelope { code, success, data } with data.mimetype and data.data (base64 or data URL).

Escape hatch

client.messages().send(instanceId, "send/text", Map.of("phone", phone, "message", "Hi"), instanceToken);