greenapi

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: MIT Imports: 13 Imported by: 3

README

whatsapp-api-client-golang-v2

whatsapp-api-client-golang-v2 is a library for integration with WhatsApp messenger using the API service green-api.com. You should get a registration token and an account ID in your personal cabinet to use the library. There is a free developer account tariff.

You can find the v1 version here - https://github.com/green-api/whatsapp-api-client-golang

API

The documentation for the REST API can be found at the link. The library is a wrapper for the REST API, so the documentation at the link above also applies.

Support Support Support

Guides & News

Guides News News

Authorization

To send a message or perform other Green API methods, the WhatsApp account in the phone app must be authorized. To authorize the account, go to your cabinet and scan the QR code using the WhatsApp app.

Installation

Make sure that you have Go installed with a version of 1.20 or newer

go version

Create a module for your project if you didn't:

go mod init ModuleName

Install the library:

go get github.com/green-api/whatsapp-api-client-golang-v2

Import:

import (
	greenapi "github.com/green-api/whatsapp-api-client-golang-v2"
)

Usage and examples

How to initialize an object:

GreenAPI := greenapi.GreenAPI{
		APIURL:           "https://api.green-api.com",
		MediaURL:         "https://media.green-api.com",
		IDInstance:       "1101000001",
		APITokenInstance: "d75b3a66374942c5b3c019c698abc2067e151558acbd412345",
	}

All methods of this library return two objects: *APIResponse and error.

You can see the APIResponse format in the types.go

How to send a message:

Link to example: sendMessage/main.go

response, _ := GreenAPI.Sending().SendMessage(
		"11001234567@c.us",
		"Hello",
	)

How to create a group:

Link to example: createGroup/main.go

response, _ := GreenAPI.Groups().CreateGroup(
		"Group Title",
		[]string{
			"11001211111@c.us",
			"11001222222@c.us",
			"11001233333@c.us",
		},
	)

How to send file by upload:

Link to example: sendFileByUpload/main.go

response, _ := GreenAPI.Sending().SendFileByUpload(
		"11001234567@c.us",
		"C:/Users/user/Desktop/Pictures/image.png",
		"image.png",
	)

How to send a message with a poll:

Link to example: sendPoll/main.go

response, _ := GreenAPI.Sending().SendPoll(
		"11001234567@c.us", 
		"Choose a color:", 
		[]string{"Red", "Green", "Blue"}, 
	)

How to send a text status:

Link to example: sendTextStatus

response, _ := GreenAPI.Statuses().SendTextStatus(
		"Text of the status", 
		greenapi.OptionalFont("SERIF"),
		greenapi.OptionalBackgroundColorText("#87CEEB"),
		//greenapi.OptionalParticipantsTextStatus([]string{"1234567890@c.us", "1234567890@c.us"}),
	)

Partner methods

To use partner methods you have to initialize another object:

Partner := greenapi.GreenAPIPartner{
		PartnerToken: "gac.1234567891234567891234567891213456789",
		Email: "mail@email.com", // email is optional
	}

Now you can use Partner methods as usual methods, but through the "Partner" object:

How to get instances:

Link to the example: partnerMethods/getInstances/main.go

response, _ := Partner.Partner().GetInstances()

How to create an instance:

Link to the example: partnerMethods/createInstance/main.go

response, _ := Partner.Partner().CreateInstance(
		greenapi.OptionalWebhookUrl("webhook_url"),
		greenapi.OptionalWebhookUrlToken("auth_token"),
		greenapi.OptionalDelaySendMesssages(5000),
		greenapi.OptionalMarkIncomingMessagesRead(true),
		greenapi.OptionalMarkIncomingMessagesReadOnReply(true),
		greenapi.OptionalOutgoingWebhook(true),
		greenapi.OptionalOutgoingMessageWebhook(true),
		greenapi.OptionalOutgoingAPIMessageWebhook(true),
		greenapi.OptionalStateWebhook(true),
		greenapi.OptionalIncomingWebhook(true),
		greenapi.OptionalDeviceWebhook(true),
		greenapi.OptionalKeepOnlineStatus(true),
		greenapi.OptionalPollMessageWebhook(true),
		greenapi.OptionalIncomingBlockWebhook(true),
		greenapi.OptionalIncomingCallWebhook(true),
	)

How to delete an instance:

Link to the example: partnerMethods/deleteInstanceAccount/main.go

response, _ := Partner.Partner().DeleteInstanceAccount(1101000000)

Optional parameters

Note that functions might have optional arguments, which you can pass or ignore. Optional parameters are passed as functions into the method's arguments and have similar naming format:

greenapi.Optional + name of parameter

For example, in the SetSettings method all the arguments are optional. Here is an example of how it works:

response, _ := GreenAPI.Account().SetSettings(
        greenapi.OptionalDelaySendMesssages(5000),
		greenapi.OptionalOutgoingWebhook(true),
		greenapi.OptionalIncomingWebhook(true),
		// greenapi.OptionalWebhookUrl("webhook_url"),
		// greenapi.OptionalWebhookUrlToken("auth_token"),
		// greenapi.OptionalMarkIncomingMessagesRead(true),
		// greenapi.OptionalMarkIncomingMessagesReadOnReply(true),
		// greenapi.OptionalOutgoingMessageWebhook(true),
		// greenapi.OptionalOutgoingAPIMessageWebhook(true),
		// greenapi.OptionalStateWebhook(true),
		// greenapi.OptionalDeviceWebhook(true),
		// greenapi.OptionalKeepOnlineStatus(true),
		// greenapi.OptionalPollMessageWebhook(true),
		// greenapi.OptionalIncomingBlockWebhook(true),
		// greenapi.OptionalIncomingCallWebhook(true),
	)

In this example, only DelaySendMessages, OutgoingWebhook and IncomingWebhook settings will be changed, other settings are commented so they will not be passed. However, you can uncomment any setting that you prefer. The settings that were not used will not be affected

One more example of using optional parameters, this time let's use sendMessage method:

response, _ := GreenAPI.Sending().SendMessage(
		"11001234567@c.us",
		"Hello",
		greenapi.OptionalLinkPreview(false), // turns off link preview if there is any
		greenapi.OptionalQuotedMessageId("BAE59673E71FC5DB"), // quotes specified message
	)

List of examples

Description Link to example
How to send a message sendMessage/main.go
How to send a file by uploading from the disk sendFileByUpload/main.go
How to upload a file to an external drive uploadFile/main.go
How to send a poll sendPoll/main.go
How to check if there is a WhatsApp account on the phone number checkWhatsapp/main.go
How to set instance settings setSettings/main.go
How to create a group createGroup/main.go
How to send a text status sendTextStatus/main.go
How to get all instances of the account partnerMethods/getInstances/main.go
How to create an instance partnerMethods/createInstance/main.go
How to delete an instance partnerMethods/deleteInstanceAccount/main.go

