Overview
The Send Message module provides comprehensive methods for sending various message types, managing interactions, and controlling chat on WhatsApp. Build engaging, feature-rich messaging experiences with safe sending options, link previews, and more.Every method takes a
context.Context first, then the chat ID and other required values, then an optional options struct (pass nil when you don’t need it). It returns the parsed JSON response as a hypersender.Result (a map[string]any) and a *hypersender.Error (with StatusCode, Message, and Body) when the request fails. The examples assume ctx is a context.Context, such as context.Background() or your request’s context.Text Methods
Send various types of content to engage your audience with multimedia and interactive elements.Safe Send Text Message
Send text with the Go SDK’sSendTextSafe method. See the endpoint reference for its request fields and response flow.
- Basic usage
- Parameters
Send Text Message
Send plain text messages with link preview (optional) (learn more)- Basic usage
- Parameters
Media methods take a
hypersender.Media: either hypersender.MediaURL(url) (a publicly reachable URL) or hypersender.MediaFile(filename, reader) (any io.Reader, such as an *os.File). With MediaFile, the SDK uploads the file as multipart form data.Send Image Message
Send images to WhatsApp users via URL or local file. (learn more)- Basic Usage
- Parameters
Send Video Message
Send videos to WhatsApp users via URL or local file. (learn more)- Basic Usage
- Parameters
Send Voice Message
Send voice messages to WhatsApp users via URL or local file. (learn more)- Basic Usage
- Parameters
Send Location Message
Send location messages to WhatsApp users. (learn more)- Basic Usage
- Parameters
Send Poll Message
Send poll messages to WhatsApp users. (learn more)- Basic Usage
- Parameters
Send Link Custom Preview
Send a text message with a custom link preview. (learn more)- Basic Usage
- Parameters
Send File Message
Send any file type via URL or local file. (learn more)- Basic Usage
- Parameters
Send Contact Card
Send contact cards (vCard) to WhatsApp users. (learn more)- Basic Usage
- Parameters
Each
hypersender.ContactCard supports the API’s fields: VCard, FullName, Organization, PhoneNumber, WhatsAppID.You can send one or multiple contacts in a single message by including multiple items in the contacts slice.