> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vzaps.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Messages

> Every Go SDK send function, accepted payloads, and complete examples

All send functions live under `client.Messages`.

Set `InstanceID` and `InstanceToken` on each request struct. They are sent as headers, not in the JSON body.

```go theme={null}
base := vzaps.MessageSendBaseRequest{
	InstanceScopedRequest: vzaps.InstanceScopedRequest{
		InstanceID:    "VZ...",
		InstanceToken: "instance-token",
	},
	Phone: "5511999999999",
}
```

## Common fields

Most send operations accept these fields:

| Field (JSON wire)     | Go struct field | Required | Description                                            |
| --------------------- | --------------- | -------- | ------------------------------------------------------ |
| —                     | `InstanceID`    | Yes      | VZaps instance ID (header).                            |
| —                     | `InstanceToken` | Yes      | Instance token (header).                               |
| `phone`               | `Phone`         | Yes      | Destination phone in international digits-only format. |
| `id`                  | —               | No       | Optional message identifier for the request.           |
| `delay`               | —               | No       | Send delay, when supported by the API.                 |
| `mentioned_ids`       | —               | No       | WhatsApp IDs to mention.                               |
| `reply_to_message_id` | —               | No       | WhatsApp message ID to reply to or quote.              |

<Note>
  Exported structs cover the main public API fields. For advanced options such as `id`, `delay`, or `reply_to_message_id`, use `client.Messages.Send()` or `client.Request()` with a map body.
</Note>

## Text

Function: `client.Messages.SendText()`

Payload:

| Field (JSON) | Go field  | Required |
| ------------ | --------- | -------- |
| `phone`      | `Phone`   | Yes      |
| `message`    | `Message` | Yes      |

```go theme={null}
_, err := client.Messages.SendText(ctx, vzaps.MessageSendTextRequest{
	MessageSendBaseRequest: vzaps.MessageSendBaseRequest{
		InstanceScopedRequest: vzaps.InstanceScopedRequest{
			InstanceID:    "VZ...",
			InstanceToken: "instance-token",
		},
		Phone: "5511999999999",
	},
	Message: "Hello, your instance is connected.",
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Image

Function: `client.Messages.SendImage()`

Payload:

| Field (JSON) | Go field  | Required |
| ------------ | --------- | -------- |
| `phone`      | `Phone`   | Yes      |
| `image`      | `Image`   | Yes      |
| `caption`    | `Caption` | No       |

`image` accepts a public `https://...` URL or a base64 data URL (`data:image/<mime>;base64,<data>`).