List of all library methods

API method Description Documentation link
Account().GetSettings The method is designed to get the current settings of the account GetSettings
Account().GetWaSettings The method is designed to get information about the WhatsApp account GetSettings
Account().SetSettings The method is designed to set the account settings SetSettings
Account().GetStateInstance The method is designed to get the state of the account GetStateInstance
Account().Reboot The method is designed to restart the account Reboot
Account().Logout The method is designed to unlogin the account Logout
Account().QR The method is designed to get a QR code QR
Account().SetProfilePicture The method is designed to set the avatar of the account SetProfilePicture
Account().GetAuthorizationCode The method is designed to authorize an instance by phone number GetAuthorizationCode
Groups().CreateGroup The method is designed to create a group chat CreateGroup
Groups().UpdateGroupName The method changes the name of the group chat UpdateGroupName
Groups().GetGroupData The method gets group chat data GetGroupData
Groups().AddGroupParticipant The method adds a participant to the group chat AddGroupParticipant
Groups().RemoveGroupParticipant The method removes the participant from the group chat RemoveGroupParticipant
Groups().SetGroupAdmin The method designates a member of a group chat as an administrator SetGroupAdmin
Groups().RemoveAdmin The method deprives the participant of group chat administration rights RemoveAdmin
Groups().SetGroupPicture The method sets the avatar of the group SetGroupPicture
Groups().LeaveGroup The method logs the user of the current account out of the group chat LeaveGroup
Journals().GetChatHistory The method returns the chat message history GetChatHistory
Journals().GetMessage The method returns a chat message GetMessage
Journals().LastIncomingMessages The method returns the most recent incoming messages of the account LastIncomingMessages
Journals().LastOutgoingMessages The method returns the last sent messages of the account LastOutgoingMessages
Queues().ShowMessagesQueue The method is designed to get the list of messages that are in the queue to be sent ShowMessagesQueue
Queues().ClearMessagesQueue The method is designed to clear the queue of messages to be sent ClearMessagesQueue
ReadMark().ReadChat The method is designed to mark chat messages as read ReadChat
Receiving().ReceiveNotification The method is designed to receive a single incoming notification from the notification queue ReceiveNotification
Receiving().DeleteNotification The method is designed to remove an incoming notification from the notification queue DeleteNotification
Receiving().DownloadFile The method is for downloading received and sent files DownloadFile
Sending().SendMessage The method is designed to send a text message to a personal or group chat SendMessage
Sending().SendFileByUpload The method is designed to send a file loaded through a form (form-data) SendFileByUpload
Sending().SendFileByUrl The method is designed to send a file downloaded via a link SendFileByUrl
Sending().UploadFile The method allows you to upload a file from the local file system, which can later be sent using the SendFileByUrl method UploadFile
Sending().SendLocation The method is designed to send a geolocation message SendLocation
Sending().SendContact The method is for sending a message with a contact SendContact
Sending().ForwardMessages The method is designed for forwarding messages to a personal or group chat ForwardMessages
Sending().SendPoll The method is designed for sending messages with a poll to a private or group chat SendPoll
Service().CheckWhatsapp The method checks if there is a WhatsApp account on the phone number CheckWhatsapp
Service().GetAvatar The method returns the avatar of the correspondent or group chat GetAvatar
Service().GetContacts The method is designed to get a list of contacts of the current account GetContacts
Service().GetContactInfo The method is designed to obtain information about the contact GetContactInfo
Service().DeleteMessage The method deletes the message from chat DeleteMessage
Service().ArchiveChat The method archives the chat ArchiveChat
Service().UnarchiveChat The method unarchives the chat UnarchiveChat
Service().SetDisappearingChat The method is designed to change the settings of disappearing messages in chats SetDisappearingChat
Partner().GetInstances The method is for getting all the account instances created by the partner. GetInstances
Partner().CreateInstance The method is for creating an instance. CreateInstance
Partner().DeleteInstanceAccount The method is for deleting an instance. DeleteInstanceAccount
Statuses().SendTextStatus The method is aimed for sending a text status SendTextStatus
Statuses().SendVoiceStatus The method is aimed for sending a voice status SendVoiceStatus
Statuses().SendMediaStatus The method is aimed for sending a voice status SendMediaStatus
Statuses().GetOutgoingStatuses The method returns the outgoing statuses of the account GetOutgoingStatuses
Statuses().GetIncomingStatuses The method returns the incoming status messages of the account GetIncomingStatuses
Statuses().GetStatusStatistic The method returns an array of recipients marked for a given status. GetStatusStatistic
Statuses().DeleteStatus The method is aimed for deleting status. DeleteStatus

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MultipartRequest

func MultipartRequest(method, url string, requestBody []byte) (*fasthttp.Request, error)

func ValidateChatId

func ValidateChatId(chatId ...string) error

func ValidateMessageLength

func ValidateMessageLength(message string, limit int) error

func ValidateURL

func ValidateURL(link string) error

func WithFormData

func WithFormData(b bool) requestOptions

func WithGetParams

func WithGetParams(addUrl string) requestOptions

func WithMediaHost

func WithMediaHost(b bool) requestOptions

func WithSetMimetype

func WithSetMimetype(mtype mtype) requestOptions

Types

type APIResponse

type APIResponse struct {
	StatusCode    int             `json:"status_code"`
	StatusMessage []byte          `json:"status_message"`
	Body          json.RawMessage `json:"body"`
	Timestamp     time.Time       `json:"timestamp"`
}

type AccountCategory

type AccountCategory struct {
	GreenAPI GreenAPIInterface
}

func (AccountCategory) GetAuthorizationCode

func (c AccountCategory) GetAuthorizationCode(phoneNumber int) (*APIResponse, error)

Authorize an instance by phone number.

https://green-api.com/en/docs/api/account/GetAuthorizationCode/

func (AccountCategory) GetSettings

func (c AccountCategory) GetSettings() (*APIResponse, error)

Getting settings of an instance.

https://green-api.com/en/docs/api/account/GetSettings/

func (AccountCategory) GetStateInstance

func (c AccountCategory) GetStateInstance() (*APIResponse, error)

Getting state of an instance.

https://green-api.com/en/docs/api/account/GetStateInstance/

func (AccountCategory) GetStatusInstance

func (c AccountCategory) GetStatusInstance() (*APIResponse, error)

Getting the status of an instance socket connection with WhatsApp.

https://green-api.com/en/docs/api/account/GetStatusInstance/

func (AccountCategory) GetWaSettings

func (c AccountCategory) GetWaSettings() (*APIResponse, error)

Getting information about the WhatsApp account

