groupmeext

package
v0.0.0-...-ff4fbcc Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OldUserSuffix = "@c.groupme.com"
	NewUserSuffix = "@groupme.com"
)

Variables

This section is empty.

Functions

func ApproveChat

func ApproveChat(ctx context.Context, token, conversationID string) error

ApproveChat accepts a pending DM message request.

func ChatRequiresApproval

func ChatRequiresApproval(ctx context.Context, token, conversationID string) (bool, error)

ChatRequiresApproval reports whether the DM chat is a pending message request the logged-in user hasn't accepted yet.

func DownloadFile

func DownloadFile(groupID groupme.ID, fileID, token string) (data []byte, filename, mime string, err error)

DownloadFile downloads a "file" attachment (GroupMe's group file-sharing feature, distinct from image/video message attachments) via file.groupme.com. This is a two-step API, both authenticated via X-Access-Token: one call resolves the file's name/mime type, a second fetches its bytes. groupID is the containing group's ID -- GroupMe's file-sharing feature is group-only, so this isn't expected to be called for a DM attachment.

Ported from the pre-2023 bridge's equivalent, which used to panic() on any request error here -- a network hiccup on a single file attachment would have taken down the entire bridge process. Rewritten to return an error instead, same as every other attachment download path.

func DownloadImage

func DownloadImage(url string) (data *[]byte, mime string, err error)

DownloadImage downloads an image attachment from GroupMe's image CDN (i.groupme.com), a plain unauthenticated GET.

func DownloadVideo

func DownloadVideo(videoURL, token string) (data []byte, mime string, err error)

DownloadVideo downloads a video attachment. Unlike images (a plain public GET) and files (a signed X-Access-Token API call, see DownloadFile), GroupMe's video CDN authenticates via a "token" cookie carrying the account's access token -- ported as-is from the pre-2023 bridge (the only place this was ever verified to work against the real API); not separately re-verified live in this revival, see NOTES.md.

func UploadFile

func UploadFile(ctx context.Context, groupID groupme.ID, token, filename string, data []byte, mimeType string) (fileID string, err error)

UploadFile uploads an outgoing file (GroupMe's group file-sharing feature -- see DownloadFile's doc comment) and returns its file_id, for use as a "file" attachment's file_id. Reverse-engineered live the same way as UploadVideo; see NOTES.md "Outgoing video/file attachments".

Unlike video, this doesn't need a separate SAS-signed upload step -- file.groupme.com is GroupMe's own file-service (confirmed via its response headers, e.g. "x-gm-service: file-service"), not a direct Azure Blob Storage passthrough, so a plain X-Access-Token-authenticated POST of the raw bytes is enough on its own.

filename is passed as a "name" query parameter -- confirmed live to be the *only* thing that makes DownloadFile's metadata lookup come back populated afterward: neither a multipart form body (with a proper Content-Disposition filename -- the content didn't even transfer that way, this endpoint appears to not parse multipart at all), nor the Content-Type header, nor several other header/query-param names tried, had any effect. mime_type is then derived by GroupMe itself from filename's extension (confirmed live: a ".pdf" name produced "application/pdf" with no mime type passed anywhere else) -- so the mimeType parameter here is honored only as this function's own Content-Type request header (harmless either way, but not what actually determines the stored mime_type); pass a real filename with its real extension to get useful metadata out the other end.

func UploadVideo

func UploadVideo(ctx context.Context, token, senderID, groupID, recipientID string, data []byte, extension, mimeType string) (renderURL, thumbnailURL string, err error)

UploadVideo uploads an outgoing video to GroupMe, returning the URLs to use as a "video" attachment's url/preview_url (see convertGroupMeMessage in pkg/connector for the incoming equivalent, and NOTES.md "Outgoing video/file attachments" for how this was reverse-engineered).

Two real HTTP calls, not one: first m.groupme.com/uploads is asked to create an upload session for a video of this size/extension belonging to this group or DM conversation, which hands back a one-time SAS URL scoped to Azure Blob Storage (cdn2.groupme.com) -- GroupMe's own X-Access-Token auth doesn't apply to that second request at all, unlike every other call in this file; the SAS signature in the URL itself is the only auth Azure wants, and a real attempt to PUT directly to cdn2.groupme.com with just X-Access-Token (no SAS) was confirmed live to fail with Azure's own "PublicAccessNotPermitted" error.

groupID and recipientID are mutually exclusive -- exactly one should be non-empty, matching whether this is a group or DM send (see the "You must provide either recipientId or groupId" validation error mentioned on createUploadRequest).

Types

type Client

type Client struct {
	*groupme.Client
}

func NewClient

func NewClient(authToken string) *Client

NewClient creates a new GroupMe API Client

func (Client) IndexAllChats

func (c Client) IndexAllChats(ctx context.Context) ([]*groupme.Chat, error)

func (Client) IndexAllGroups

func (c Client) IndexAllGroups(ctx context.Context) ([]*groupme.Group, error)

func (Client) IndexAllRelations

func (c Client) IndexAllRelations() ([]*groupme.User, error)

func (Client) LoadMessagesAfter

func (c Client) LoadMessagesAfter(groupID groupme.ID, lastMessageID string, lastMessageFromMe bool, private bool) ([]*groupme.Message, error)

func (Client) LoadMessagesBefore

func (c Client) LoadMessagesBefore(groupID, lastMessageID string, private bool) ([]*groupme.Message, error)

func (*Client) RemoveFromGroup

func (c *Client) RemoveFromGroup(uid, groupID groupme.ID) error

type Message

type Message struct{ groupme.Message }

func (*Message) Scan

func (m *Message) Scan(value interface{}) error

func (*Message) Value

func (m *Message) Value() (driver.Value, error)

type WSFayeClient

type WSFayeClient struct {
	// contains filtered or unexported fields
}

WSFayeClient is a Bayeux client for GroupMe's push service (push.groupme.com/faye) that speaks the protocol over a WebSocket instead of the HTTP long-polling transport implemented by github.com/karmanyaahm/wray (vendored at thirdparty/wray/). GroupMe's current docs recommend websocket over long-polling, and the community-documented handshake declares `"supportedConnectionTypes":["websocket"]` -- see NOTES.md for the full investigation that motivated this.

It implements groupme.FayeClient (Listen/WaitSubscribe), so it's a drop-in replacement for the wray-backed FayeClient in this package: both satisfy the same interface consumed by groupme.PushSubscription.

func NewWSFayeClient

func NewWSFayeClient(logger zerolog.Logger) *WSFayeClient

NewWSFayeClient creates a websocket-based Faye/Bayeux client for GroupMe's push service. Call Listen (typically via groupme.PushSubscription.StartListening) to begin connecting.

func (*WSFayeClient) Listen

func (c *WSFayeClient) Listen(ctx context.Context)

func (*WSFayeClient) WaitSubscribe

func (c *WSFayeClient) WaitSubscribe(ctx context.Context, channel, token string, msgChannel chan groupme.PushMessage) error

Jump to

Keyboard shortcuts

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