Skip to main content
Version: IOTA

Send a Data Message

An IndexationPayload is a payload type that can be used to attach arbitrary data and a key index to a message. To send a payload, you should at least provide the index. The data part (as bytes[]) is optional.

You can use the ClientMessageBuilder.withDataString(data: String) function function to attach data to a message.

public static void getDataMessage() {
Client iota = node();

Message message = iota.message().withIndexString("Hello").withDataString("Tangle").finish();

System.out.println("Message sent" +;

MessageId[] fetched_message_ids = iota.getMessage().indexString("Hello");
System.out.println("Messages with Hello index: " + Arrays.toString(fetched_message_ids));

Output example:

"message": {
"parentMessageIds": [
"payload": {
  • You can find the message using its message ID in the Tangle explorer.
  • There are three prepared payloads(transaction, milestone, and indexation). However, at the time, the indexation payload is the only one in use.
  • data contains arbitrary data encoded in bytes.
  • Please note there is no IOTA address involved while sending data messages. Data messages are referenced using their message ID or index key.
  • IOTA addresses are part of the UTXO data structure that is sent using the SignedTransaction payload.