https://green-api.com/en/docs/api/account/GetWaSettings/

func (AccountCategory) Logout

func (c AccountCategory) Logout() (*APIResponse, error)

Logging out an instance.

https://green-api.com/docs/api/account/Logout/

func (AccountCategory) QR

func (c AccountCategory) QR() (*APIResponse, error)

Getting QR code for authorization.

https://green-api.com/en/docs/api/account/QR/

func (AccountCategory) Reboot

func (c AccountCategory) Reboot() (*APIResponse, error)

Rebooting an instance.

https://green-api.com/en/docs/api/account/Reboot/

func (AccountCategory) SetProfilePicture

func (c AccountCategory) SetProfilePicture(filepath string) (*APIResponse, error)

Setting a profile picture.

https://green-api.com/en/docs/api/account/SetProfilePicture/

func (AccountCategory) SetSettings

func (c AccountCategory) SetSettings(options ...SetSettingsOption) (*APIResponse, error)

Applying settings for an instance.

https://green-api.com/en/docs/api/account/SetSettings/

Add optional arguments by passing these functions:

OptionalWebhookUrl(webhookUrl string) <- URL for sending notifications.
OptionalWebhookUrlToken(webhookUrlToken string) <- Token to access your notification server.
OptionalDelaySendMesssages(delaySendMessagesMilliseconds int) <- Message sending delay.
OptionalMarkIncomingMessagesRead(markIncomingMessagesReaded bool) <- Mark incoming messages as read or not.
OptionalMarkIncomingMessagesReadOnReply(markIncomingMessagesReadedOnReply bool) <- Mark incoming messages as read when posting a message to the chat via API.
OptionalOutgoingWessebhook(outgoingWebhook bool) <- Get notifications about outgoing messages sending/delivering/reading statuses.
OptionalOutgoingMageWebhook(outgoingMessageWebhook bool) <- Get notifications about messages sent from the phone.
OptionalOutgoingAPIMessageWebhook(outgoingAPIMessageWebhook bool) <- Get notifications about messages sent from API.
OptionalStateWebhook(stateWebhook bool) <- Get notifications about the instance authorization state change.
OptionalIncomingWebhook(incomingWebhook bool) <- Get notifications about incoming messages and files.
OptionalDeviceWebhook(deviceWebhook bool) <- Get notifications about the device (phone) and battery level.
OptionalKeepOnlineStatus(keepOnlineStatus bool) <- Sets the 'Online' status for your Whatsapp account.
OptionalPollMessageWebhook(pollMessageWebhook bool) <- Get notifications about the creation of a poll and voting in the poll.
OptionalIncomingBlockWebhook(incomingBlockWebhook bool) <- Get notifications about adding a chat to the list of blocked contacts.
OptionalIncomingCallWebhook(incomingCallWebhook bool) <- Get notifications about incoming call statuses.

type Contact

type Contact struct {
	PhoneContact int    `json:"phoneContact"` //phoneContact comment
	FirstName    string `json:"firstName,omitempty"`
	MiddleName   string `json:"middleName,omitempty"`
	LastName     string `json:"lastName,omitempty"`
	Company      string `json:"company,omitempty"`
}

type GetChatHistoryOption

type GetChatHistoryOption func(*RequestGetChatHistory) error

func OptionalCount

func OptionalCount(count int) GetChatHistoryOption

The number of messages to get. The default is 100

type GetLastStatusesOption

type GetLastStatusesOption func(*RequestGetLastStatuses) error

func OptionalMinutesOfStatuses

func OptionalMinutesOfStatuses(minutes int) GetLastStatusesOption

Time in minutes for which the status messages should be displayed (1440 minutes by default)

type GreenAPI

type GreenAPI struct {
	APIURL           string
	MediaURL         string
	IDInstance       string
	APITokenInstance string
}

func (*GreenAPI) Account

func (c *GreenAPI) Account() AccountCategory

Account category presents methods for working with the account.

https://green-api.com/en/docs/api/account/

func (*GreenAPI) Groups

func (c *GreenAPI) Groups() GroupsCategory

Groups category presents methods for working with group chats.

https://green-api.com/en/docs/api/groups/

func (*GreenAPI) Journals

func (c *GreenAPI) Journals() JournalsCategory

Journals present methods for working with incoming and outgoing messages.

https://green-api.com/en/docs/api/journals/

func (*GreenAPI) Queues

func (c *GreenAPI) Queues() QueuesCategory

Queues category presents methods for working with a messages queue.

https://green-api.com/en/docs/api/queues/

func (*GreenAPI) ReadMark

func (c *GreenAPI) ReadMark() ReadMarkCategory

ReadMark category presents methods for working with chat read mark.

https://green-api.com/en/docs/api/marks/

func (*GreenAPI) Receiving

func (c *GreenAPI) Receiving() ReceivingCategory

Receiving category presents methods for working with receiving events.

https://green-api.com/en/docs/api/receiving/

func (*GreenAPI) Request

func (a *GreenAPI) Request(HTTPMethod, APIMethod string, requestBody []byte, options ...requestOptions) (*APIResponse, error)

func (*GreenAPI) Sending

func (c *GreenAPI) Sending() SendingCategory

Sending category presents methods for sending different messages.

https://green-api.com/en/docs/api/sending/

func (*GreenAPI) Service

func (c *GreenAPI) Service() ServiceCategory

Service category presents different service methods.

https://green-api.com/en/docs/api/service/

func (*GreenAPI) Statuses

func (c *GreenAPI) Statuses() StatusesCategory

Status category presents methods for working with statuses.

https://green-api.com/en/docs/api/statuses/

type GreenAPIInterface

type GreenAPIInterface interface {
	Request(httpMethod, APImethod string, requestBody []byte, options ...requestOptions) (*APIResponse, error)
}

type GreenAPIPartner

type GreenAPIPartner struct {
	PartnerToken string
	Email        string
}

func (*GreenAPIPartner) Partner

func (c *GreenAPIPartner) Partner() PartnerCategory

Partner category presents exclusive methods for partners. The partnership scheme involves deeper integration with the service and working with a larger number of instances on your side:

* Instance management via API

* Postpaid billing system (starting from the second month of operation)

* Daily billing (for created and not deleted instances)

* Dedicated support line

For questions regarding connection to the partnership scheme and additional conditions, please contact us via email at support@green-api.com or via chat on the website.

https://green-api.com/en/docs/partners/

func (*GreenAPIPartner) PartnerRequest

func (a *GreenAPIPartner) PartnerRequest(HTTPMethod, APIMethod string, requestBody []byte) (*APIResponse, error)

type GreenAPIPartnerInterface

type GreenAPIPartnerInterface interface {
	PartnerRequest(HTTPMethod, APIMethod string, requestBody []byte) (*APIResponse, error)
}

