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

# Manage WhatsApp Messages in Go

> React to, star, delete, and forward WhatsApp messages, mark them as seen, and read chats from Golang with the Hypersender WhatsApp API and its Go SDK.

## Overview

Manage sent messages programmatically: react, star, delete, forward, mark as seen, and read chat history. The examples assume `ctx` is a `context.Context`, such as `context.Background()`.

### React to Message

React to a WhatsApp message with an emoji. [(learn more)](https://docs.hypersender.com/v2/api-reference/whatsapp/send-messages/react-to-message.md)

> [tab] Basic Usage
>
> ```go theme={null}
> client := hypersender.NewClient()
>
> _, err := client.WhatsApp.ReactToMessage(ctx,
>     "20123456789@c.us",
>     "true_111111111111@c.us_3EB08F6AD2A432386EFA0E",
>     "🥵",
> )
> if err != nil {
>     log.Fatal(err)
> }
> ```

> [tab] Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | chatID | string | yes | The WhatsApp chat ID that contains the message |
> | messageID | string | yes | The ID of the message to react to |
> | reaction | string | yes | The emoji or Unicode reaction to apply |

> [!NOTE]
>
> Set `reaction` parameter to an empty string to remove an existing reaction from a message.

### Star Message

Star or unstar a specific message. [(learn more)](https://docs.hypersender.com/v2/api-reference/whatsapp/send-messages/star-message.md)

> [tab] Basic Usage
>
> ```go theme={null}
> client := hypersender.NewClient()
>
> _, err := client.WhatsApp.StarMessage(ctx,
>     "20123456789@c.us",
>     "true_111111111111@c.us_3EB08F6AD2A432386EFA0E",
>     true,
> )
> if err != nil {
>     log.Fatal(err)
> }
> ```

> [tab] Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | chatID | string | yes | The WhatsApp chat ID that contains the message |
> | messageID | string | yes | The ID of the message to star/unstar |
> | star | bool | yes | `true` to star the message, `false` to unstar |

> [!NOTE]
>
> By default, messages are unstarred. Call `StarMessage` with `star` set to `true` to star a message,
> or `false` to unstar it.

### Delete Message

Delete a message from a chat. [(learn more)](https://docs.hypersender.com/v2/api-reference/whatsapp/send-messages/delete-whatsapp-message.md)

> [tab] Basic Usage
>
> ```go theme={null}
> client := hypersender.NewClient()
>
> _, err := client.WhatsApp.DeleteMessage(ctx,
>     "20123456789@c.us",
>     "true_111111111111@c.us_3EB08F6AD2A432386EFA0E",
> )
> if err != nil {
>     log.Fatal(err)
> }
> ```

> [tab] Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | chatID | string | yes | The WhatsApp chat ID that contains the message |
> | messageID | string | yes | The ID of the message to delete |

### Forward Message

Forward a message to another chat. [(learn more)](https://docs.hypersender.com/v2/api-reference/whatsapp/send-messages/forward-message.md)

> [tab] Basic Usage
>
> ```go theme={null}
> client := hypersender.NewClient()
>
> _, err := client.WhatsApp.ForwardMessage(ctx,
>     "20123456789@c.us",
>     "true_111111111111@c.us_3EB08F6AD2A432386EFA0E",
> )
> if err != nil {
>     log.Fatal(err)
> }
> ```

> [tab] Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | chatID | string | yes | The destination chat ID to forward the message to |
> | messageID | string | yes | The ID of the message to forward |

### Send Seen

Mark a message as seen (read). For group messages, provide the participant JID. [(learn more)](https://docs.hypersender.com/v2/api-reference/whatsapp/send-messages/send-seen.md)

> [tab] Basic Usage
>
> ```go theme={null}
> client := hypersender.NewClient()
>
> _, err := client.WhatsApp.SendSeen(ctx,
>     "20123456789@c.us",
>     "true_111111111111@c.us_3EB08F6AD2A432386EFA0E",
>     nil, // &hypersender.SendSeenOptions{Participant: "20123456789@c.us"} for group messages
> )
> if err != nil {
>     log.Fatal(err)
> }
> ```

> [tab] Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | chatID | string | yes | The chat ID that contains the message |
> | messageID | string | yes | The message ID to mark as seen |
> | opts.Participant | string | no | Participant JID for group messages |

### Read Chat

Read a chat history window and optionally mark recent messages as read. [(learn more)](https://docs.hypersender.com/v2/api-reference/whatsapp/send-messages/read-chat.md)

> [tab] Basic Usage
>
> ```go theme={null}
> client := hypersender.NewClient()
>
> res, err := client.WhatsApp.ReadChat(ctx, "20123456789@c.us", &hypersender.ReadChatOptions{Messages: 20})
> if err != nil {
>     log.Fatal(err)
> }
>
> fmt.Println(res["ids"])
> ```

> [tab] Parameters
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | chatID | string | yes | The chat ID to read |
> | opts.Messages | int | no | Number of latest messages to read (latest first) |
> | opts.Days | int | no | Number of latest days to read (latest first) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.