notifications

package
v0.0.0-...-4b1035e Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkflowIdTestFlow                      = "test-workflow"
	WorkflowIdOrgOwnerUpdateEmail           = "org-owner-update-email"
	WorkflowIdOrgOwnerUpdateAppNotification = "org-owner-update-in-app-notification"
	WorkflowInvoicePaid                     = "invoice-paid"
	WorkflowInvoiceReadyWithPaymentLink     = "invoice-ready"
	WorkflowInvoiceReadyNoPaymentLink       = "invoice-ready-nolink"
	WorkflowInvoiceVoided                   = "invoice-voided"
	WorkflowFailedWebhook                   = "failed-webhook"
	WorkflowReminderNotificationEmail       = "reminder-notification-email"
	WorkflowReminderInAppNotification       = "reminder-in-app-notification"
)
View Source
const (
	WorkflowIdOrgOwnerUpdateEmailSubject           = "%s %s added you as an owner"
	WorkflowIdOrgOwnerUpdateAppNotificationSubject = "%s %s added you as an owner"
	WorkflowFailedWebhookSubject                   = "[Action Required] Webhook %s is offline"
	WorkflowInvoiceVoidedSubject                   = "Voided Invoice %s"
	WorkflowInvoicePaidSubject                     = "Paid Invoice %s from %s"
	WorkflowInvoiceReadySubject                    = "New invoice %s"
	WorkflowReminderNotificationSubject            = "Reminder, %s"
)

Variables

View Source
var REQUIRED_TEMPLATE_VALUES = map[string][]string{
	WorkflowIdOrgOwnerUpdateEmail: {
		"{{userFirstName}}",
		"{{actorFirstName}}",
		"{{actorLastName}}",
		"{{orgName}}",
		"{{orgLink}}",
	},
	WorkflowFailedWebhook: {
		"{{userFirstName}}",
		"{{webhookName}}",
		"{{webhookUrl}}",
	},
	WorkflowReminderNotificationEmail: {
		"{{reminderContent}}",
		"{{reminderCreatedAt}}",
		"{{orgName}}",
		"{{orgLink}}",
	},
}

Functions

This section is empty.

Types

type NotifiableUser

type NotifiableUser struct {
	FirstName    string `json:"firstName"`
	LastName     string `json:"lastName"`
	Email        string `json:"email"`
	SubscriberID string `json:"subscriberId"` // must be unique uuid for user
}

type NotificationProvider

type NotificationProvider interface {
	SendNotification(ctx context.Context, notification *NovuNotification, span opentracing.Span) error
}

func NewNovuNotificationProvider

func NewNovuNotificationProvider(log logger.Logger, apiKey string, s3Client aws_client.S3ClientI) NotificationProvider

type NovuNotification

type NovuNotification struct {
	WorkflowId   string
	TemplateData map[string]string

	To      *NotifiableUser
	Subject string
	Payload map[string]interface{}
}

type NovuProvider

type NovuProvider struct {
	NovuClient *novu.APIClient
	// contains filtered or unexported fields
}

func (*NovuProvider) FillTemplate

func (np *NovuProvider) FillTemplate(workflowId, template string, replace map[string]string) (string, error)

func (*NovuProvider) LoadEmailBody

func (np *NovuProvider) LoadEmailBody(workflowId string) (string, error)

func (*NovuProvider) SendNotification

func (np *NovuProvider) SendNotification(ctx context.Context, notification *NovuNotification, span opentracing.Span) error

Jump to

Keyboard shortcuts

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