type GroupsCategory

type GroupsCategory struct {
	GreenAPI GreenAPIInterface
}

func (GroupsCategory) AddGroupParticipant

func (c GroupsCategory) AddGroupParticipant(groupId, participantChatId string) (*APIResponse, error)

Adding a participant to a group chat.

https://green-api.com/en/docs/api/groups/AddGroupParticipant/

func (GroupsCategory) CreateGroup

func (c GroupsCategory) CreateGroup(groupName string, chatIds []string) (*APIResponse, error)

Creating a group chat.

https://green-api.com/en/docs/api/groups/CreateGroup/

func (GroupsCategory) GetGroupData

func (c GroupsCategory) GetGroupData(groupId string) (*APIResponse, error)

Getting a group chat data

https://green-api.com/en/docs/api/groups/GetGroupData/

func (GroupsCategory) LeaveGroup

func (c GroupsCategory) LeaveGroup(groupId string) (*APIResponse, error)

Leaving a group chat.

https://green-api.com/en/docs/api/groups/LeaveGroup/

func (GroupsCategory) RemoveAdmin

func (c GroupsCategory) RemoveAdmin(groupId, participantChatId string) (*APIResponse, error)

Removing a participant from the group chat administration rights.

https://green-api.com/en/docs/api/groups/RemoveAdmin/

func (GroupsCategory) RemoveGroupParticipant

func (c GroupsCategory) RemoveGroupParticipant(groupId, participantChatId string) (*APIResponse, error)

Removing a participant from a group chat.

https://green-api.com/en/docs/api/groups/RemoveGroupParticipant/

func (GroupsCategory) SetGroupAdmin

func (c GroupsCategory) SetGroupAdmin(groupId, participantChatId string) (*APIResponse, error)

Setting a group chat participant as an administrator.

https://green-api.com/en/docs/api/groups/SetGroupAdmin/

func (GroupsCategory) SetGroupPicture

func (c GroupsCategory) SetGroupPicture(filepath, groupId string) (*APIResponse, error)

Setting a group picture.

https://green-api.com/en/docs/api/groups/SetGroupPicture/

func (GroupsCategory) UpdateGroupName

func (c GroupsCategory) UpdateGroupName(groupId, groupName string) (*APIResponse, error)

Change a group chat name.

https://green-api.com/en/docs/api/groups/UpdateGroupName/

type JournalsCategory

type JournalsCategory struct {
	GreenAPI GreenAPIInterface
}

func (JournalsCategory) GetChatHistory

func (c JournalsCategory) GetChatHistory(chatId string, options ...GetChatHistoryOption) (*APIResponse, error)

Getting a chat messages history.

https://green-api.com/en/docs/api/journals/GetChatHistory/

Add optional arguments by passing these functions:

OptionalCount(count int) <- The number of messages to get. The default is 100

func (JournalsCategory) GetMessage

func (c JournalsCategory) GetMessage(chatId, idMessage string) (*APIResponse, error)

Getting a message information.

https://green-api.com/en/docs/api/journals/GetMessage/

func (JournalsCategory) LastIncomingMessages

func (c JournalsCategory) LastIncomingMessages(options ...LastMessagesOption) (*APIResponse, error)

Getting the last incoming messages of the account.

https://green-api.com/en/docs/api/journals/LastIncomingMessages/

Add optional arguments by passing these functions:

OptionalMinutes(minutes int) <- Time in minutes for which the messages should be displayed (default is 1440 minutes)

func (JournalsCategory) LastOutgoingMessages

func (c JournalsCategory) LastOutgoingMessages(options ...LastMessagesOption) (*APIResponse, error)

Getting the last outgoung messages of the account.

https://green-api.com/en/docs/api/journals/LastOutgoingMessages/

OptionalMinutes(minutes int) <- Time in minutes for which the messages should be displayed (default is 1440 minutes)

type LastMessagesOption

type LastMessagesOption func(*RequestLastMessages) error

func OptionalMinutes

func OptionalMinutes(minutes int) LastMessagesOption

Time in minutes for which the messages should be displayed (default is 1440 minutes)

type PartnerCategory

type PartnerCategory struct {
	GreenAPIPartner GreenAPIPartnerInterface
}

func (PartnerCategory) CreateInstance

func (c PartnerCategory) CreateInstance(options ...SetSettingsOption) (*APIResponse, error)

Creating an instance.

https://green-api.com/en/docs/partners/createInstance/

Add optional arguments by passing these functions:

OptionalWebhookUrl(webhookUrl string) <- URL for sending notifications.
OptionalWebhookUrlToken(webhookUrlToken string) <- Token to access your notification server.
OptionalDelaySendMesssages(delaySendMessagesMilliseconds int) <- Message sending delay.
OptionalMarkIncomingMessagesRead(markIncomingMessagesReaded bool) <- Mark incoming messages as read or not.
OptionalMarkIncomingMessagesReadOnReply(markIncomingMessagesReadedOnReply bool) <- Mark incoming messages as read when posting a message to the chat via API.
OptionalOutgoingWebhook(outgoingWebhook bool) <- Get notifications about outgoing messages sending/delivering/reading statuses.
OptionalOutgoingMessageWebhook(outgoingMessageWebhook bool) <- Get notifications about messages sent from the phone.
OptionalOutgoingAPIMessageWebhook(outgoingAPIMessageWebhook bool) <- Get notifications about messages sent from API.
OptionalStateWebhook(stateWebhook bool) <- Get notifications about the instance authorization state change.
OptionalIncomingWebhook(incomingWebhook bool) <- Get notifications about incoming messages and files.
OptionalDeviceWebhook(deviceWebhook bool) <- Get notifications about the device (phone) and battery level.
OptionalKeepOnlineStatus(keepOnlineStatus bool) <- Sets the 'Online' status for your Whatsapp account.
OptionalPollMessageWebhook(pollMessageWebhook bool) <- Get notifications about the creation of a poll and voting in the poll.
OptionalIncomingBlockWebhook(incomingBlockWebhook bool) <- Get notifications about adding a chat to the list of blocked contacts.
OptionalIncomingCallWebhook(incomingCallWebhook bool) <- Get notifications about incoming call statuses.

func (PartnerCategory) DeleteInstanceAccount

func (c PartnerCategory) DeleteInstanceAccount(idInstance uint) (*APIResponse, error)

Deleting an instance.

https://green-api.com/en/docs/partners/deleteInstanceAccount/

func (PartnerCategory) GetInstances

func (c PartnerCategory) GetInstances() (*APIResponse, error)

Getting all the account instances created by the partner.

https://green-api.com/en/docs/partners/getInstances/

type PollOption

type PollOption struct {
	OptionName string `json:"optionName"`
}

