Documentation
¶
Index ¶
- func MultipartRequest(method, url string, requestBody []byte) (*fasthttp.Request, error)
- func ValidateChatId(chatId ...string) error
- func ValidateMessageLength(message string, limit int) error
- func ValidateURL(link string) error
- func WithFormData(b bool) requestOptions
- func WithGetParams(addUrl string) requestOptions
- func WithMediaHost(b bool) requestOptions
- func WithSetMimetype(mtype mtype) requestOptions
- type APIResponse
- type AccountCategory
- func (c AccountCategory) GetAuthorizationCode(phoneNumber int) (*APIResponse, error)
- func (c AccountCategory) GetSettings() (*APIResponse, error)
- func (c AccountCategory) GetStateInstance() (*APIResponse, error)
- func (c AccountCategory) GetStatusInstance() (*APIResponse, error)
- func (c AccountCategory) GetWaSettings() (*APIResponse, error)
- func (c AccountCategory) Logout() (*APIResponse, error)
- func (c AccountCategory) QR() (*APIResponse, error)
- func (c AccountCategory) Reboot() (*APIResponse, error)
- func (c AccountCategory) SetProfilePicture(filepath string) (*APIResponse, error)
- func (c AccountCategory) SetSettings(options ...SetSettingsOption) (*APIResponse, error)
- type Contact
- type GetChatHistoryOption
- type GetLastStatusesOption
- type GreenAPI
- func (c *GreenAPI) Account() AccountCategory
- func (c *GreenAPI) Groups() GroupsCategory
- func (c *GreenAPI) Journals() JournalsCategory
- func (c *GreenAPI) Queues() QueuesCategory
- func (c *GreenAPI) ReadMark() ReadMarkCategory
- func (c *GreenAPI) Receiving() ReceivingCategory
- func (a *GreenAPI) Request(HTTPMethod, APIMethod string, requestBody []byte, options ...requestOptions) (*APIResponse, error)
- func (c *GreenAPI) Sending() SendingCategory
- func (c *GreenAPI) Service() ServiceCategory
- func (c *GreenAPI) Statuses() StatusesCategory
- type GreenAPIInterface
- type GreenAPIPartner
- type GreenAPIPartnerInterface
- type GroupsCategory
- func (c GroupsCategory) AddGroupParticipant(groupId, participantChatId string) (*APIResponse, error)
- func (c GroupsCategory) CreateGroup(groupName string, chatIds []string) (*APIResponse, error)
- func (c GroupsCategory) GetGroupData(groupId string) (*APIResponse, error)
- func (c GroupsCategory) LeaveGroup(groupId string) (*APIResponse, error)
- func (c GroupsCategory) RemoveAdmin(groupId, participantChatId string) (*APIResponse, error)
- func (c GroupsCategory) RemoveGroupParticipant(groupId, participantChatId string) (*APIResponse, error)
- func (c GroupsCategory) SetGroupAdmin(groupId, participantChatId string) (*APIResponse, error)
- func (c GroupsCategory) SetGroupPicture(filepath, groupId string) (*APIResponse, error)
- func (c GroupsCategory) UpdateGroupName(groupId, groupName string) (*APIResponse, error)
- type JournalsCategory
- func (c JournalsCategory) GetChatHistory(chatId string, options ...GetChatHistoryOption) (*APIResponse, error)
- func (c JournalsCategory) GetMessage(chatId, idMessage string) (*APIResponse, error)
- func (c JournalsCategory) LastIncomingMessages(options ...LastMessagesOption) (*APIResponse, error)
- func (c JournalsCategory) LastOutgoingMessages(options ...LastMessagesOption) (*APIResponse, error)
- type LastMessagesOption
- type PartnerCategory
- type PollOption
- type QueuesCategory
- type ReadChatOption
- type ReadMarkCategory
- type ReceiveNotificationOption
- type ReceivingCategory
- type RequestArchiveChat
- type RequestCheckWhatsapp
- type RequestCreateGroup
- type RequestDeleteInstanceAccount
- type RequestDeleteMessage
- type RequestDeleteNotification
- type RequestDeleteStatus
- type RequestDownloadFile
- type RequestForwardMessages
- type RequestGetAuthorizationCode
- type RequestGetAvatar
- type RequestGetChatHistory
- type RequestGetContactInfo
- type RequestGetGroupData
- type RequestGetLastStatuses
- type RequestGetMessage
- type RequestLastMessages
- type RequestLeaveGroup
- type RequestModifyGroupParticipant
- type RequestReadChat
- type RequestReceiveNotification
- type RequestSendContact
- type RequestSendFileByUpload
- type RequestSendFileByUrl
- type RequestSendLocation
- type RequestSendMediaStatus
- type RequestSendMessage
- type RequestSendPoll
- type RequestSendTextStatus
- type RequestSendVoiceStatus
- type RequestSetDisappearingChat
- type RequestSetGroupPicture
- type RequestSetProfilePicture
- type RequestSetSettings
- type RequestUpdateGroupName
- type RequestUploadFile
- type SendContactOption
- type SendFileByUploadOption
- type SendFileByUrlOption
- type SendLocationOption
- type SendMediaStatusOption
- type SendMessageOption
- type SendPollOption
- type SendTextStatusOption
- type SendVoiceStatusOption
- type SendingCategory
- func (c SendingCategory) ForwardMessages(chatId, chatIdFrom string, messages []string) (*APIResponse, error)
- func (c SendingCategory) SendContact(chatId string, contact Contact, options ...SendContactOption) (*APIResponse, error)
- func (c SendingCategory) SendFileByUpload(chatId, filePath, fileName string, options ...SendFileByUploadOption) (*APIResponse, error)
- func (c SendingCategory) SendFileByUrl(chatId, urlFile, fileName string, options ...SendFileByUrlOption) (*APIResponse, error)
- func (c SendingCategory) SendLocation(chatId string, latitude, longitude float32, options ...SendLocationOption) (*APIResponse, error)
- func (c SendingCategory) SendMessage(chatId, message string, options ...SendMessageOption) (*APIResponse, error)
- func (c SendingCategory) SendPoll(chatId, message string, pollOptions []string, options ...SendPollOption) (*APIResponse, error)
- func (c SendingCategory) UploadFile(filePath string) (*APIResponse, error)
- type ServiceCategory
- func (c ServiceCategory) ArchiveChat(chatId string) (*APIResponse, error)
- func (c ServiceCategory) CheckWhatsapp(phoneNumber int) (*APIResponse, error)
- func (c ServiceCategory) DeleteMessage(chatId, idMessage string) (*APIResponse, error)
- func (c ServiceCategory) GetAvatar(chatId string) (*APIResponse, error)
- func (c ServiceCategory) GetContactInfo(chatId string) (*APIResponse, error)
- func (c ServiceCategory) GetContacts() (*APIResponse, error)
- func (c ServiceCategory) SetDisappearingChat(chatId string, ephemeralExpiration int) (*APIResponse, error)
- func (c ServiceCategory) UnarchiveChat(chatId string) (*APIResponse, error)
- type SetSettingsOption
- func OptionalDelaySendMesssages(delaySendMessagesMilliseconds uint) SetSettingsOption
- func OptionalDeviceWebhook(deviceWebhook bool) SetSettingsOption
- func OptionalIncomingBlockWebhook(incomingBlockWebhook bool) SetSettingsOption
- func OptionalIncomingCallWebhook(incomingCallWebhook bool) SetSettingsOption
- func OptionalIncomingWebhook(incomingWebhook bool) SetSettingsOption
- func OptionalKeepOnlineStatus(keepOnlineStatus bool) SetSettingsOption
- func OptionalMarkIncomingMessagesRead(markIncomingMessagesReaded bool) SetSettingsOption
- func OptionalMarkIncomingMessagesReadOnReply(markIncomingMessagesReadedOnReply bool) SetSettingsOption
- func OptionalOutgoingAPIMessageWebhook(outgoingAPIMessageWebhook bool) SetSettingsOption
- func OptionalOutgoingMessageWebhook(outgoingMessageWebhook bool) SetSettingsOption
- func OptionalOutgoingWebhook(outgoingWebhook bool) SetSettingsOption
- func OptionalPollMessageWebhook(pollMessageWebhook bool) SetSettingsOption
- func OptionalStateWebhook(stateWebhook bool) SetSettingsOption
- func OptionalWebhookUrl(webhookUrl string) SetSettingsOption
- func OptionalWebhookUrlToken(webhookUrlToken string) SetSettingsOption
- type StatusesCategory
- func (c StatusesCategory) DeleteStatus(idMessage string) (*APIResponse, error)
- func (c StatusesCategory) GetIncomingStatuses(options ...GetLastStatusesOption) (*APIResponse, error)
- func (c StatusesCategory) GetOutgoingStatuses(options ...GetLastStatusesOption) (*APIResponse, error)
- func (c StatusesCategory) GetStatusStatistic(idMessage string) (*APIResponse, error)
- func (c StatusesCategory) SendMediaStatus(urlFile, fileName string, options ...SendMediaStatusOption) (*APIResponse, error)
- func (c StatusesCategory) SendTextStatus(message string, options ...SendTextStatusOption) (*APIResponse, error)
- func (c StatusesCategory) SendVoiceStatus(urlFile, fileName string, options ...SendVoiceStatusOption) (*APIResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MultipartRequest ¶
func ValidateChatId ¶
func ValidateMessageLength ¶
func ValidateURL ¶
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 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.
func (AccountCategory) GetStateInstance ¶
func (c AccountCategory) GetStateInstance() (*APIResponse, error)
Getting state of an instance.
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
func (AccountCategory) Logout ¶
func (c AccountCategory) Logout() (*APIResponse, error)
Logging out an instance.
func (AccountCategory) QR ¶
func (c AccountCategory) QR() (*APIResponse, error)
Getting QR code for authorization.
func (AccountCategory) Reboot ¶
func (c AccountCategory) Reboot() (*APIResponse, error)
Rebooting an instance.
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 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 ¶
func (*GreenAPI) Account ¶
func (c *GreenAPI) Account() AccountCategory
Account category presents methods for working with the account.
func (*GreenAPI) Groups ¶
func (c *GreenAPI) Groups() GroupsCategory
Groups category presents methods for working with group chats.
func (*GreenAPI) Journals ¶
func (c *GreenAPI) Journals() JournalsCategory
Journals present methods for working with incoming and outgoing messages.
func (*GreenAPI) Queues ¶
func (c *GreenAPI) Queues() QueuesCategory
Queues category presents methods for working with a messages queue.
func (*GreenAPI) ReadMark ¶
func (c *GreenAPI) ReadMark() ReadMarkCategory
ReadMark category presents methods for working with chat read mark.
func (*GreenAPI) Receiving ¶
func (c *GreenAPI) Receiving() ReceivingCategory
Receiving category presents methods for working with receiving events.
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.
func (*GreenAPI) Service ¶
func (c *GreenAPI) Service() ServiceCategory
Service category presents different service methods.
func (*GreenAPI) Statuses ¶
func (c *GreenAPI) Statuses() StatusesCategory
Status category presents methods for working with statuses.
type GreenAPIInterface ¶
type GreenAPIInterface interface {
Request(httpMethod, APImethod string, requestBody []byte, options ...requestOptions) (*APIResponse, error)
}
type GreenAPIPartner ¶
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.
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.
func (GroupsCategory) GetGroupData ¶
func (c GroupsCategory) GetGroupData(groupId string) (*APIResponse, error)
Getting a group chat data
func (GroupsCategory) LeaveGroup ¶
func (c GroupsCategory) LeaveGroup(groupId string) (*APIResponse, error)
Leaving a group chat.
func (GroupsCategory) RemoveAdmin ¶
func (c GroupsCategory) RemoveAdmin(groupId, participantChatId string) (*APIResponse, error)
Removing a participant from the group chat administration rights.
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.
func (GroupsCategory) SetGroupPicture ¶
func (c GroupsCategory) SetGroupPicture(filepath, groupId string) (*APIResponse, error)
Setting a group picture.
func (GroupsCategory) UpdateGroupName ¶
func (c GroupsCategory) UpdateGroupName(groupId, groupName string) (*APIResponse, error)
Change a group chat name.
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.
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.
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.
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 RequestDeleteInstanceAccount ¶
type RequestDeleteInstanceAccount struct {
IdInstance uint `json:"idInstance"`
}
type RequestDeleteMessage ¶
type RequestDeleteNotification ¶
type RequestDeleteNotification struct {
ReceiptId int `json:"receiptId"`
}
type RequestDeleteStatus ¶
type RequestDeleteStatus struct {
IdMessage string `json:"idMessage"`
}
type RequestDownloadFile ¶
type RequestForwardMessages ¶
type RequestGetAuthorizationCode ¶
type RequestGetAuthorizationCode struct {
PhoneNumber int `json:"phoneNumber"`
}
type RequestGetAvatar ¶
type RequestGetAvatar struct {
ChatId string `json:"chatId"`
}
type RequestGetChatHistory ¶
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 RequestLastMessages ¶
type RequestLastMessages struct {
Minutes int `json:"minutes,omitempty"`
}
type RequestLeaveGroup ¶
type RequestLeaveGroup struct {
GroupId string `json:"groupId"`
}
type RequestReadChat ¶
type RequestReceiveNotification ¶
type RequestReceiveNotification struct {
ReceiveTimeout int `json:"receiveTimeout,omitempty"`
}
type RequestSendContact ¶
type RequestSendFileByUpload ¶
type RequestSendFileByUrl ¶
type RequestSendLocation ¶
type RequestSendMediaStatus ¶
type RequestSendMessage ¶
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 RequestSendVoiceStatus ¶
type RequestSetGroupPicture ¶
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 RequestUploadFile ¶
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 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.
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.
type ServiceCategory ¶
type ServiceCategory struct {
GreenAPI GreenAPIInterface
}
func (ServiceCategory) ArchiveChat ¶
func (c ServiceCategory) ArchiveChat(chatId string) (*APIResponse, error)
Archiving a chat.
func (ServiceCategory) CheckWhatsapp ¶
func (c ServiceCategory) CheckWhatsapp(phoneNumber int) (*APIResponse, error)
Checking a WhatsApp account availability on a phone number.
func (ServiceCategory) DeleteMessage ¶
func (c ServiceCategory) DeleteMessage(chatId, idMessage string) (*APIResponse, error)
Deleting a message from a chat.
func (ServiceCategory) GetAvatar ¶
func (c ServiceCategory) GetAvatar(chatId string) (*APIResponse, error)
Getting a user or a group chat avatar.
func (ServiceCategory) GetContactInfo ¶
func (c ServiceCategory) GetContactInfo(chatId string) (*APIResponse, error)
Getting information about a contact.
func (ServiceCategory) GetContacts ¶
func (c ServiceCategory) GetContacts() (*APIResponse, error)
Getting a list of the current account contacts.
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.
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.
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.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
checkWhatsapp
command
|
|
|
createGroup
command
|
|
|
partnerMethods/createInstance
command
|
|
|
partnerMethods/getInstances
command
|
|
|
sendFileByUpload
command
|
|
|
sendMessage
command
|
|
|
sendPoll
command
|
|
|
sendTextStatus
command
|
|
|
setSettings
command
|
|
|
uploadFile
command
|