```go theme={null}
_, err := client.Messages.SendImage(ctx, vzaps.MessageSendImageRequest{
	MessageSendBaseRequest: base,
	Image:   "https://cdn.example.com/photo.jpg",
	Caption: "Optional caption",
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Audio

Function: `client.Messages.SendAudio()`

Payload:

| Field (JSON) | Go field | Required |
| ------------ | -------- | -------- |
| `phone`      | `Phone`  | Yes      |
| `audio`      | `Audio`  | Yes      |
| `ptt`        | `PTT`    | No       |

`audio` accepts a public URL or base64 data URL (`data:audio/<mime>;base64,...`). Use `PTT: true` when you want to send a voice note, if supported by the account flow.

```go theme={null}
_, err := client.Messages.SendAudio(ctx, vzaps.MessageSendAudioRequest{
	MessageSendBaseRequest: base,
	Audio: "https://cdn.example.com/audio.mp3",
	PTT:   false,
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Document

Function: `client.Messages.SendDocument()`

Payload:

| Field (JSON) | Go field   | Required |
| ------------ | ---------- | -------- |
| `phone`      | `Phone`    | Yes      |
| `document`   | `Document` | Yes      |
| `file_name`  | `FileName` | Yes      |
| `caption`    | `Caption`  | No       |

```go theme={null}
_, err := client.Messages.SendDocument(ctx, vzaps.MessageSendDocumentRequest{
	MessageSendBaseRequest: base,
	Document: "https://cdn.example.com/contract.pdf",
	FileName: "contract.pdf",
	Caption:  "Here is the contract",
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Video

Function: `client.Messages.SendVideo()`

Payload:

| Field (JSON)     | Go field  | Required |
| ---------------- | --------- | -------- |
| `phone`          | `Phone`   | Yes      |
| `video`          | `Video`   | Yes      |
| `caption`        | `Caption` | No       |
| `jpeg_thumbnail` | —         | No       |

```go theme={null}
_, err := client.Messages.SendVideo(ctx, vzaps.MessageSendVideoRequest{
	MessageSendBaseRequest: base,
	Video:   "https://cdn.example.com/video.mp4",
	Caption: "Demo video",
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Sticker

Function: `client.Messages.SendSticker()`

Payload:

| Field (JSON)    | Go field  | Required |
| --------------- | --------- | -------- |
| `phone`         | `Phone`   | Yes      |
| `sticker`       | `Sticker` | Yes      |
| `png_thumbnail` | —         | No       |

```go theme={null}
_, err := client.Messages.SendSticker(ctx, vzaps.MessageSendStickerRequest{
	MessageSendBaseRequest: base,
	Sticker: "https://cdn.example.com/sticker.webp",
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## GIF

Function: `client.Messages.SendGif()`

Payload:

| Field (JSON) | Go field  | Required |
| ------------ | --------- | -------- |
| `phone`      | `Phone`   | Yes      |
| `gif`        | `GIF`     | Yes      |
| `caption`    | `Caption` | No       |

```go theme={null}
_, err := client.Messages.SendGif(ctx, vzaps.MessageSendGifRequest{
	MessageSendBaseRequest: base,
	GIF:     "https://media.giphy.com/media/example/giphy.gif",
	Caption: "Animated GIF",
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Location

Function: `client.Messages.SendLocation()`

Payload:

| Field (JSON) | Go field    | Required |
| ------------ | ----------- | -------- |
| `phone`      | `Phone`     | Yes      |
| `latitude`   | `Latitude`  | Yes      |
| `longitude`  | `Longitude` | Yes      |
| `name`       | `Name`      | No       |
| `address`    | `Address`   | No       |

```go theme={null}
_, err := client.Messages.SendLocation(ctx, vzaps.MessageSendLocationRequest{
	MessageSendBaseRequest: base,
	Latitude:  -23.55052,
	Longitude: -46.633308,
	Name:      "Sao Paulo",
	Address:   "Sao Paulo, SP",
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Contact

Function: `client.Messages.SendContact()`

Payload:

| Field (JSON)    | Go field       | Required |
| --------------- | -------------- | -------- |
| `phone`         | `Phone`        | Yes      |
| `contact_name`  | `ContactName`  | Yes      |
| `contact_phone` | `ContactPhone` | Yes      |

```go theme={null}
_, err := client.Messages.SendContact(ctx, vzaps.MessageSendContactRequest{
	MessageSendBaseRequest: base,
	ContactName:  "Maria Silva",
	ContactPhone: "5511888888888",
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Buttons

Function: `client.Messages.SendButtons()`

Payload:

| Field (JSON) | Go field  | Required |
| ------------ | --------- | -------- |
| `phone`      | `Phone`   | Yes      |
| `message`    | `Message` | Yes      |
| `buttons`    | `Buttons` | Yes      |
| `footer`     | `Footer`  | No       |

```go theme={null}
_, err := client.Messages.SendButtons(ctx, vzaps.MessageSendButtonsRequest{
	MessageSendBaseRequest: base,
	Message: "Choose an option",
	Footer:  "VZaps",
	Buttons: []vzaps.MessageButton{
		{ID: "sales", Text: "Sales"},
		{ID: "support", Text: "Support"},
	},
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## List

Function: `client.Messages.SendList()`

Payload:

| Field (JSON)  | Go field      | Required |
| ------------- | ------------- | -------- |
| `phone`       | `Phone`       | Yes      |
| `title`       | `Title`       | Yes      |
| `description` | `Description` | Yes      |
| `button_text` | `ButtonText`  | Yes      |
| `sections`    | `Sections`    | Yes      |
| `footer`      | `Footer`      | No       |

```go theme={null}
_, err := client.Messages.SendList(ctx, vzaps.MessageSendListRequest{
	MessageSendBaseRequest: base,
	Title:       "Main menu",
	Description: "Choose an option",
	ButtonText:  "Open menu",
	Sections: []vzaps.MessageListSection{
		{
			Title: "Departments",
			Rows: []vzaps.MessageListRow{
				{ID: "sales", Title: "Sales", Description: "Talk to sales"},
				{ID: "support", Title: "Support", Description: "Talk to support"},
			},
		},
	},
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Link preview

Function: `client.Messages.SendLink()`

Payload:

| Field (JSON)       | Go field          | Required |
| ------------------ | ----------------- | -------- |
| `phone`            | `Phone`           | Yes      |
| `message`          | `Message`         | Yes      |
| `link_url`         | `LinkURL`         | Yes      |
| `title`            | `Title`           | Yes      |
| `link_description` | `LinkDescription` | Yes      |
| `jpeg_thumbnail`   | `JPEGThumbnail`   | No       |

```go theme={null}
_, err := client.Messages.SendLink(ctx, vzaps.MessageSendLinkRequest{
	MessageSendBaseRequest: base,
	Message:         "Check this link",
	LinkURL:         "https://vzaps.com",
	Title:           "VZaps",
	LinkDescription: "WhatsApp API for integrations",
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Poll

Function: `client.Messages.SendPoll()`

Payload:

| Field (JSON)               | Go field                 | Required |
| -------------------------- | ------------------------ | -------- |
| `phone`                    | `Phone`                  | Yes      |
| `name`                     | `Name`                   | Yes      |
| `options`                  | `Options`                | Yes      |
| `selectable_options_count` | `SelectableOptionsCount` | No       |
| `hide_participant_names`   | `HideParticipantNames`   | No       |
| `end_time`                 | `EndTime`                | No       |
| `allow_add_option`         | `AllowAddOption`         | No       |

```go theme={null}
_, err := client.Messages.SendPoll(ctx, vzaps.MessageSendPollRequest{
	MessageSendBaseRequest: base,
	Name:                   "Which channel do you prefer?",
	Options:                []string{"WhatsApp", "Email", "Phone"},
	SelectableOptionsCount: 1,
})
```

**Return:** envelope `{ code, success, data.message_id }` — message accepted/queued.

## Vote in a poll

Function: `client.Messages.PollVote()`

```go theme={null}
_, err := client.Messages.PollVote(ctx, vzaps.MessagePollVoteRequest{
	MessageSendBaseRequest: base,
	MessageID:       "3EB020510113BAA6561C",
	SelectedOptions: []string{"WhatsApp"},
})
```

## React and remove reaction

Functions:

* `client.Messages.React()`
* `client.Messages.RemoveReaction()`

```go theme={null}
_, err = client.Messages.React(ctx, vzaps.MessageReactRequest{
	MessageSendBaseRequest: base,
	MessageID: "3EB020510113BAA6561C",
	Reaction:  "👍",
})

_, err = client.Messages.RemoveReaction(ctx, vzaps.MessageReactRemoveRequest{
	MessageSendBaseRequest: base,
	MessageID: "3EB020510113BAA6561C",
})
```

## Presence and read receipts

Functions:

* `client.Messages.Presence()`
* `client.Messages.MarkRead()`

```go theme={null}
_, err = client.Messages.Presence(ctx, vzaps.MessagePresenceRequest{
	MessageSendBaseRequest: base,
	State: "composing",
})

_, err = client.Messages.MarkRead(ctx, vzaps.MessageMarkReadRequest{
	InstanceScopedRequest: vzaps.InstanceScopedRequest{
		InstanceID:    "VZ...",
		InstanceToken: "instance-token",
	},
	ID:   []string{"3EB020510113BAA6561C"},
	Chat: "5511999999999@s.whatsapp.net",
})
```

**Return:** envelope `{ code, success, data.details }`.

## Edit and delete message

Functions:

* `client.Messages.Edit()`
* `client.Messages.Delete()`

```go theme={null}
_, err = client.Messages.Edit(ctx, vzaps.MessageEditRequest{
	InstanceScopedRequest: vzaps.InstanceScopedRequest{
		InstanceID:    "VZ...",
		InstanceToken: "instance-token",
	},
	MessageID: "3EB020510113BAA6561C",
	Message:   "Edited text",
})

_, err = client.Messages.Delete(ctx, vzaps.MessageDeleteRequest{
	InstanceScopedRequest: vzaps.InstanceScopedRequest{
		InstanceID:    "VZ...",
		InstanceToken: "instance-token",
	},
	MessageID: "3EB020510113BAA6561C",
})
```

## Download media

Functions:

* `DownloadImage()`
* `DownloadVideo()`
* `DownloadAudio()`
* `DownloadDocument()`

```go theme={null}
media, err := client.Messages.DownloadImage(ctx, vzaps.MessageDownloadRequest{
	InstanceScopedRequest: vzaps.InstanceScopedRequest{
		InstanceID:    "VZ...",
		InstanceToken: "instance-token",
	},
})
fmt.Printf("%#v\n", media)
```

**Return:** envelope `{ code, success, data }` with `data.mimetype` and `data.data` (base64 or data URL).

## Standard response

Send methods return an API envelope indicating that the message was accepted/queued.

```go theme={null}
result, err := client.Messages.SendText(ctx, vzaps.MessageSendTextRequest{
	MessageSendBaseRequest: base,
	Message: "Hello",
})
fmt.Printf("%#v\n", result)
```

See the [API reference](/en/api-reference/introduction) for the latest response schemas.