type QueuesCategory

type QueuesCategory struct {
	GreenAPI GreenAPIInterface
}

func (QueuesCategory) ClearMessagesQueue

func (c QueuesCategory) ClearMessagesQueue() (*APIResponse, error)

Clearing the queue of messages to be sent.

https://green-api.com/en/docs/api/queues/ClearMessagesQueue/

func (QueuesCategory) ShowMessagesQueue

func (c QueuesCategory) ShowMessagesQueue() (*APIResponse, error)

Getting a list of messages in the queue to be sent.

https://green-api.com/en/docs/api/queues/ShowMessagesQueue/

type ReadChatOption

type ReadChatOption func(*RequestReadChat) error

func OptionalIdMessage

func OptionalIdMessage(idMessage string) ReadChatOption

ID of the incoming message to be marked as read. If not specified, then all unread messages in the chat will be marked as read.

type ReadMarkCategory

type ReadMarkCategory struct {
	GreenAPI GreenAPIInterface
}

func (ReadMarkCategory) ReadChat

func (c ReadMarkCategory) ReadChat(chatId string, options ...ReadChatOption) (*APIResponse, error)

Marking messages in a chat as read.

https://green-api.com/en/docs/api/marks/ReadChat/

Add optional arguments by passing these functions:

OptionalIdMessage(idMessage string) <- ID of the incoming message to be marked as read. If not specified, then all unread messages in the chat will be marked as read.

type ReceiveNotificationOption

type ReceiveNotificationOption func(*RequestReceiveNotification) error

func OptionalReceiveTimeout

func OptionalReceiveTimeout(seconds int) ReceiveNotificationOption

Notification waiting timeout, takes a value from 5 to 60 seconds (5 seconds by default)

type ReceivingCategory

type ReceivingCategory struct {
	GreenAPI GreenAPIInterface
}

func (ReceivingCategory) DeleteNotification

func (c ReceivingCategory) DeleteNotification(receiptId int) (*APIResponse, error)

Deleting an incoming notification from the notification queue.

https://green-api.com/en/docs/api/receiving/technology-http-api/DeleteNotification/

func (ReceivingCategory) DownloadFile

func (c ReceivingCategory) DownloadFile(chatId, idMessage string) (*APIResponse, error)

Downloading incoming and outgoing files from a chat.

https://green-api.com/en/docs/api/receiving/files/DownloadFile/

func (ReceivingCategory) ReceiveNotification

func (c ReceivingCategory) ReceiveNotification(options ...ReceiveNotificationOption) (*APIResponse, error)

Receiving one incoming notification from the notifications queue.

https://green-api.com/en/docs/api/receiving/technology-http-api/ReceiveNotification/

Add optional arguments by passing these functions:

OptionalReceiveTimeout(seconds int) <- Notification waiting timeout, takes a value from 5 to 60 seconds (5 seconds by default)

type RequestArchiveChat

type RequestArchiveChat struct {
	ChatId string `json:"chatId"`
}

type RequestCheckWhatsapp

type RequestCheckWhatsapp struct {
	PhoneNumber int `json:"phoneNumber"`
}

type RequestCreateGroup

type RequestCreateGroup struct {
	GroupName string   `json:"groupName"`
	ChatIds   []string `json:"chatIds"`
}

type RequestDeleteInstanceAccount

type RequestDeleteInstanceAccount struct {
	IdInstance uint `json:"idInstance"`
}

type RequestDeleteMessage

type RequestDeleteMessage struct {
	ChatId    string `json:"chatId"`
	IdMessage string `json:"idMessage"`
}

type RequestDeleteNotification

type RequestDeleteNotification struct {
	ReceiptId int `json:"receiptId"`
}

type RequestDeleteStatus

type RequestDeleteStatus struct {
	IdMessage string `json:"idMessage"`
}

type RequestDownloadFile

type RequestDownloadFile struct {
	ChatId    string `json:"chatId"`
	IdMessage string `json:"idMessage"`
}

type RequestForwardMessages

type RequestForwardMessages struct {
	ChatId     string   `json:"chatId"`
	ChatIdFrom string   `json:"chatIdFrom"`
	Messages   []string `json:"messages"`
}

type RequestGetAuthorizationCode

type RequestGetAuthorizationCode struct {
	PhoneNumber int `json:"phoneNumber"`
}

type RequestGetAvatar

type RequestGetAvatar struct {
	ChatId string `json:"chatId"`
}

type RequestGetChatHistory

type RequestGetChatHistory struct {
	ChatId string `json:"chatId"`
	Count  int    `json:"count,omitempty"`
}

type RequestGetContactInfo

type RequestGetContactInfo struct {
	ChatId string `json:"chatId"`
}

type RequestGetGroupData

type RequestGetGroupData struct {
	GroupId string `json:"groupId"`
}

type RequestGetLastStatuses

type RequestGetLastStatuses struct {
	Minutes int `json:"minutes,omitempty"`
}

type RequestGetMessage

type RequestGetMessage struct {
	ChatId    string `json:"chatId"`
	IdMessage string `json:"idMessage"`
}

type RequestLastMessages

type RequestLastMessages struct {
	Minutes int `json:"minutes,omitempty"`
}

type RequestLeaveGroup

type RequestLeaveGroup struct {
	GroupId string `json:"groupId"`
}

type RequestModifyGroupParticipant

type RequestModifyGroupParticipant struct {
	GroupId           string `json:"groupId"`
	ParticipantChatId string `json:"participantChatId"`
}

type RequestReadChat

type RequestReadChat struct {
	ChatId    string `json:"chatId"`
	IdMessage string `json:"idMessage,omitempty"`
}

type RequestReceiveNotification

type RequestReceiveNotification struct {
	ReceiveTimeout int `json:"receiveTimeout,omitempty"`
}

type RequestSendContact

type RequestSendContact struct {
	ChatId          string  `json:"chatId"`
	Contact         Contact `json:"contact"`
	QuotedMessageId string  `json:"quotedMessageId,omitempty"`
}

type RequestSendFileByUpload

type RequestSendFileByUpload struct {
	ChatId          string `json:"chatId"`
	File            string `json:"file"`
	FileName        string `json:"fileName"`
	Caption         string `json:"caption,omitempty"`
	QuotedMessageId string `json:"quotedMessageId,omitempty"`
}

type RequestSendFileByUrl

type RequestSendFileByUrl struct {
	ChatId          string `json:"chatId"`
	UrlFile         string `json:"urlFile"`
	FileName        string `json:"fileName"`
	Caption         string `json:"caption,omitempty"`
	QuotedMessageId string `json:"quotedMessageId,omitempty"`
}

type RequestSendLocation

