whatsapp

package
v0.0.0-...-0b76103 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMediaID

func GenerateMediaID(whatsapp *client, filePath, mimeType string) (string, error)

func Languages

func Languages() languageCodes

func New

func New(ctx context.Context, apiVersion, accessToken, senderID string) *client

func SendMessage

func SendMessage[MessageType Text | Audio | Document | Image | Video | Sticker](whatsapp *client, body WhatsappBody[MessageType]) error

Types

type Audio

type Audio struct {
	Header
	Audio Media `json:"audio"`
}

Media types

type Document

type Document struct {
	Header
	Document Media `json:"document"`
}

Media types

type Header struct {
	MessagingProduct string `json:"messaging_product"`
	RecipientType    string `json:"recipient_type"`
	To               string `json:"to"`
	Type             string `json:"type"`
}

type Image

type Image struct {
	Header
	Image Media `json:"image"`
}

Media types

type Media

type Media struct {
	Id       string `json:"id"`                 // your media id
	Filename string `json:"filename,omitempty"` //your document filename
}

Media types

type Sticker

type Sticker struct {
	Header
	Sticker Media `json:"sticker"`
}

Media types

type Text

type Text struct {
	Header
	Text TextBody `json:"text"`
}

type TextBody

type TextBody struct {
	PreviewUrl bool   `json:"preview_url"`
	Body       string `json:"body"`
}

type Video

type Video struct {
	Header
	Video Media `json:"video"`
}

Media types

type WhatsappBody

type WhatsappBody[MessageType Text | Audio | Document | Image | Video | Sticker] struct {
	JSON MessageType
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL