cloudfunctions

package module
v0.0.0-...-ad97a83 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

README

Email Push Notifications

email_push_notification is a handler for Gmail push notifications.

It is triggered every time a watched event happens in a Gmail inbox with SRC installed.

This cloud function serves many purposes:

  • Keep track of most recent user inbox history ID that SRC has synced to
  • Trigger a full inbox sync if it's the user's first sync or if the history ID has expired (over one week since last sync)
  • Fetch new messages since last sync
  • Allow or block messages based on the user set @SRC/Allow and @SRC/Block labels
  • Identify job opportunities in new messages and take appropriate action

In the future, we want to refactor this notification handler to only track user history IDs and push message IDs to a separate Pub/Sub topic for downstream handling.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailHistory

type EmailHistory struct {
	Email     string `json:"email"`
	HistoryID int64  `json:"historyId"`
}

type EmailPushNotification

type EmailPushNotification struct {
	Email     string `json:"emailAddress"`
	HistoryID uint64 `json:"historyId"`
}

type FullEmailSyncRequest

type FullEmailSyncRequest struct {
	Email     string    `json:"email"`
	StartDate time.Time `json:"start_date"`
}

type MessagePublishedData

type MessagePublishedData struct {
	Message PubSubMessage
}

MessagePublishedData contains the full Pub/Sub message See the documentation for more details: https://cloud.google.com/eventarc/docs/cloudevents#pubsub

type PubSubMessage

type PubSubMessage struct {
	Data []byte `json:"data"`
}

PubSubMessage is the payload of a Pub/Sub event. See the documentation for more details: https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage

Jump to

Keyboard shortcuts

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