type RequestSendLocation struct {
	ChatId          string  `json:"chatId"`
	NameLocation    string  `json:"nameLocation,omitempty"`
	Address         string  `json:"address,omitempty"`
	Latitude        float32 `json:"latitude"`
	Longitude       float32 `json:"longitude"`
	QuotedMessageId string  `json:"quotedMessageId,omitempty"`
}

type RequestSendMediaStatus

type RequestSendMediaStatus struct {
	UrlFile      string   `json:"urlFile"`
	FileName     string   `json:"fileName"`
	Caption      string   `json:"caption,omitempty"`
	Participants []string `json:"participants,omitempty"`
}

type RequestSendMessage

type RequestSendMessage struct {
	ChatId          string `json:"chatId"`
	Message         string `json:"message"`
	QuotedMessageId string `json:"quotedMessageId,omitempty"`
	LinkPreview     *bool  `json:"linkPreview,omitempty"`
}

type RequestSendPoll

type RequestSendPoll struct {
	ChatId          string       `json:"chatId"`
	Message         string       `json:"message"`
	PollOptions     []PollOption `json:"options"`
	MultipleAnswers *bool        `json:"multipleAnswers,omitempty"`
	QuotedMessageId string       `json:"quotedMessageId,omitempty"`
}

type RequestSendTextStatus

type RequestSendTextStatus struct {
	Message         string   `json:"message"`
	BackgroundColor string   `json:"backgroundColor,omitempty"`
	Font            string   `json:"font,omitempty"`
	Participants    []string `json:"participants,omitempty"`
}

type RequestSendVoiceStatus

type RequestSendVoiceStatus struct {
	UrlFile         string   `json:"urlFile"`
	FileName        string   `json:"fileName"`
	BackgroundColor string   `json:"backgroundColor,omitempty"`
	Participants    []string `json:"participants,omitempty"`
}

type RequestSetDisappearingChat

type RequestSetDisappearingChat struct {
	ChatId              string `json:"chatId"`
	EphemeralExpiration int    `json:"ephemeralExpiration"`
}

type RequestSetGroupPicture

type RequestSetGroupPicture struct {
	File    string `json:"file"`
	GroupId string `json:"groupId"`
}

type RequestSetProfilePicture

type RequestSetProfilePicture struct {
	File string `json:"file"`
}

type RequestSetSettings

type RequestSetSettings struct {
	WebhookUrl                        *string `json:"webhookUrl,omitempty"`
	WebhookUrlToken                   *string `json:"webhookUrlToken,omitempty"`
	DelaySendMessagesMilliseconds     *uint   `json:"delaySendMessagesMilliseconds,omitempty"`
	MarkIncomingMessagesReaded        string  `json:"markIncomingMessagesReaded,omitempty"`
	MarkIncomingMessagesReadedOnReply string  `json:"markIncomingMessagesReadedOnReply,omitempty"`
	OutgoingWebhook                   string  `json:"outgoingWebhook,omitempty"`
	OutgoingMessageWebhook            string  `json:"outgoingMessageWebhook,omitempty"`
	OutgoingAPIMessageWebhook         string  `json:"outgoingAPIMessageWebhook,omitempty"`
	StateWebhook                      string  `json:"stateWebhook,omitempty"`
	IncomingWebhook                   string  `json:"incomingWebhook,omitempty"`
	DeviceWebhook                     string  `json:"deviceWebhook,omitempty"`
	KeepOnlineStatus                  string  `json:"keepOnlineStatus,omitempty"`
	PollMessageWebhook                string  `json:"pollMessageWebhook,omitempty"`
	IncomingBlockWebhook              string  `json:"incomingBlockWebhook,omitempty"`
	IncomingCallWebhook               string  `json:"incomingCallWebhook,omitempty"`
}

type RequestUpdateGroupName

type RequestUpdateGroupName struct {
	GroupId   string `json:"groupId"`
	GroupName string `json:"groupName"`
}

type RequestUploadFile

type RequestUploadFile struct {
	File     []byte `json:"file"`
	FileName string `json:"fileName"`
}

type SendContactOption

type SendContactOption func(*RequestSendContact) error

func OptionalQuotedMessageIdContact

func OptionalQuotedMessageIdContact(quotedMessageId string) SendContactOption

If specified, the message will be sent quoting the specified chat message.

type SendFileByUploadOption

type SendFileByUploadOption func(*RequestSendFileByUpload) error

func OptionalCaptionSendUpload

func OptionalCaptionSendUpload(caption string) SendFileByUploadOption

File caption. Caption added to video, images. The maximum field length is 20000 characters.

func OptionalQuotedMessageIdSendUpload

func OptionalQuotedMessageIdSendUpload(quotedMessageId string) SendFileByUploadOption

If specified, the message will be sent quoting the specified chat message.

type SendFileByUrlOption

type SendFileByUrlOption func(*RequestSendFileByUrl) error

func OptionalCaptionSendUrl

func OptionalCaptionSendUrl(caption string) SendFileByUrlOption

File caption. Caption added to video, images. The maximum field length is 20000 characters.

func OptionalQuotedMessageIdSendUrl

func OptionalQuotedMessageIdSendUrl(quotedMessageId string) SendFileByUrlOption

If specified, the message will be sent quoting the specified chat message.

type SendLocationOption

type SendLocationOption func(*RequestSendLocation) error

func OptionalAddress

func OptionalAddress(address string) SendLocationOption

Location address.

func OptionalNameLocation

func OptionalNameLocation(nameLocation string) SendLocationOption

Location name.

func OptionalQuotedMessageIdLocation

func OptionalQuotedMessageIdLocation(quotedMessageId string) SendLocationOption

If specified, the message will be sent quoting the specified chat message.

type SendMediaStatusOption

type SendMediaStatusOption func(*RequestSendMediaStatus) error

func OptionalCaptionMediaStatus

func OptionalCaptionMediaStatus(caption string) SendMediaStatusOption

Media status caption.

func OptionalParticipantsMediaStatus

func OptionalParticipantsMediaStatus(participants []string) SendMediaStatusOption

An array of strings with contact IDs for whom the status will be available. If the field value is empty, the status will be available to all contacts.

type SendMessageOption

type SendMessageOption func(*RequestSendMessage) error

func OptionalLinkPreview

func OptionalLinkPreview(linkPreview bool) SendMessageOption

The parameter includes displaying a preview and a description of the link. Enabled by default.

func OptionalQuotedMessageId

func OptionalQuotedMessageId(quotedMessageId string) SendMessageOption

Quoted message ID. If present, the message will be sent quoting the specified chat message.

type SendPollOption

type SendPollOption func(*RequestSendPoll) error

func OptionalMultipleAnswers

func OptionalMultipleAnswers(multipleAnswers bool) SendPollOption

Allow multiple answers. Disabled by default.

