package module
v0.0.0-...-8b10f47 Latest Latest

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

Go to latest
Published: Feb 29, 2016 License: MIT Imports: 17 Imported by: 3



An (incomplete) go lang port of hangups. Currently only implements the REST API and not the BrowserChannel interface. Based on Tom Dryer's work on hangups python library. Library is still very new so use it at your own risk! Contributions are welcome!

Projects using go-hangups

Development Notes

Below are useful notes for developing/debugging.

# Compile ProtoBuf
$ protoc --go_out=. proto/*.proto
# Debug ProtoBuf
$ protoc --decode_raw < proto.bin




This section is empty.


This section is empty.


func ApiRequest

func ApiRequest(endpointUrl, contentType, responseType, cookies, sapisid string, headers map[string]string, payload []byte) ([]byte, error)

func GetAuthHeaders

func GetAuthHeaders(sapisid string) map[string]string


type Client

type Client struct {
	Session  *Session
	ClientId string

func (*Client) AddUser

func (c *Client) AddUser(inviteesGaiaIds []string, conversationId string) (*hangouts.AddUserResponse, error)

Invite users to join an existing group conversation.

func (*Client) CreateConversation

func (c *Client) CreateConversation(inviteesGaiaIds []string, name string, oneOnOne bool) (*hangouts.CreateConversationResponse, error)

Create a new conversation.

func (*Client) DeleteConversation

func (c *Client) DeleteConversation(conversationId string, deleteUpperBoundTimestamp uint64) (*hangouts.DeleteConversationResponse, error)

Leave a one-to-one conversation. One-to-one conversations are "sticky"; they can't actually be deleted. This API clears the event history of the specified conversation up to delete_upper_bound_timestamp, hiding it if no events remain.

func (*Client) EasterEgg

func (c *Client) EasterEgg(conversationId string, message string) (*hangouts.EasterEggResponse, error)

Send an easter egg event to a conversation.

func (*Client) GetConversation

func (c *Client) GetConversation(conversationId string, includeEvent bool, maxEventsPerConversation uint64) (*hangouts.GetConversationResponse, error)

Return conversation info and recent events.

func (*Client) GetEntityById

func (c *Client) GetEntityById(gaiaIds []string) (*hangouts.GetEntityByIdResponse, error)

Return info about a list of users.

func (*Client) GetSelfInfo

func (c *Client) GetSelfInfo() (*hangouts.GetSelfInfoResponse, error)

Return info about the current user.

func (*Client) NewEventRequestHeaders

func (c *Client) NewEventRequestHeaders(conversationId string, offTheRecord bool) *hangouts.EventRequestHeader

func (*Client) NewRequestHeaders

func (c *Client) NewRequestHeaders() *hangouts.RequestHeader

* Helper Methods * *

func (*Client) ProtobufApiRequest

func (c *Client) ProtobufApiRequest(apiEndpoint string, requestStruct, responseStruct proto.Message) error

func (*Client) QueryPresence

func (c *Client) QueryPresence(gaiaId string) (*hangouts.QueryPresenceResponse, error)

Return presence status for a list of users. doesnt support passing an array of gaiaIds. fails with: {"status":4,"error_description":"Duplicate ParticipantIds in request"}

func (*Client) RemoveUser

func (c *Client) RemoveUser(conversationId string) (*hangouts.RemoveUserResponse, error)

Leave a group conversation.

func (*Client) RenameConversation

func (c *Client) RenameConversation(conversationId, newName string) (*hangouts.RenameConversationResponse, error)
	Rename a conversation.
    Both group and one-to-one conversations may be renamed, but the
    official Hangouts clients have mixed support for one-to-one
    conversations with custom names.

func (*Client) SearchEntities

func (c *Client) SearchEntities(query string, maxCount uint64) (*hangouts.SearchEntitiesResponse, error)

Return info for users based on a query.

func (*Client) SendChatMessage

func (c *Client) SendChatMessage(conversationId, message string) (*hangouts.SendChatMessageResponse, error)

Send a chat message to a conversation.

func (*Client) SendOffnetworkInvitation

func (c *Client) SendOffnetworkInvitation(email string) (*hangouts.SendOffnetworkInvitationResponse, error)

Send an invitation to a non-contact.

func (*Client) SetActiveClient

func (c *Client) SetActiveClient(email string, isActive bool, timeoutSecs uint64) (*hangouts.SetActiveClientResponse, error)

Set the active client. timeout is 120 secs in hangups

func (*Client) SetConversationNotificationLevel

func (c *Client) SetConversationNotificationLevel(conversationId string, setQuiet bool) (*hangouts.SetConversationNotificationLevelResponse, error)

Set the notification level of a conversation.

func (*Client) SetFocus

func (c *Client) SetFocus(conversationId string, unfocus bool, timeoutSecs uint32) (*hangouts.SetFocusResponse, error)

Set focus to a conversation.

func (*Client) SetPresence

func (c *Client) SetPresence(presenceState int32, timeoutSecs uint64) (*hangouts.SetPresenceResponse, error)

Set the presence status. presenceState: 1=NONE 30=IDLE 40=ACTIVE

func (*Client) SetTyping

func (c *Client) SetTyping(conversationId string, typingState int32) (*hangouts.SetTypingResponse, error)

Set the typing status of a conversation. typingState: 1=Started 2=Paused 3=Stopped

func (*Client) SyncAllNewEvents

func (c *Client) SyncAllNewEvents(lastSyncTimestamp, maxResponseSizeBytes uint64) (*hangouts.SyncAllNewEventsResponse, error)

List all events occurring at or after a timestamp.

func (*Client) SyncRecentConversations

func (c *Client) SyncRecentConversations(maxConversations, maxEventsPerConversation uint64) (*hangouts.SyncRecentConversationsResponse, error)

Return info on recent conversations and their events.

func (*Client) UpdateWatermark

func (c *Client) UpdateWatermark(conversationId string, lastReadTimestamp uint64) (*hangouts.UpdateWatermarkResponse, error)

Update the watermark (read timestamp) of a conversation.

type Session

type Session struct {
	RefreshToken string
	Cookies      string
	Sapisid      string

func (*Session) Init

func (s *Session) Init() error


Path Synopsis
Package hangouts is a generated protocol buffer package.
Package hangouts is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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