Documentation
¶
Overview ¶
Package sdkwa provides a Go client for the SDKWA WhatsApp HTTP API
Index ¶
- type AddGroupParticipantResponse
- type CheckWhatsAppResponse
- type ClearMessagesQueueResponse
- type Client
- func (c *Client) AddGroupParticipant(ctx context.Context, groupID, participantChatID string, ...) (*AddGroupParticipantResponse, error)
- func (c *Client) ArchiveChat(ctx context.Context, chatID string, opts ...*RequestOptions) error
- func (c *Client) CheckWhatsApp(ctx context.Context, phoneNumber int64, opts ...*RequestOptions) (*CheckWhatsAppResponse, error)
- func (c *Client) ClearMessagesQueue(ctx context.Context, opts ...*RequestOptions) (*ClearMessagesQueueResponse, error)
- func (c *Client) CreateApp(ctx context.Context, params CreateAppParams, opts ...*RequestOptions) (*CreateAppResponse, error)
- func (c *Client) CreateGroup(ctx context.Context, groupName string, chatIDs []string, ...) (*CreateGroupResponse, error)
- func (c *Client) CreateInstance(ctx context.Context, params CreateInstanceParams) (map[string]interface{}, error)
- func (c *Client) DeleteInstance(ctx context.Context, idInstance int64) (map[string]interface{}, error)
- func (c *Client) DeleteMessage(ctx context.Context, chatID, messageID string, opts ...*RequestOptions) error
- func (c *Client) DeleteNotification(ctx context.Context, receiptID int64, opts ...*RequestOptions) (*DeleteNotificationResponse, error)
- func (c *Client) ExtendInstance(ctx context.Context, params ExtendInstanceParams) (map[string]interface{}, error)
- func (c *Client) GetAuthorizationCode(ctx context.Context, params GetAuthorizationCodeParams, ...) (*GetAuthorizationCodeResponse, error)
- func (c *Client) GetAvatar(ctx context.Context, chatID string, opts ...*RequestOptions) (map[string]interface{}, error)
- func (c *Client) GetChatHistory(ctx context.Context, params GetChatHistoryParams, opts ...*RequestOptions) ([]map[string]interface{}, error)
- func (c *Client) GetChats(ctx context.Context, opts ...*RequestOptions) ([]map[string]interface{}, error)
- func (c *Client) GetContactInfo(ctx context.Context, chatID string, opts ...*RequestOptions) (map[string]interface{}, error)
- func (c *Client) GetContacts(ctx context.Context, opts ...*RequestOptions) ([]map[string]interface{}, error)
- func (c *Client) GetGroupData(ctx context.Context, groupID string, opts ...*RequestOptions) (map[string]interface{}, error)
- func (c *Client) GetInstances(ctx context.Context) (map[string]interface{}, error)
- func (c *Client) GetQR(ctx context.Context, opts ...*RequestOptions) (*QRResponse, error)
- func (c *Client) GetSettings(ctx context.Context, opts ...*RequestOptions) (map[string]interface{}, error)
- func (c *Client) GetStateInstance(ctx context.Context, opts ...*RequestOptions) (*StateInstanceResponse, error)
- func (c *Client) GetWarmingPhoneStatus(ctx context.Context, opts ...*RequestOptions) (map[string]interface{}, error)
- func (c *Client) LeaveGroup(ctx context.Context, groupID string, opts ...*RequestOptions) (*LeaveGroupResponse, error)
- func (c *Client) Logout(ctx context.Context, opts ...*RequestOptions) (*LogoutResponse, error)
- func (c *Client) NewWebSocketClient(handler *WebhookHandler) *WebSocketClient
- func (c *Client) ReadChat(ctx context.Context, params ReadChatParams, opts ...*RequestOptions) (*ReadChatResponse, error)
- func (c *Client) Reboot(ctx context.Context, opts ...*RequestOptions) (*RebootResponse, error)
- func (c *Client) ReceiveNotification(ctx context.Context, opts ...*RequestOptions) (map[string]interface{}, error)
- func (c *Client) RemoveAdmin(ctx context.Context, groupID, participantChatID string, ...) (*RemoveAdminResponse, error)
- func (c *Client) RemoveGroupParticipant(ctx context.Context, groupID, participantChatID string, ...) (*RemoveGroupParticipantResponse, error)
- func (c *Client) RequestRegistrationCode(ctx context.Context, params RequestRegistrationCodeParams, ...) (map[string]interface{}, error)
- func (c *Client) RestoreInstance(ctx context.Context, idInstance int64) (map[string]interface{}, error)
- func (c *Client) SendConfirmationCode(ctx context.Context, params SendConfirmationCodeParams, ...) (*SendConfirmationCodeResponse, error)
- func (c *Client) SendContact(ctx context.Context, params SendContactParams, opts ...*RequestOptions) (*SendContactResponse, error)
- func (c *Client) SendFileByURL(ctx context.Context, params SendFileByURLParams, opts ...*RequestOptions) (*SendFileByURLResponse, error)
- func (c *Client) SendFileByUpload(ctx context.Context, params SendFileByUploadParams, opts ...*RequestOptions) (*SendFileByUploadResponse, error)
- func (c *Client) SendLocation(ctx context.Context, params SendLocationParams, opts ...*RequestOptions) (*SendLocationResponse, error)
- func (c *Client) SendMessage(ctx context.Context, params SendMessageParams, opts ...*RequestOptions) (*SendMessageResponse, error)
- func (c *Client) SendRegistrationCode(ctx context.Context, params SendRegistrationCodeParams, ...) (map[string]interface{}, error)
- func (c *Client) SetGroupAdmin(ctx context.Context, groupID, participantChatID string, ...) (*SetGroupAdminResponse, error)
- func (c *Client) SetGroupPicture(ctx context.Context, groupID string, file io.Reader, opts ...*RequestOptions) (*SetGroupPictureResponse, error)
- func (c *Client) SetProfileName(ctx context.Context, name string, opts ...*RequestOptions) error
- func (c *Client) SetProfilePicture(ctx context.Context, file io.Reader, opts ...*RequestOptions) (*SetProfilePictureResponse, error)
- func (c *Client) SetProfileStatus(ctx context.Context, status string, opts ...*RequestOptions) error
- func (c *Client) SetSettings(ctx context.Context, settings map[string]interface{}, opts ...*RequestOptions) (*SetSettingsResponse, error)
- func (c *Client) ShowMessagesQueue(ctx context.Context, opts ...*RequestOptions) ([]map[string]interface{}, error)
- func (c *Client) SignInWithConfirmationCode(ctx context.Context, params SignInWithConfirmationCodeParams, ...) (*SignInWithConfirmationCodeResponse, error)
- func (c *Client) StartReceivingNotifications(ctx context.Context, handler *WebhookHandler) error
- func (c *Client) UnarchiveChat(ctx context.Context, chatID string, opts ...*RequestOptions) error
- func (c *Client) UpdateGroupName(ctx context.Context, groupID, groupName string, opts ...*RequestOptions) (*UpdateGroupNameResponse, error)
- func (c *Client) UploadFile(ctx context.Context, file io.Reader, opts ...*RequestOptions) (*UploadFileResponse, error)
- type Contact
- type CreateAppParams
- type CreateAppResponse
- type CreateGroupResponse
- type CreateInstanceParams
- type DeleteNotificationResponse
- type ErrorResponse
- type ExtendInstanceParams
- type GetAuthorizationCodeParams
- type GetAuthorizationCodeResponse
- type GetChatHistoryParams
- type LeaveGroupResponse
- type LogoutResponse
- type MessengerType
- type Options
- type QRResponse
- type ReadChatParams
- type ReadChatResponse
- type RebootResponse
- type RemoveAdminResponse
- type RemoveGroupParticipantResponse
- type RequestOptions
- type RequestRegistrationCodeParams
- type SendConfirmationCodeParams
- type SendConfirmationCodeResponse
- type SendContactParams
- type SendContactResponse
- type SendFileByURLParams
- type SendFileByURLResponse
- type SendFileByUploadParams
- type SendFileByUploadResponse
- type SendLocationParams
- type SendLocationResponse
- type SendMessageParams
- type SendMessageResponse
- type SendRegistrationCodeParams
- type SetGroupAdminResponse
- type SetGroupPictureResponse
- type SetProfilePictureResponse
- type SetSettingsResponse
- type SignInWithConfirmationCodeParams
- type SignInWithConfirmationCodeResponse
- type StateInstanceResponse
- type UpdateGroupNameResponse
- type UploadFileResponse
- type WebSocketClient
- type WebhookCallback
- type WebhookHandler
- func (w *WebhookHandler) HandleWebhook(data map[string]interface{}) error
- func (w *WebhookHandler) OnDeviceInfo(callback WebhookCallback)
- func (w *WebhookHandler) OnIncomingMessageContact(callback WebhookCallback)
- func (w *WebhookHandler) OnIncomingMessageExtendedText(callback WebhookCallback)
- func (w *WebhookHandler) OnIncomingMessageFile(callback WebhookCallback)
- func (w *WebhookHandler) OnIncomingMessageLocation(callback WebhookCallback)
- func (w *WebhookHandler) OnIncomingMessageText(callback WebhookCallback)
- func (w *WebhookHandler) OnOutgoingMessageStatus(callback WebhookCallback)
- func (w *WebhookHandler) OnStateInstance(callback WebhookCallback)
- func (w *WebhookHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
- type WebhookType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddGroupParticipantResponse ¶
type AddGroupParticipantResponse struct {
AddParticipant bool `json:"addParticipant"`
}
AddGroupParticipantResponse represents the response from adding group participant
type CheckWhatsAppResponse ¶
type CheckWhatsAppResponse struct {
ExistsWhatsApp bool `json:"existsWhatsapp"`
}
CheckWhatsAppResponse represents the response from checking WhatsApp availability
type ClearMessagesQueueResponse ¶
type ClearMessagesQueueResponse struct {
IsCleared bool `json:"isCleared"`
}
ClearMessagesQueueResponse represents the response from clearing messages queue
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the SDKWA API client
func (*Client) AddGroupParticipant ¶
func (c *Client) AddGroupParticipant(ctx context.Context, groupID, participantChatID string, opts ...*RequestOptions) (*AddGroupParticipantResponse, error)
AddGroupParticipant adds a specified participant to a group chat
func (*Client) ArchiveChat ¶
ArchiveChat archives a chat
func (*Client) CheckWhatsApp ¶
func (c *Client) CheckWhatsApp(ctx context.Context, phoneNumber int64, opts ...*RequestOptions) (*CheckWhatsAppResponse, error)
CheckWhatsApp checks if an account exists for the specified phone number
func (*Client) ClearMessagesQueue ¶
func (c *Client) ClearMessagesQueue(ctx context.Context, opts ...*RequestOptions) (*ClearMessagesQueueResponse, error)
ClearMessagesQueue clears all pending messages from the sending queue
func (*Client) CreateApp ¶
func (c *Client) CreateApp(ctx context.Context, params CreateAppParams, opts ...*RequestOptions) (*CreateAppResponse, error)
CreateApp creates a new Telegram application
func (*Client) CreateGroup ¶
func (c *Client) CreateGroup(ctx context.Context, groupName string, chatIDs []string, opts ...*RequestOptions) (*CreateGroupResponse, error)
CreateGroup creates a new group chat with the specified name and participants
func (*Client) CreateInstance ¶
func (c *Client) CreateInstance(ctx context.Context, params CreateInstanceParams) (map[string]interface{}, error)
CreateInstance creates a new user instance with the specified tariff and period
func (*Client) DeleteInstance ¶
func (c *Client) DeleteInstance(ctx context.Context, idInstance int64) (map[string]interface{}, error)
DeleteInstance deletes a user instance by its ID
func (*Client) DeleteMessage ¶
func (c *Client) DeleteMessage(ctx context.Context, chatID, messageID string, opts ...*RequestOptions) error
DeleteMessage deletes a message from a chat
func (*Client) DeleteNotification ¶
func (c *Client) DeleteNotification(ctx context.Context, receiptID int64, opts ...*RequestOptions) (*DeleteNotificationResponse, error)
DeleteNotification deletes an incoming notification from the notification queue
func (*Client) ExtendInstance ¶
func (c *Client) ExtendInstance(ctx context.Context, params ExtendInstanceParams) (map[string]interface{}, error)
ExtendInstance renews a paid user instance for the specified period and tariff
func (*Client) GetAuthorizationCode ¶
func (c *Client) GetAuthorizationCode(ctx context.Context, params GetAuthorizationCodeParams, opts ...*RequestOptions) (*GetAuthorizationCodeResponse, error)
GetAuthorizationCode gets authorization code for account authorization
func (*Client) GetAvatar ¶
func (c *Client) GetAvatar(ctx context.Context, chatID string, opts ...*RequestOptions) (map[string]interface{}, error)
GetAvatar returns the avatar URL for a user or group chat
func (*Client) GetChatHistory ¶
func (c *Client) GetChatHistory(ctx context.Context, params GetChatHistoryParams, opts ...*RequestOptions) ([]map[string]interface{}, error)
GetChatHistory returns the message history for a specified chat
func (*Client) GetChats ¶
func (c *Client) GetChats(ctx context.Context, opts ...*RequestOptions) ([]map[string]interface{}, error)
GetChats retrieves a list of all chats for the current account
func (*Client) GetContactInfo ¶
func (c *Client) GetContactInfo(ctx context.Context, chatID string, opts ...*RequestOptions) (map[string]interface{}, error)
GetContactInfo retrieves detailed information about a contact
func (*Client) GetContacts ¶
func (c *Client) GetContacts(ctx context.Context, opts ...*RequestOptions) ([]map[string]interface{}, error)
GetContacts retrieves a list of contacts for the current account
func (*Client) GetGroupData ¶
func (c *Client) GetGroupData(ctx context.Context, groupID string, opts ...*RequestOptions) (map[string]interface{}, error)
GetGroupData retrieves information about a group chat
func (*Client) GetInstances ¶
GetInstances retrieves all account instances created by the user
func (*Client) GetQR ¶
func (c *Client) GetQR(ctx context.Context, opts ...*RequestOptions) (*QRResponse, error)
GetQR returns a QR code for authorizing your account
func (*Client) GetSettings ¶
func (c *Client) GetSettings(ctx context.Context, opts ...*RequestOptions) (map[string]interface{}, error)
GetSettings retrieves the current account settings
func (*Client) GetStateInstance ¶
func (c *Client) GetStateInstance(ctx context.Context, opts ...*RequestOptions) (*StateInstanceResponse, error)
GetStateInstance retrieves the current state of the account instance
func (*Client) GetWarmingPhoneStatus ¶
func (c *Client) GetWarmingPhoneStatus(ctx context.Context, opts ...*RequestOptions) (map[string]interface{}, error)
GetWarmingPhoneStatus gets the account warming state
func (*Client) LeaveGroup ¶
func (c *Client) LeaveGroup(ctx context.Context, groupID string, opts ...*RequestOptions) (*LeaveGroupResponse, error)
LeaveGroup allows the current account user to leave a specified group chat
func (*Client) Logout ¶
func (c *Client) Logout(ctx context.Context, opts ...*RequestOptions) (*LogoutResponse, error)
Logout logs out the specified account instance
func (*Client) NewWebSocketClient ¶
func (c *Client) NewWebSocketClient(handler *WebhookHandler) *WebSocketClient
NewWebSocketClient creates a new WebSocket client
func (*Client) ReadChat ¶
func (c *Client) ReadChat(ctx context.Context, params ReadChatParams, opts ...*RequestOptions) (*ReadChatResponse, error)
ReadChat marks messages in a chat as read
func (*Client) Reboot ¶
func (c *Client) Reboot(ctx context.Context, opts ...*RequestOptions) (*RebootResponse, error)
Reboot reboots the specified account instance
func (*Client) ReceiveNotification ¶
func (c *Client) ReceiveNotification(ctx context.Context, opts ...*RequestOptions) (map[string]interface{}, error)
ReceiveNotification retrieves a single incoming notification from the notifications queue
func (*Client) RemoveAdmin ¶
func (c *Client) RemoveAdmin(ctx context.Context, groupID, participantChatID string, opts ...*RequestOptions) (*RemoveAdminResponse, error)
RemoveAdmin revokes administrator rights from a specified participant in a group chat
func (*Client) RemoveGroupParticipant ¶
func (c *Client) RemoveGroupParticipant(ctx context.Context, groupID, participantChatID string, opts ...*RequestOptions) (*RemoveGroupParticipantResponse, error)
RemoveGroupParticipant removes a specified participant from a group chat
func (*Client) RequestRegistrationCode ¶
func (c *Client) RequestRegistrationCode(ctx context.Context, params RequestRegistrationCodeParams, opts ...*RequestOptions) (map[string]interface{}, error)
RequestRegistrationCode requests a phone number registration code via SMS or call
func (*Client) RestoreInstance ¶
func (c *Client) RestoreInstance(ctx context.Context, idInstance int64) (map[string]interface{}, error)
RestoreInstance restores a user instance by its ID
func (*Client) SendConfirmationCode ¶
func (c *Client) SendConfirmationCode(ctx context.Context, params SendConfirmationCodeParams, opts ...*RequestOptions) (*SendConfirmationCodeResponse, error)
SendConfirmationCode sends a confirmation code for Telegram account authorization
func (*Client) SendContact ¶
func (c *Client) SendContact(ctx context.Context, params SendContactParams, opts ...*RequestOptions) (*SendContactResponse, error)
SendContact sends a contact card message to a chat
func (*Client) SendFileByURL ¶
func (c *Client) SendFileByURL(ctx context.Context, params SendFileByURLParams, opts ...*RequestOptions) (*SendFileByURLResponse, error)
SendFileByURL sends a file by providing its URL
func (*Client) SendFileByUpload ¶
func (c *Client) SendFileByUpload(ctx context.Context, params SendFileByUploadParams, opts ...*RequestOptions) (*SendFileByUploadResponse, error)
SendFileByUpload sends a file by uploading it using form-data
func (*Client) SendLocation ¶
func (c *Client) SendLocation(ctx context.Context, params SendLocationParams, opts ...*RequestOptions) (*SendLocationResponse, error)
SendLocation sends a location message to a chat
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, params SendMessageParams, opts ...*RequestOptions) (*SendMessageResponse, error)
SendMessage sends a text message to either a personal or group chat
func (*Client) SendRegistrationCode ¶
func (c *Client) SendRegistrationCode(ctx context.Context, params SendRegistrationCodeParams, opts ...*RequestOptions) (map[string]interface{}, error)
SendRegistrationCode sends the phone number registration code
func (*Client) SetGroupAdmin ¶
func (c *Client) SetGroupAdmin(ctx context.Context, groupID, participantChatID string, opts ...*RequestOptions) (*SetGroupAdminResponse, error)
SetGroupAdmin assigns administrator rights to a specified participant in a group chat
func (*Client) SetGroupPicture ¶
func (c *Client) SetGroupPicture(ctx context.Context, groupID string, file io.Reader, opts ...*RequestOptions) (*SetGroupPictureResponse, error)
SetGroupPicture sets a new picture for a group chat
func (*Client) SetProfileName ¶
SetProfileName sets a new profile name for the account
func (*Client) SetProfilePicture ¶
func (c *Client) SetProfilePicture(ctx context.Context, file io.Reader, opts ...*RequestOptions) (*SetProfilePictureResponse, error)
SetProfilePicture sets a new profile picture for the account
func (*Client) SetProfileStatus ¶
func (c *Client) SetProfileStatus(ctx context.Context, status string, opts ...*RequestOptions) error
SetProfileStatus sets a new status message for the account
func (*Client) SetSettings ¶
func (c *Client) SetSettings(ctx context.Context, settings map[string]interface{}, opts ...*RequestOptions) (*SetSettingsResponse, error)
SetSettings updates the account settings
func (*Client) ShowMessagesQueue ¶
func (c *Client) ShowMessagesQueue(ctx context.Context, opts ...*RequestOptions) ([]map[string]interface{}, error)
ShowMessagesQueue retrieves a list of messages currently in the sending queue
func (*Client) SignInWithConfirmationCode ¶
func (c *Client) SignInWithConfirmationCode(ctx context.Context, params SignInWithConfirmationCodeParams, opts ...*RequestOptions) (*SignInWithConfirmationCodeResponse, error)
SignInWithConfirmationCode signs in using a confirmation code for Telegram
func (*Client) StartReceivingNotifications ¶
func (c *Client) StartReceivingNotifications(ctx context.Context, handler *WebhookHandler) error
StartReceivingNotifications starts receiving notifications via polling
func (*Client) UnarchiveChat ¶
UnarchiveChat unarchives a chat
func (*Client) UpdateGroupName ¶
func (c *Client) UpdateGroupName(ctx context.Context, groupID, groupName string, opts ...*RequestOptions) (*UpdateGroupNameResponse, error)
UpdateGroupName changes the name of a group chat
func (*Client) UploadFile ¶
func (c *Client) UploadFile(ctx context.Context, file io.Reader, opts ...*RequestOptions) (*UploadFileResponse, error)
UploadFile uploads a file to storage for later sending
type Contact ¶
type Contact struct {
PhoneContact int64 `json:"phoneContact"`
FirstName string `json:"firstName,omitempty"`
MiddleName string `json:"middleName,omitempty"`
LastName string `json:"lastName,omitempty"`
Company string `json:"company,omitempty"`
}
Contact represents a contact information
type CreateAppParams ¶
type CreateAppParams struct {
Title string `json:"title"`
ShortName string `json:"shortName"`
URL string `json:"url"`
Description string `json:"description,omitempty"`
}
CreateAppParams represents parameters for creating a Telegram app
type CreateAppResponse ¶
type CreateAppResponse struct {
Result bool `json:"result"`
Data struct {
AppID string `json:"appId"`
} `json:"data"`
}
CreateAppResponse represents the response from creating a Telegram app
type CreateGroupResponse ¶
type CreateGroupResponse struct {
Created bool `json:"created"`
ChatID string `json:"chatId"`
GroupInviteLink string `json:"groupInviteLink"`
}
CreateGroupResponse represents the response from creating a group
type CreateInstanceParams ¶
type CreateInstanceParams struct {
Tariff string `json:"tariff"`
Period string `json:"period"`
PaymentType string `json:"paymentType,omitempty"`
}
CreateInstanceParams represents parameters for creating an instance
type DeleteNotificationResponse ¶
type DeleteNotificationResponse struct {
Result bool `json:"result"`
}
DeleteNotificationResponse represents the response from deleting a notification
type ErrorResponse ¶
type ErrorResponse struct {
StatusCode int `json:"statusCode,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
Path string `json:"path,omitempty"`
Message string `json:"message"`
}
ErrorResponse represents an error response from the API
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type ExtendInstanceParams ¶
type ExtendInstanceParams struct {
IDInstance int64 `json:"idInstance"`
Tariff string `json:"tariff"`
Period string `json:"period"`
PaymentType string `json:"paymentType,omitempty"`
}
ExtendInstanceParams represents parameters for extending an instance
type GetAuthorizationCodeParams ¶
type GetAuthorizationCodeParams struct {
PhoneNumber int64 `json:"phoneNumber"`
}
GetAuthorizationCodeParams represents parameters for getting authorization code
type GetAuthorizationCodeResponse ¶
GetAuthorizationCodeResponse represents the response from getting authorization code
type GetChatHistoryParams ¶
type GetChatHistoryParams struct {
ChatID string `json:"chatId"`
Count int `json:"count,omitempty"`
}
GetChatHistoryParams represents parameters for getting chat history
type LeaveGroupResponse ¶
type LeaveGroupResponse struct {
LeaveGroup bool `json:"leaveGroup"`
}
LeaveGroupResponse represents the response from leaving a group
type LogoutResponse ¶
type LogoutResponse struct {
IsLogout bool `json:"isLogout"`
}
LogoutResponse represents the response from logging out an account
type MessengerType ¶
type MessengerType string
MessengerType represents the messenger type
const ( // MessengerWhatsApp represents WhatsApp messenger MessengerWhatsApp MessengerType = "whatsapp" // MessengerTelegram represents Telegram messenger MessengerTelegram MessengerType = "telegram" )
type Options ¶
type Options struct {
APIHost string // API host URL, defaults to https://api.sdkwa.pro
IDInstance string // Instance ID (required)
APITokenInstance string // API token instance (required)
MessengerType MessengerType // Messenger type, defaults to whatsapp
UserID string // User ID (optional, required for instance management)
UserToken string // User token (optional, required for instance management)
Timeout time.Duration // HTTP client timeout, defaults to 30 seconds
InsecureSkipVerify bool // Skip TLS certificate verification
}
Options contains configuration options for the SDKWA client
type QRResponse ¶
QRResponse represents the response from getting QR code
type ReadChatParams ¶
type ReadChatParams struct {
ChatID string `json:"chatId"`
IDMessage string `json:"idMessage,omitempty"`
}
ReadChatParams represents parameters for marking chat messages as read
type ReadChatResponse ¶
type ReadChatResponse struct {
SetRead bool `json:"setRead"`
}
ReadChatResponse represents the response from marking chat messages as read
type RebootResponse ¶
type RebootResponse struct {
IsReboot bool `json:"isReboot"`
}
RebootResponse represents the response from rebooting an account
type RemoveAdminResponse ¶
type RemoveAdminResponse struct {
RemoveAdmin bool `json:"removeAdmin"`
}
RemoveAdminResponse represents the response from removing admin rights
type RemoveGroupParticipantResponse ¶
type RemoveGroupParticipantResponse struct {
RemoveParticipant bool `json:"removeParticipant"`
}
RemoveGroupParticipantResponse represents the response from removing group participant
type RequestOptions ¶
type RequestOptions struct {
MessengerType MessengerType // Override messenger type for this request
}
RequestOptions contains options for individual API requests
type RequestRegistrationCodeParams ¶
type RequestRegistrationCodeParams struct {
PhoneNumber int64 `json:"phoneNumber"`
Method string `json:"method"` // "sms" or "voice"
}
RequestRegistrationCodeParams represents parameters for requesting registration code
type SendConfirmationCodeParams ¶
type SendConfirmationCodeParams struct {
PhoneNumber int64 `json:"phoneNumber"`
}
SendConfirmationCodeParams represents parameters for sending confirmation code
type SendConfirmationCodeResponse ¶
type SendConfirmationCodeResponse struct {
Result bool `json:"result"`
Message string `json:"message"`
}
SendConfirmationCodeResponse represents the response from sending confirmation code
type SendContactParams ¶
type SendContactParams struct {
ChatID string `json:"chatId"`
Contact Contact `json:"contact"`
QuotedMessageID string `json:"quotedMessageId,omitempty"`
}
SendContactParams represents parameters for sending a contact
type SendContactResponse ¶
type SendContactResponse struct {
IDMessage string `json:"idMessage"`
}
SendContactResponse represents the response from sending a contact
type SendFileByURLParams ¶
type SendFileByURLParams struct {
ChatID string `json:"chatId"`
URLFile string `json:"urlFile"`
FileName string `json:"fileName"`
Caption string `json:"caption,omitempty"`
QuotedMessageID string `json:"quotedMessageId,omitempty"`
ArchiveChat bool `json:"archiveChat,omitempty"`
}
SendFileByURLParams represents parameters for sending a file by URL
type SendFileByURLResponse ¶
type SendFileByURLResponse struct {
IDMessage string `json:"idMessage"`
}
SendFileByURLResponse represents the response from sending a file by URL
type SendFileByUploadParams ¶
type SendFileByUploadParams struct {
ChatID string `json:"chatId"`
File io.Reader `json:"-"` // File content
FileName string `json:"fileName"`
Caption string `json:"caption,omitempty"`
QuotedMessageID string `json:"quotedMessageId,omitempty"`
}
SendFileByUploadParams represents parameters for sending a file by upload
type SendFileByUploadResponse ¶
type SendFileByUploadResponse struct {
IDMessage string `json:"idMessage"`
}
SendFileByUploadResponse represents the response from sending a file by upload
type SendLocationParams ¶
type SendLocationParams struct {
ChatID string `json:"chatId"`
NameLocation string `json:"nameLocation,omitempty"`
Address string `json:"address,omitempty"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
QuotedMessageID string `json:"quotedMessageId,omitempty"`
}
SendLocationParams represents parameters for sending a location
type SendLocationResponse ¶
type SendLocationResponse struct {
IDMessage string `json:"idMessage"`
}
SendLocationResponse represents the response from sending a location
type SendMessageParams ¶
type SendMessageParams struct {
ChatID string `json:"chatId"`
Message string `json:"message"`
QuotedMessageID string `json:"quotedMessageId,omitempty"`
ArchiveChat bool `json:"archiveChat,omitempty"`
LinkPreview bool `json:"linkPreview,omitempty"`
}
SendMessageParams represents parameters for sending a text message
type SendMessageResponse ¶
type SendMessageResponse struct {
IDMessage string `json:"idMessage"`
}
SendMessageResponse represents the response from sending a message
type SendRegistrationCodeParams ¶
type SendRegistrationCodeParams struct {
Code string `json:"code"`
}
SendRegistrationCodeParams represents parameters for sending registration code
type SetGroupAdminResponse ¶
type SetGroupAdminResponse struct {
SetGroupAdmin bool `json:"setGroupAdmin"`
}
SetGroupAdminResponse represents the response from setting group admin
type SetGroupPictureResponse ¶
type SetGroupPictureResponse struct {
SetGroupPicture bool `json:"setGroupPicture"`
URLAvatar string `json:"urlAvatar"`
Reason string `json:"reason"`
}
SetGroupPictureResponse represents the response from setting group picture
type SetProfilePictureResponse ¶
type SetProfilePictureResponse struct {
SetProfilePicture bool `json:"setProfilePicture"`
URLAvatar string `json:"urlAvatar"`
Reason string `json:"reason"`
}
SetProfilePictureResponse represents the response from setting profile picture
type SetSettingsResponse ¶
type SetSettingsResponse struct {
SaveSettings bool `json:"saveSettings"`
}
SetSettingsResponse represents the response from setting account settings
type SignInWithConfirmationCodeParams ¶
type SignInWithConfirmationCodeParams struct {
Code string `json:"code"`
}
SignInWithConfirmationCodeParams represents parameters for signing in with confirmation code
type SignInWithConfirmationCodeResponse ¶
type SignInWithConfirmationCodeResponse struct {
Result bool `json:"result"`
Message string `json:"message"`
}
SignInWithConfirmationCodeResponse represents the response from signing in with confirmation code
type StateInstanceResponse ¶
type StateInstanceResponse struct {
StateInstance string `json:"stateInstance"`
}
StateInstanceResponse represents the response from getting account state
type UpdateGroupNameResponse ¶
type UpdateGroupNameResponse struct {
UpdateGroupName bool `json:"updateGroupName"`
}
UpdateGroupNameResponse represents the response from updating group name
type UploadFileResponse ¶
type UploadFileResponse struct {
URLFile string `json:"urlFile"`
}
UploadFileResponse represents the response from uploading a file
type WebSocketClient ¶
type WebSocketClient struct {
// contains filtered or unexported fields
}
WebSocketClient handles WebSocket connections for real-time events
func (*WebSocketClient) Close ¶
func (ws *WebSocketClient) Close() error
Close closes the WebSocket connection
type WebhookCallback ¶
WebhookCallback represents a callback function for webhook events
type WebhookHandler ¶
type WebhookHandler struct {
// contains filtered or unexported fields
}
WebhookHandler handles webhook events from the SDKWA API
func NewWebhookHandler ¶
func NewWebhookHandler() *WebhookHandler
NewWebhookHandler creates a new webhook handler
func (*WebhookHandler) HandleWebhook ¶
func (w *WebhookHandler) HandleWebhook(data map[string]interface{}) error
HandleWebhook processes a webhook request
func (*WebhookHandler) OnDeviceInfo ¶
func (w *WebhookHandler) OnDeviceInfo(callback WebhookCallback)
OnDeviceInfo registers a callback for device info events
func (*WebhookHandler) OnIncomingMessageContact ¶
func (w *WebhookHandler) OnIncomingMessageContact(callback WebhookCallback)
OnIncomingMessageContact registers a callback for incoming contact message events
func (*WebhookHandler) OnIncomingMessageExtendedText ¶
func (w *WebhookHandler) OnIncomingMessageExtendedText(callback WebhookCallback)
OnIncomingMessageExtendedText registers a callback for incoming extended text message events
func (*WebhookHandler) OnIncomingMessageFile ¶
func (w *WebhookHandler) OnIncomingMessageFile(callback WebhookCallback)
OnIncomingMessageFile registers a callback for incoming file message events
func (*WebhookHandler) OnIncomingMessageLocation ¶
func (w *WebhookHandler) OnIncomingMessageLocation(callback WebhookCallback)
OnIncomingMessageLocation registers a callback for incoming location message events
func (*WebhookHandler) OnIncomingMessageText ¶
func (w *WebhookHandler) OnIncomingMessageText(callback WebhookCallback)
OnIncomingMessageText registers a callback for incoming text message events
func (*WebhookHandler) OnOutgoingMessageStatus ¶
func (w *WebhookHandler) OnOutgoingMessageStatus(callback WebhookCallback)
OnOutgoingMessageStatus registers a callback for outgoing message status events
func (*WebhookHandler) OnStateInstance ¶
func (w *WebhookHandler) OnStateInstance(callback WebhookCallback)
OnStateInstance registers a callback for state instance changed events
func (*WebhookHandler) ServeHTTP ¶
func (w *WebhookHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler interface for webhook handling
type WebhookType ¶
type WebhookType string
WebhookType represents the type of webhook event
const ( WebhookTypeStateInstanceChanged WebhookType = "stateInstanceChanged" WebhookTypeOutgoingMessageStatus WebhookType = "outgoingMessageStatus" WebhookTypeIncomingMessageReceivedTextMessage WebhookType = "incomingMessageReceived_textMessage" WebhookTypeIncomingMessageReceivedImageMessage WebhookType = "incomingMessageReceived_imageMessage" WebhookTypeIncomingMessageReceivedLocationMessage WebhookType = "incomingMessageReceived_locationMessage" WebhookTypeIncomingMessageReceivedContactMessage WebhookType = "incomingMessageReceived_contactMessage" WebhookTypeIncomingMessageReceivedExtendedTextMessage WebhookType = "incomingMessageReceived_extendedTextMessage" WebhookTypeDeviceInfo WebhookType = "deviceInfo" )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
comprehensive
command
|
|
|
context_examples
command
|
|
|
create_group
command
|
|
|
get_qr
command
|
|
|
instance_management
command
|
|
|
receive_notifications
command
|
|
|
send_file_upload
command
|
|
|
send_file_url
command
|
|
|
send_message
command
|
|
|
telegram_auth
command
|
|
|
telegram_example
command
|
|
|
webhook_server
command
|