func OptionalPollQuotedMessageId

func OptionalPollQuotedMessageId(quotedMessageId string) SendPollOption

If specified, the message will be sent quoting the specified chat message.

type SendTextStatusOption

type SendTextStatusOption func(*RequestSendTextStatus) error

func OptionalBackgroundColorText

func OptionalBackgroundColorText(backgroundColor string) SendTextStatusOption

Status background. Default: #FFFFFF.

func OptionalFont

func OptionalFont(font string) SendTextStatusOption

Text font. Accepts values: SERIF, SANS_SERIF, NORICAN_REGULAR, BRYNDAN_WRITE, OSWALD_HEAVY

func OptionalParticipantsTextStatus

func OptionalParticipantsTextStatus(participants []string) SendTextStatusOption

An array of strings with contact IDs for whom the status will be available. If the field value is empty, the status will be available to all contacts.

type SendVoiceStatusOption

type SendVoiceStatusOption func(*RequestSendVoiceStatus) error

func OptionalBackgroundColorVoice

func OptionalBackgroundColorVoice(backgroundColor string) SendVoiceStatusOption

Status background. Default: #FFFFFF.

func OptionalParticipantsVoiceStatus

func OptionalParticipantsVoiceStatus(participants []string) SendVoiceStatusOption

An array of strings with contact IDs for whom the status will be available. If the field value is empty, the status will be available to all contacts.

type SendingCategory

type SendingCategory struct {
	GreenAPI GreenAPIInterface
}

func (SendingCategory) ForwardMessages

func (c SendingCategory) ForwardMessages(chatId, chatIdFrom string, messages []string) (*APIResponse, error)

Forwarding messages from one chat to another.

https://green-api.com/en/docs/api/sending/ForwardMessages/

func (SendingCategory) SendContact

func (c SendingCategory) SendContact(chatId string, contact Contact, options ...SendContactOption) (*APIResponse, error)

Sending a contact message.

https://green-api.com/en/docs/api/sending/SendContact/

Add optional arguments by passing these functions:

OptionalQuotedMessageIdContact(quotedMessageId string) <- If specified, the message will be sent quoting the specified chat message.

func (SendingCategory) SendFileByUpload

func (c SendingCategory) SendFileByUpload(chatId, filePath, fileName string, options ...SendFileByUploadOption) (*APIResponse, error)

Uploading and sending a file.

https://green-api.com/en/docs/api/sending/SendFileByUpload/

Add optional arguments by passing these functions:

OptionalCaptionSendUpload(caption string) <- File caption. Caption added to video, images. The maximum field length is 20000 characters.
OptionalQuotedMessageIdSendUpload(quotedMessageId string) <- If specified, the message will be sent quoting the specified chat message.

func (SendingCategory) SendFileByUrl

func (c SendingCategory) SendFileByUrl(chatId, urlFile, fileName string, options ...SendFileByUrlOption) (*APIResponse, error)

Sending a file by URL.

https://green-api.com/en/docs/api/sending/SendFileByUrl/

Add optional arguments by passing these functions:

OptionalCaptionSendUrl(caption string) <- File caption. Caption added to video, images. The maximum field length is 20000 characters.
OptionalQuotedMessageIdSendUrl(quotedMessageId string) <- If specified, the message will be sent quoting the specified chat message.

func (SendingCategory) SendLocation

func (c SendingCategory) SendLocation(chatId string, latitude, longitude float32, options ...SendLocationOption) (*APIResponse, error)

Sending a location message.

https://green-api.com/en/docs/api/sending/SendLocation/

Add optional arguments by passing these functions:

OptionalNameLocation(nameLocation string) <- Location name.
OptionalAddress(address string) <- Location address.
OptionalQuotedMessageIdLocation(quotedMessageId string) <- If specified, the message will be sent quoting the specified chat message.

func (SendingCategory) SendMessage

func (c SendingCategory) SendMessage(chatId, message string, options ...SendMessageOption) (*APIResponse, error)

Sending a text message.

https://green-api.com/en/docs/api/sending/SendMessage/

Add optional arguments by passing these functions:

OptionalQuotedMessageId(quotedMessageId string) <- Quoted message ID. If present, the message will be sent quoting the specified chat message.
OptionalLinkPreview(linkPreview bool) <- The parameter includes displaying a preview and a description of the link. Enabled by default.

func (SendingCategory) SendPoll

func (c SendingCategory) SendPoll(chatId, message string, pollOptions []string, options ...SendPollOption) (*APIResponse, error)

Sending messages with a poll.

https://green-api.com/en/docs/api/sending/SendPoll/

Add optional arguments by passing these functions:

OptionalMultipleAnswers(multipleAnswers bool) <- Allow multiple answers. Disabled by default.
OptionalPollQuotedMessageId(quotedMessageId string) <- If specified, the message will be sent quoting the specified chat message.

func (SendingCategory) UploadFile

func (c SendingCategory) UploadFile(filePath string) (*APIResponse, error)

Uploading a file to the cloud storage.

https://green-api.com/en/docs/api/sending/UploadFile/

type ServiceCategory

type ServiceCategory struct {
	GreenAPI GreenAPIInterface
}

func (ServiceCategory) ArchiveChat

func (c ServiceCategory) ArchiveChat(chatId string) (*APIResponse, error)

Archiving a chat.

https://green-api.com/en/docs/api/service/archiveChat/

func (ServiceCategory) CheckWhatsapp

func (c ServiceCategory) CheckWhatsapp(phoneNumber int) (*APIResponse, error)

Checking a WhatsApp account availability on a phone number.

https://green-api.com/en/docs/api/service/CheckWhatsapp/

func (ServiceCategory) DeleteMessage

func (c ServiceCategory) DeleteMessage(chatId, idMessage string) (*APIResponse, error)

Deleting a message from a chat.

https://green-api.com/en/docs/api/service/deleteMessage/

func (ServiceCategory) GetAvatar

func (c ServiceCategory) GetAvatar(chatId string) (*APIResponse, error)

Getting a user or a group chat avatar.

https://green-api.com/en/docs/api/service/GetAvatar/

func (ServiceCategory) GetContactInfo

func (c ServiceCategory) GetContactInfo(chatId string) (*APIResponse, error)

Getting information about a contact.

https://green-api.com/en/docs/api/service/GetContactInfo/

func (ServiceCategory) GetContacts

func (c ServiceCategory) GetContacts() (*APIResponse, error)

Getting a list of the current account contacts.

https://green-api.com/en/docs/api/service/GetContacts/

func (ServiceCategory) SetDisappearingChat

func (c ServiceCategory) SetDisappearingChat(chatId string, ephemeralExpiration int) (*APIResponse, error)

Changing settings of disappearing messages in chats.

https://green-api.com/en/docs/api/service/SetDisappearingChat/

The standard settings of the application are to be used:

0 (off), 86400 (24 hours), 604800 (7 days), 7776000 (90 days).

func (ServiceCategory) UnarchiveChat

func (c ServiceCategory) UnarchiveChat(chatId string) (*APIResponse, error)

Unarchiving a chat.

https://green-api.com/en/docs/api/service/unarchiveChat/

type SetSettingsOption

type SetSettingsOption func(*RequestSetSettings) error

func OptionalDelaySendMesssages

func OptionalDelaySendMesssages(delaySendMessagesMilliseconds uint) SetSettingsOption

Message sending delay.

func OptionalDeviceWebhook

func OptionalDeviceWebhook(deviceWebhook bool) SetSettingsOption

Get notifications about the device (phone) and battery level.

func OptionalIncomingBlockWebhook

func OptionalIncomingBlockWebhook(incomingBlockWebhook bool) SetSettingsOption

Get notifications about adding a chat to the list of blocked contacts.

func OptionalIncomingCallWebhook

func OptionalIncomingCallWebhook(incomingCallWebhook bool) SetSettingsOption

Get notifications about incoming call statuses.

func OptionalIncomingWebhook

func OptionalIncomingWebhook(incomingWebhook bool) SetSettingsOption

Get notifications about incoming messages and files.

func OptionalKeepOnlineStatus

func OptionalKeepOnlineStatus(keepOnlineStatus bool) SetSettingsOption

Sets the 'Online' status for your Whatsapp account.

func OptionalMarkIncomingMessagesRead

func OptionalMarkIncomingMessagesRead(markIncomingMessagesReaded bool) SetSettingsOption

Mark incoming messages as read or not.

func OptionalMarkIncomingMessagesReadOnReply

func OptionalMarkIncomingMessagesReadOnReply(markIncomingMessagesReadedOnReply bool) SetSettingsOption

Mark incoming messages as read when posting a message to the chat via API.

func OptionalOutgoingAPIMessageWebhook

func OptionalOutgoingAPIMessageWebhook(outgoingAPIMessageWebhook bool) SetSettingsOption

Get notifications about messages sent from API.

func OptionalOutgoingMessageWebhook

func OptionalOutgoingMessageWebhook(outgoingMessageWebhook bool) SetSettingsOption

Get notifications about messages sent from the phone.

func OptionalOutgoingWebhook

func OptionalOutgoingWebhook(outgoingWebhook bool) SetSettingsOption

Get notifications about outgoing messages sending/delivering/reading statuses

func OptionalPollMessageWebhook

func OptionalPollMessageWebhook(pollMessageWebhook bool) SetSettingsOption

Get notifications about the creation of a poll and voting in the poll.

func OptionalStateWebhook

func OptionalStateWebhook(stateWebhook bool) SetSettingsOption

Get notifications about the instance authorization state change.

func OptionalWebhookUrl

func OptionalWebhookUrl(webhookUrl string) SetSettingsOption

URL for sending notifications.

func OptionalWebhookUrlToken

func OptionalWebhookUrlToken(webhookUrlToken string) SetSettingsOption

Token to access your notification server.

type StatusesCategory

type StatusesCategory struct {
	GreenAPI GreenAPIInterface
}

func (StatusesCategory) DeleteStatus

func (c StatusesCategory) DeleteStatus(idMessage string) (*APIResponse, error)

Deleting a posted status.

https://green-api.com/en/docs/api/statuses/DeleteStatus/

func (StatusesCategory) GetIncomingStatuses

func (c StatusesCategory) GetIncomingStatuses(options ...GetLastStatusesOption) (*APIResponse, error)

Getting the incoming statuses of an account.

https://green-api.com/en/docs/api/statuses/GetIncomingStatuses/

Add optional arguments by passing these functions:

OptionalMinutesOfStatuses(minutes int) <- Time in minutes for which the status messages should be displayed (1440 minutes by default)

func (StatusesCategory) GetOutgoingStatuses

func (c StatusesCategory) GetOutgoingStatuses(options ...GetLastStatusesOption) (*APIResponse, error)

Getting the outgoing statuses of an account.

https://green-api.com/en/docs/api/statuses/GetOutgoingStatuses/

Add optional arguments by passing these functions:

OptionalMinutesOfStatuses(minutes int) <- Time in minutes for which the status messages should be displayed (1440 minutes by default)

func (StatusesCategory) GetStatusStatistic

func (c StatusesCategory) GetStatusStatistic(idMessage string) (*APIResponse, error)

Getting an array of recipients marked sent/delivered/read for a given status.

https://green-api.com/en/docs/api/statuses/GetStatusStatistic/

func (StatusesCategory) SendMediaStatus

func (c StatusesCategory) SendMediaStatus(urlFile, fileName string, options ...SendMediaStatusOption) (*APIResponse, error)

Sending a media status.

https://green-api.com/en/docs/api/statuses/SendMediaStatus/

Add optional arguments by passing these functions:

OptionalCaptionMediaStatus(caption string) <- Media status caption.
OptionalParticipantsMediaStatus(participants []string) <- An array of strings with contact IDs for whom the status will be available. If the field value is empty, the status will be available to all contacts.

func (StatusesCategory) SendTextStatus

func (c StatusesCategory) SendTextStatus(message string, options ...SendTextStatusOption) (*APIResponse, error)

Sending a text status.

https://green-api.com/docs/api/statuses/SendTextStatus/

Add optional arguments by passing these functions:

OptionalBackgroundColorText(backgroundColor string) <- Status background. Default: #FFFFFF.
OptionalFont(font string) <- Text font. Accepts values: SERIF, SANS_SERIF, NORICAN_REGULAR, BRYNDAN_WRITE, OSWALD_HEAVY
OptionalParticipantsTextStatus(participants []string) <- An array of strings with contact IDs for whom the status will be available. If the field value is empty, the status will be available to all contacts.

func (StatusesCategory) SendVoiceStatus

func (c StatusesCategory) SendVoiceStatus(urlFile, fileName string, options ...SendVoiceStatusOption) (*APIResponse, error)

Sending a voice status.

https://green-api.com/en/docs/api/statuses/SendVoiceStatus/

Add optional arguments by passing these functions:

OptionalBackgroundColorVoice(backgroundColor string) <- Status background. Default: #FFFFFF.
OptionalParticipantsVoiceStatus(participants []string) <- An array of strings with contact IDs for whom the status will be available. If the field value is empty, the status will be available to all contacts.

Directories

Path Synopsis
examples
checkWhatsapp command
createGroup command
sendMessage command
sendPoll command
sendTextStatus command
setSettings command
uploadFile command

Jump to

Keyboard shortcuts

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