Documentation ¶
Index ¶
- Constants
- Variables
- func ActiveChannelConnectionCount(ctx context.Context, db Queryer, id ChannelID) (int, error)
- func AddContactsToGroups(ctx context.Context, tx Queryer, adds []*GroupAdd) error
- func AddEventFires(ctx context.Context, tx Queryer, adds []*FireAdd) error
- func AddMsgLabels(ctx context.Context, tx *sqlx.Tx, adds []*MsgLabelAdd) error
- func ApplyEvent(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, ...) error
- func ApplyPostEventHooks(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, ...) error
- func ApplyPreEventHooks(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, ...) error
- func BulkSQL(ctx context.Context, label string, tx Queryer, sql string, vs []interface{}) error
- func CalculateDynamicGroups(ctx context.Context, tx Queryer, org *OrgAssets, contact *flows.Contact) error
- func ContactIDsFromURNs(ctx context.Context, db *sqlx.DB, org *OrgAssets, assets flows.SessionAssets, ...) (map[urns.URN]ContactID, error)
- func ContactLock(orgID OrgID, contactID ContactID) string
- func DeleteEventFires(ctx context.Context, db *sqlx.DB, fires []*EventFire) error
- func DeleteUnfiredContactEvents(ctx context.Context, tx Queryer, contactID ContactID) error
- func DeleteUnfiredEventFires(ctx context.Context, tx *sqlx.Tx, removes []*FireDelete) error
- func Exec(ctx context.Context, label string, tx Queryer, sql string, args ...interface{}) error
- func ExitSessions(ctx context.Context, tx Queryer, sessionIDs []SessionID, exitType ExitType, ...) error
- func ExpireRunsAndSessions(ctx context.Context, db Queryer, runIDs []FlowRunID, sessionIDs []SessionID) error
- func FlushCache()
- func GetSessionAssets(org *OrgAssets) (flows.SessionAssets, error)
- func GetURNInt(urn urns.URN, key string) int
- func InsertFlowStarts(ctx context.Context, db Queryer, starts []*FlowStart) error
- func InsertMessages(ctx context.Context, tx Queryer, msgs []*Msg) error
- func InsertWebhookEvents(ctx context.Context, db Queryer, events []*WebhookEvent) error
- func InsertWebhookResults(ctx context.Context, db Queryer, results []*WebhookResult) error
- func InterruptContactRuns(ctx context.Context, tx *sqlx.Tx, contactIDs []flows.ContactID, now time.Time) error
- func MarkEventsFired(ctx context.Context, tx Queryer, fires []*EventFire, fired time.Time, ...) error
- func MarkMessagesPending(ctx context.Context, tx *sqlx.Tx, msgs []*Msg) error
- func MarkMessagesQueued(ctx context.Context, tx *sqlx.Tx, msgs []*Msg) error
- func MarkStartComplete(ctx context.Context, db *sqlx.DB, startID StartID) error
- func MarkStartStarted(ctx context.Context, db *sqlx.DB, startID StartID, contactCount int) error
- func NewSessionAssets(org *OrgAssets) (flows.SessionAssets, error)
- func NormalizeAttachment(attachment flows.Attachment) flows.Attachment
- func RegisterEventHook(eventType string, handler EventHandler)
- func RemoveContactsFromGroups(ctx context.Context, tx Queryer, removals []*GroupRemove) error
- func RunExpiration(ctx context.Context, db *sqlx.DB, runID FlowRunID) (*time.Time, error)
- func StopContact(ctx context.Context, tx Queryer, orgID OrgID, contactID ContactID) error
- func URNForID(ctx context.Context, tx Queryer, org *OrgAssets, urnID URNID) (urns.URN, error)
- func URNForURN(ctx context.Context, tx Queryer, org *OrgAssets, u urns.URN) (urns.URN, error)
- func UnsubscribeResthooks(ctx context.Context, tx *sqlx.Tx, unsubs []*ResthookUnsubscribe) error
- func UpdateChannelConnectionStatuses(ctx context.Context, db Queryer, connectionIDs []ConnectionID, ...) error
- func UpdateContactModifiedOn(ctx context.Context, tx Queryer, contactIDs []ContactID) error
- func UpdateContactURNs(ctx context.Context, tx Queryer, org *OrgAssets, changes []*ContactURNsChanged) error
- func UpdateMessage(ctx context.Context, tx Queryer, msgID flows.MsgID, status MsgStatus, ...) error
- type Broadcast
- func (b *Broadcast) ContactIDs() []ContactID
- func (b *Broadcast) CreateBatch(contactIDs []ContactID) *BroadcastBatch
- func (b *Broadcast) GroupIDs() []GroupID
- func (b *Broadcast) MarshalJSON() ([]byte, error)
- func (b *Broadcast) OrgID() OrgID
- func (b *Broadcast) Translations() map[utils.Language]*BroadcastTranslation
- func (b *Broadcast) URNs() []urns.URN
- func (b *Broadcast) UnmarshalJSON(data []byte) error
- type BroadcastBatch
- func (b *BroadcastBatch) BaseLanguage() utils.Language
- func (b *BroadcastBatch) ContactIDs() []ContactID
- func (b *BroadcastBatch) IsLast() bool
- func (b *BroadcastBatch) MarshalJSON() ([]byte, error)
- func (b *BroadcastBatch) OrgID() OrgID
- func (b *BroadcastBatch) SetIsLast(last bool)
- func (b *BroadcastBatch) SetURNs(urns map[ContactID]urns.URN)
- func (b *BroadcastBatch) Translations() map[utils.Language]*BroadcastTranslation
- func (b *BroadcastBatch) URNs() map[ContactID]urns.URN
- func (b *BroadcastBatch) UnmarshalJSON(data []byte) error
- type BroadcastID
- type BroadcastTranslation
- type Campaign
- type CampaignEvent
- func (e *CampaignEvent) Campaign() *Campaign
- func (e *CampaignEvent) DeliveryHour() int
- func (e *CampaignEvent) ID() CampaignEventID
- func (e *CampaignEvent) Offset() int
- func (e *CampaignEvent) QualifiesByField(contact *flows.Contact) bool
- func (e *CampaignEvent) QualifiesByGroup(contact *flows.Contact) bool
- func (e *CampaignEvent) RelativeToID() FieldID
- func (e *CampaignEvent) RelativeToKey() string
- func (e *CampaignEvent) ScheduleForContact(tz *time.Location, now time.Time, contact *flows.Contact) (*time.Time, error)
- func (e *CampaignEvent) ScheduleForTime(tz *time.Location, now time.Time, start time.Time) (*time.Time, error)
- func (e *CampaignEvent) StartMode() StartMode
- func (e *CampaignEvent) UUID() CampaignEventUUID
- func (e *CampaignEvent) Unit() OffsetUnit
- func (e *CampaignEvent) UnmarshalJSON(data []byte) error
- type CampaignEventID
- type CampaignEventUUID
- type CampaignID
- type CampaignUUID
- type Channel
- func (c *Channel) Address() string
- func (c *Channel) ChannelReference() *assets.ChannelReference
- func (c *Channel) ConfigValue(key string, def string) string
- func (c *Channel) Country() string
- func (c *Channel) ID() ChannelID
- func (c *Channel) MatchPrefixes() []string
- func (c *Channel) Name() string
- func (c *Channel) Parent() *assets.ChannelReference
- func (c *Channel) Roles() []assets.ChannelRole
- func (c *Channel) Schemes() []string
- func (c *Channel) TPS() int
- func (c *Channel) Type() ChannelType
- func (c *Channel) UUID() assets.ChannelUUID
- type ChannelConnection
- func InsertIVRConnection(ctx context.Context, db *sqlx.DB, orgID OrgID, channelID ChannelID, ...) (*ChannelConnection, error)
- func LoadChannelConnectionsToRetry(ctx context.Context, db Queryer, limit int) ([]*ChannelConnection, error)
- func SelectChannelConnection(ctx context.Context, db Queryer, id ConnectionID) (*ChannelConnection, error)
- func SelectChannelConnectionByExternalID(ctx context.Context, db Queryer, channelID ChannelID, connType ConnectionType, ...) (*ChannelConnection, error)
- func (c *ChannelConnection) ChannelID() ChannelID
- func (c *ChannelConnection) ContactID() ContactID
- func (c *ChannelConnection) ContactURNID() URNID
- func (c *ChannelConnection) ExternalID() string
- func (c *ChannelConnection) ID() ConnectionID
- func (c *ChannelConnection) MarkErrored(ctx context.Context, db Queryer, now time.Time, wait time.Duration) error
- func (c *ChannelConnection) MarkFailed(ctx context.Context, db Queryer, now time.Time) error
- func (c *ChannelConnection) MarkStarted(ctx context.Context, db Queryer, now time.Time) error
- func (c *ChannelConnection) MarkThrottled(ctx context.Context, db Queryer, now time.Time) error
- func (c *ChannelConnection) NextAttempt() *time.Time
- func (c *ChannelConnection) OrgID() OrgID
- func (c *ChannelConnection) StartID() StartID
- func (c *ChannelConnection) Status() ConnectionStatus
- func (c *ChannelConnection) UpdateExternalID(ctx context.Context, db *sqlx.DB, id string) error
- func (c *ChannelConnection) UpdateStatus(ctx context.Context, db Queryer, status ConnectionStatus, duration int, ...) error
- type ChannelEvent
- func (e *ChannelEvent) ChannelID() ChannelID
- func (e *ChannelEvent) ContactID() ContactID
- func (e *ChannelEvent) Extra() map[string]string
- func (e *ChannelEvent) ID() ChannelEventID
- func (e *ChannelEvent) Insert(ctx context.Context, db *sqlx.DB) error
- func (e *ChannelEvent) IsNewContact() bool
- func (e *ChannelEvent) MarshalJSON() ([]byte, error)
- func (e *ChannelEvent) OrgID() OrgID
- func (e *ChannelEvent) URNID() URNID
- func (e *ChannelEvent) UnmarshalJSON(b []byte) error
- type ChannelEventID
- type ChannelEventType
- type ChannelID
- type ChannelLog
- type ChannelLogID
- type ChannelType
- type ConnectionDirection
- type ConnectionID
- type ConnectionStatus
- type ConnectionType
- type Contact
- func (c *Contact) CreatedOn() time.Time
- func (c *Contact) Fields() map[string]*flows.Value
- func (c *Contact) FlowContact(org *OrgAssets, session flows.SessionAssets) (*flows.Contact, error)
- func (c *Contact) Groups() []*Group
- func (c *Contact) ID() ContactID
- func (c *Contact) IsBlocked() bool
- func (c *Contact) IsStopped() bool
- func (c *Contact) Language() utils.Language
- func (c *Contact) ModifiedOn() time.Time
- func (c *Contact) Name() string
- func (c *Contact) URNForID(urnID URNID) urns.URN
- func (c *Contact) URNs() []urns.URN
- func (c *Contact) UUID() flows.ContactUUID
- func (c *Contact) Unstop(ctx context.Context, db *sqlx.DB) error
- func (c *Contact) UpdatePreferredURN(ctx context.Context, tx Queryer, org *OrgAssets, urnID URNID, channel *Channel) error
- type ContactID
- func ContactIDsForGroupIDs(ctx context.Context, tx Queryer, groupIDs []GroupID) ([]ContactID, error)
- func ContactIDsFromReferences(ctx context.Context, tx Queryer, org *OrgAssets, ...) ([]ContactID, error)
- func CreateContact(ctx context.Context, db *sqlx.DB, org *OrgAssets, assets flows.SessionAssets, ...) (ContactID, error)
- func FindActiveSessionOverlap(ctx context.Context, db *sqlx.DB, contacts []ContactID) ([]ContactID, error)
- func FindFlowStartedOverlap(ctx context.Context, db *sqlx.DB, flowID FlowID, contacts []ContactID) ([]ContactID, error)
- type ContactURN
- type ContactURNsChanged
- type EventCommitHook
- type EventFire
- type EventFireResult
- type EventHandler
- type EventStatus
- type EventType
- type ExitType
- type Field
- type FieldID
- type FieldUUID
- type FireAdd
- type FireDelete
- type FireID
- type Flow
- func (f *Flow) Definition() json.RawMessage
- func (f *Flow) FlowReference() *assets.FlowReference
- func (f *Flow) FlowType() FlowType
- func (f *Flow) ID() FlowID
- func (f *Flow) IgnoreTriggers() bool
- func (f *Flow) IntConfigValue(key string, defaultValue int64) int64
- func (f *Flow) IsArchived() bool
- func (f *Flow) Name() string
- func (f *Flow) SetDefinition(definition json.RawMessage)
- func (f *Flow) SetLegacyDefinition(legacyDefinition json.RawMessage) error
- func (f *Flow) StringConfigValue(key string, defaultValue string) string
- func (f *Flow) UUID() assets.FlowUUID
- type FlowID
- type FlowRun
- func (r *FlowRun) MarshalJSON() ([]byte, error)
- func (r *FlowRun) ModifiedOn() time.Time
- func (r *FlowRun) SetConnectionID(connID *ConnectionID)
- func (r *FlowRun) SetSessionID(sessionID SessionID)
- func (r *FlowRun) SetStartID(startID StartID)
- func (r *FlowRun) UUID() flows.RunUUID
- func (r *FlowRun) UnmarshalJSON(b []byte) error
- type FlowRunID
- type FlowStart
- func (s *FlowStart) ContactIDs() []ContactID
- func (s *FlowStart) CreateBatch(contactIDs []ContactID) *FlowStartBatch
- func (s *FlowStart) CreateContact() bool
- func (s *FlowStart) Extra() json.RawMessage
- func (s *FlowStart) FlowID() FlowID
- func (s *FlowStart) FlowType() FlowType
- func (s *FlowStart) GroupIDs() []GroupID
- func (s *FlowStart) ID() StartID
- func (s *FlowStart) IncludeActive() bool
- func (s *FlowStart) MarshalJSON() ([]byte, error)
- func (s *FlowStart) OrgID() OrgID
- func (s *FlowStart) Parent() json.RawMessage
- func (s *FlowStart) RestartParticipants() bool
- func (s *FlowStart) URNs() []urns.URN
- func (s *FlowStart) UnmarshalJSON(data []byte) error
- type FlowStartBatch
- func (b *FlowStartBatch) ContactIDs() []ContactID
- func (b *FlowStartBatch) Extra() json.RawMessage
- func (b *FlowStartBatch) FlowID() FlowID
- func (b *FlowStartBatch) IncludeActive() bool
- func (b *FlowStartBatch) IsLast() bool
- func (b *FlowStartBatch) MarshalJSON() ([]byte, error)
- func (b *FlowStartBatch) OrgID() OrgID
- func (b *FlowStartBatch) Parent() json.RawMessage
- func (b *FlowStartBatch) RestartParticipants() bool
- func (b *FlowStartBatch) SetIsLast(last bool)
- func (b *FlowStartBatch) StartID() StartID
- func (b *FlowStartBatch) UnmarshalJSON(data []byte) error
- type FlowType
- type Group
- type GroupAdd
- type GroupID
- type GroupRemove
- type Label
- type LabelID
- type Location
- type MatchType
- type Msg
- func CreateBroadcastMessages(ctx context.Context, db *sqlx.DB, org *OrgAssets, sa flows.SessionAssets, ...) ([]*Msg, error)
- func NewIncomingIVR(orgID OrgID, conn *ChannelConnection, in *flows.MsgIn, createdOn time.Time) *Msg
- func NewIncomingMsg(orgID OrgID, channel *Channel, contactID ContactID, in *flows.MsgIn, ...) *Msg
- func NewOutgoingIVR(orgID OrgID, conn *ChannelConnection, out *flows.MsgOut, createdOn time.Time) (*Msg, error)
- func NewOutgoingMsg(orgID OrgID, channel *Channel, contactID ContactID, out *flows.MsgOut, ...) (*Msg, error)
- func (m *Msg) Attachments() []flows.Attachment
- func (m *Msg) Channel() *Channel
- func (m *Msg) ChannelID() *ChannelID
- func (m *Msg) ChannelUUID() assets.ChannelUUID
- func (m *Msg) ConnectionID() *ConnectionID
- func (m *Msg) ContactID() ContactID
- func (m *Msg) ContactURNID() *URNID
- func (m *Msg) CreatedOn() time.Time
- func (m *Msg) Direction() MsgDirection
- func (m *Msg) ErrorCount() int
- func (m *Msg) ExternalID() null.String
- func (m *Msg) HighPriority() bool
- func (m *Msg) ID() flows.MsgID
- func (m *Msg) MarshalJSON() ([]byte, error)
- func (m *Msg) Metadata() types.JSONText
- func (m *Msg) ModifiedOn() time.Time
- func (m *Msg) MsgCount() int
- func (m *Msg) MsgType() MsgType
- func (m *Msg) NextAttempt() time.Time
- func (m *Msg) OrgID() OrgID
- func (m *Msg) QueuedOn() time.Time
- func (m *Msg) SentOn() time.Time
- func (m *Msg) SetChannelID(channelID ChannelID)
- func (m *Msg) SetResponseTo(id MsgID, externalID string)
- func (m *Msg) SetTimeout(id SessionID, start time.Time, timeout time.Duration)
- func (m *Msg) SetTopup(topupID TopupID)
- func (m *Msg) SetURN(urn urns.URN) error
- func (m *Msg) Status() MsgStatus
- func (m *Msg) Text() string
- func (m *Msg) TopupID() TopupID
- func (m *Msg) URN() urns.URN
- func (m *Msg) URNAuth() null.String
- func (m *Msg) UUID() flows.MsgUUID
- func (m *Msg) Visibility() MsgVisibility
- type MsgDirection
- type MsgID
- type MsgLabelAdd
- type MsgStatus
- type MsgType
- type MsgVisibility
- type OffsetUnit
- type Org
- func (o *Org) AllowedLanguages() []utils.Language
- func (o *Org) ConfigValue(key string, def string) string
- func (o *Org) DateFormat() utils.DateFormat
- func (o *Org) DefaultCountry() utils.Country
- func (o *Org) DefaultLanguage() utils.Language
- func (o *Org) Equal(env utils.Environment) bool
- func (o *Org) Extension(name string) json.RawMessage
- func (o *Org) ID() OrgID
- func (o *Org) MarshalJSON() ([]byte, error)
- func (o *Org) MaxValueLength() int
- func (o *Org) Now() time.Time
- func (o *Org) NumberFormat() *utils.NumberFormat
- func (o *Org) RedactionPolicy() utils.RedactionPolicy
- func (o *Org) TimeFormat() utils.TimeFormat
- func (o *Org) Timezone() *time.Location
- type OrgAssets
- func (a *OrgAssets) AddTestChannel(channel assets.Channel)
- func (a *OrgAssets) CampaignByGroupID(groupID GroupID) []*Campaign
- func (a *OrgAssets) CampaignEventByID(eventID CampaignEventID) *CampaignEvent
- func (a *OrgAssets) CampaignEventsByFieldID(fieldID FieldID) []*CampaignEvent
- func (a *OrgAssets) Campaigns() []*Campaign
- func (a *OrgAssets) ChannelByID(channelID ChannelID) *Channel
- func (a *OrgAssets) ChannelByUUID(channelUUID assets.ChannelUUID) *Channel
- func (a *OrgAssets) Channels() ([]assets.Channel, error)
- func (a *OrgAssets) Env() utils.Environment
- func (a *OrgAssets) FieldByKey(key string) *Field
- func (a *OrgAssets) FieldByUUID(fieldUUID FieldUUID) *Field
- func (a *OrgAssets) Fields() ([]assets.Field, error)
- func (a *OrgAssets) Flow(flowUUID assets.FlowUUID) (assets.Flow, error)
- func (a *OrgAssets) FlowByID(flowID FlowID) (*Flow, error)
- func (a *OrgAssets) GroupByID(groupID GroupID) *Group
- func (a *OrgAssets) GroupByUUID(groupUUID assets.GroupUUID) *Group
- func (a *OrgAssets) Groups() ([]assets.Group, error)
- func (a *OrgAssets) LabelByUUID(uuid assets.LabelUUID) *Label
- func (a *OrgAssets) Labels() ([]assets.Label, error)
- func (a *OrgAssets) Locations() ([]assets.LocationHierarchy, error)
- func (a *OrgAssets) Org() *Org
- func (a *OrgAssets) OrgID() OrgID
- func (a *OrgAssets) ResthookBySlug(slug string) *Resthook
- func (a *OrgAssets) Resthooks() ([]assets.Resthook, error)
- func (a *OrgAssets) SetFlow(flowID FlowID, flow flows.Flow) (*Flow, error)
- func (a *OrgAssets) Triggers() []*Trigger
- type OrgID
- type Queryer
- type Resthook
- type ResthookID
- type ResthookUnsubscribe
- type ResultID
- type Session
- func ActiveSessionForContact(ctx context.Context, db *sqlx.DB, org *OrgAssets, sessionType FlowType, ...) (*Session, error)
- func NewSession(org *OrgAssets, fs flows.Session, sprint flows.Sprint) (*Session, error)
- func WriteSessions(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, ...) ([]*Session, error)
- func (s *Session) AddPostCommitEvent(hook EventCommitHook, event interface{})
- func (s *Session) AddPreCommitEvent(hook EventCommitHook, event interface{})
- func (s *Session) ChannelConnection() *ChannelConnection
- func (s *Session) ConnectionID() *ConnectionID
- func (s *Session) Contact() *flows.Contact
- func (s *Session) ContactID() ContactID
- func (s *Session) ContactUUID() flows.ContactUUID
- func (s *Session) CreatedOn() time.Time
- func (s *Session) CurrentFlowID() *FlowID
- func (s *Session) EndedOn() *time.Time
- func (s *Session) FlowSession(sa flows.SessionAssets, env utils.Environment) (flows.Session, error)
- func (s *Session) ID() SessionID
- func (s *Session) IncomingMsgExternalID() string
- func (s *Session) IncomingMsgID() MsgID
- func (s *Session) MarshalJSON() ([]byte, error)
- func (s *Session) OrgID() OrgID
- func (s *Session) Output() string
- func (s *Session) OutputMD5() string
- func (s *Session) Responded() bool
- func (s *Session) Runs() []*FlowRun
- func (s *Session) SessionType() FlowType
- func (s *Session) SetChannelConnection(cc *ChannelConnection)
- func (s *Session) SetIncomingMsg(id flows.MsgID, externalID string)
- func (s *Session) Sprint() flows.Sprint
- func (s *Session) Status() SessionStatus
- func (s *Session) Timeout() *time.Duration
- func (s *Session) TimeoutOn() *time.Time
- func (s *Session) UnmarshalJSON(b []byte) error
- func (s *Session) Wait() flows.Wait
- func (s *Session) WaitStartedOn() *time.Time
- func (s *Session) WriteUpdatedSession(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, ...) error
- type SessionCommitHook
- type SessionID
- type SessionStatus
- type StartID
- type StartMode
- type Step
- type Topup
- type TopupID
- type Trigger
- func FindMatchingMOCallTrigger(org *OrgAssets, contact *Contact) *Trigger
- func FindMatchingMissedCallTrigger(org *OrgAssets) *Trigger
- func FindMatchingMsgTrigger(org *OrgAssets, contact *flows.Contact, text string) *Trigger
- func FindMatchingNewConversationTrigger(org *OrgAssets, channel *Channel) *Trigger
- func FindMatchingReferralTrigger(org *OrgAssets, channel *Channel, referrerID string) *Trigger
- func (t *Trigger) ChannelID() ChannelID
- func (t *Trigger) FlowID() FlowID
- func (t *Trigger) GroupIDs() []GroupID
- func (t *Trigger) ID() TriggerID
- func (t *Trigger) Keyword() string
- func (t *Trigger) KeywordMatchType() triggers.KeywordMatchType
- func (t *Trigger) Match() *triggers.KeywordMatch
- func (t *Trigger) MatchType() MatchType
- func (t *Trigger) ReferrerID() string
- func (t *Trigger) TriggerType() TriggerType
- type TriggerID
- type TriggerType
- type URNID
- type WebhookEvent
- type WebhookEventID
- type WebhookResult
Constants ¶
const ( // OffsetMinute means our offset is in minutes OffsetMinute = OffsetUnit("M") // OffsetHour means our offset is in hours OffsetHour = OffsetUnit("H") // OffsetDay means our offset is in days OffsetDay = OffsetUnit("D") // OffsetWeek means our offset is in weeks OffsetWeek = OffsetUnit("W") // NilDeliveryHour is our constant for not having a set delivery hour NilDeliveryHour = -1 // StartModeInterrupt means the flow for this campaign event should interrupt other flows StartModeInterrupt = StartMode("I") // StartModeSkip means the flow should be skipped if the user is active in another flow StartModeSkip = StartMode("S") // StartModePassive means the flow should be started without interrupting the user in other flows StartModePassive = StartMode("P") )
const ( // FireResultFired means our flow was started FireResultFired = "F" // FireResultSkipped means our flow was skipped FireResultSkipped = "S" )
const ( ConnectionDirectionIn = ConnectionDirection("I") ConnectionDirectionOut = ConnectionDirection("O") ConnectionTypeIVR = ConnectionType("V") ConnectionStatusPending = ConnectionStatus("P") ConnectionStatusQueued = ConnectionStatus("Q") ConnectionStatusWired = ConnectionStatus("W") ConnectionStatusRinging = ConnectionStatus("R") ConnectionStatusInProgress = ConnectionStatus("I") ConnectionStatusBusy = ConnectionStatus("B") ConnectionStatusFailed = ConnectionStatus("F") ConnectionStatusErrored = ConnectionStatus("E") ConnectionStatusNoAnswer = ConnectionStatus("N") ConnectionStatusCancelled = ConnectionStatus("C") ConnectionStatusCompleted = ConnectionStatus("D") ConnectionMaxRetries = 3 // ConnectionRetryWait is our default wait to retry connections in minutes ConnectionRetryWait = 60 // ConnectionThrottleWait is our wait between throttle retries ConnectionThrottleWait = time.Minute * 2 )
const ( NewConversationEventType = ChannelEventType("new_conversation") ReferralEventType = ChannelEventType("referral") MOMissEventType = ChannelEventType("mo_miss") MOCallEventType = ChannelEventType("mo_call") )
const ( ChannelTypeAndroid = ChannelType("A") ChannelConfigCallbackDomain = "callback_domain" ChannelConfigMaxConcurrentEvents = "max_concurrent_events" )
const ( NilURNID = URNID(0) NilContactID = ContactID(0) )
const ( IVRFlow = FlowType("V") MessagingFlow = FlowType("M") SurveyorFlow = FlowType("S") FlowConfigIVRRetryMinutes = "ivr_retry" )
const ( DirectionIn = MsgDirection("I") DirectionOut = MsgDirection("O") )
const ( VisibilityVisible = MsgVisibility("V") VisibilityArchived = MsgVisibility("A") VisibilityDeleted = MsgVisibility("D") )
const ( TypeInbox = MsgType("I") TypeFlow = MsgType("F") TypeIVR = MsgType("V") TypeUSSD = MsgType("U") )
const ( MsgStatusInitializing = MsgStatus("I") MsgStatusPending = MsgStatus("P") MsgStatusQueued = MsgStatus("Q") MsgStatusWired = MsgStatus("W") MsgStatusSent = MsgStatus("S") MsgStatusHandled = MsgStatus("H") MsgStatusErrored = MsgStatus("E") MsgStatusFailed = MsgStatus("F") MsgStatusResent = MsgStatus("R") )
const ( SessionStatusActive = "A" SessionStatusCompleted = "C" SessionStatusErrored = "E" SessionStatusWaiting = "W" SessionStatusExpired = "X" )
const ( CatchallTriggerType = TriggerType("C") KeywordTriggerType = TriggerType("K") MissedCallTriggerType = TriggerType("M") NewConversationTriggerType = TriggerType("N") ReferralTriggerType = TriggerType("R") CallTriggerType = TriggerType("V") MatchFirst = "F" MatchOnly = "O" )
const ( EventTypeFlow = EventType("flow") EventStatusComplete = EventStatus("C") )
const NilBroadcastID = BroadcastID(0)
const NilConnectionID = ConnectionID(0)
const NilFlowRunID = FlowRunID(0)
const NilMsgID = MsgID(0)
NilMsgID is our constant for a nil msg id
const NilOrgID = OrgID(0)
Variables ¶
var ( ExitInterrupted = ExitType("I") ExitCompleted = ExitType("C") ExitExpired = ExitType("E") )
var AgeFieldUUID = FieldUUID("903f51da-2717-47c7-a0d3-f2f32877013d")
var AlexandriaID = ContactID(10003)
var AlexandriaURN = urns.URN("tel:+250700000004")
var AlexandriaURNID = URNID(10003)
var AlexandriaUUID = flows.ContactUUID("9709c157-4606-4d41-9df3-9e9c9b4ae2d4")
var BobID = ContactID(10001)
var BobURN = urns.URN("tel:+250700000002")
var BobURNID = URNID(10001)
var BobUUID = flows.ContactUUID("b699a406-7e44-49be-9f01-1a82893e8a10")
var CampaignFlowID = FlowID(10009)
var CampaignFlowUUID = assets.FlowUUID("3a92a964-3a8d-420b-9206-2cd9d884ac30")
var CathyID = ContactID(10000)
var CathyURN = urns.URN("tel:+250700000001")
var CathyURNID = URNID(10000)
var CathyUUID = flows.ContactUUID("6393abc0-283d-4c9b-a1b3-641a035c34bf")
var DoctorRemindersCampaignID = CampaignID(10000)
var DoctorRemindersCampaignUUID = CampaignUUID("72aa12c5-cc11-4bc7-9406-044047845c70")
var DoctorsGroupID = GroupID(10000)
var DoctorsGroupUUID = assets.GroupUUID("c153e265-f7c9-4539-9dbc-9b358714b638")
var FavoritesFlowID = FlowID(10000)
var FavoritesFlowUUID = assets.FlowUUID("9de3663f-c5c5-4c92-9f45-ecbc09abcc85")
var FlowTypeMapping = map[flows.FlowType]FlowType{ flows.FlowTypeMessaging: MessagingFlow, flows.FlowTypeVoice: IVRFlow, flows.FlowTypeMessagingOffline: SurveyorFlow, }
var GenderFieldUUID = FieldUUID("3a5891e4-756e-4dc9-8e12-b7a766168824")
var GeorgeID = ContactID(10002)
var GeorgeURN = urns.URN("tel:+250700000003")
var GeorgeURNID = URNID(10002)
var GeorgeUUID = flows.ContactUUID("8d024bcd-f473-4719-a00a-bd0bb1190135")
var IVRFlowID = FlowID(10003)
var IVRFlowUUID = assets.FlowUUID("2f81d0ea-4d75-4843-9371-3f7465311cce")
var IncomingExtraFlowID = FlowID(10006)
var IncomingExtraFlowUUID = assets.FlowUUID("376d3de6-7f0e-408c-80d6-b1919738bc80")
var NexmoChannelID = ChannelID(10001)
var NexmoChannelUUID = assets.ChannelUUID("19012bfd-3ce3-4cae-9bb9-76cf92c73d49")
var NilChannelID = ChannelID(0)
var NilStartID = StartID(0)
NilStartID is our constant for a nil start id
var NilTopupID = TopupID(0)
NilTopupID is our nil value for topup id
var Org1 = OrgID(1)
var Org2 = OrgID(2)
var Org2ChannelID = ChannelID(20000)
var Org2FavoritesFlowID = FlowID(20000)
var Org2FavoritesFlowUUID = assets.FlowUUID("f161bd16-3c60-40bd-8c92-228ce815b9cd")
var Org2FredID = ContactID(20000)
var Org2FredURN = urns.URN("tel:+250700000005")
var Org2FredURNID = URNID(20000)
var Org2FredUUID = flows.ContactUUID("26d20b72-f7d8-44dc-87f2-aae046dbff95")
var Org2SingleMessageFlowID = FlowID(20001)
var Org2SingleMessageFlowUUID = assets.FlowUUID("5277916d-6011-41ac-a4a4-f6ac6a4f1dd9")
var ParentTimeoutID = FlowID(10007)
var ParentTimeoutUUID = assets.FlowUUID("81c0f323-7e06-4e0c-a960-19c20f17117c")
var PickNumberFlowID = FlowID(10001)
var PickNumberFlowUUID = assets.FlowUUID("5890fe3a-f204-4661-b74d-025be4ee019c")
var RemindersEvent1ID = CampaignEventID(10000)
var RemindersEvent2ID = CampaignEventID(10001)
var ReportingLabelID = LabelID(10000)
var ReportingLabelUUID = assets.LabelUUID("ebc4dedc-91c4-4ed4-9dd6-daa05ea82698")
var SingleMessageFlowID = FlowID(10004)
var SingleMessageFlowUUID = assets.FlowUUID("a7c11d68-f008-496f-b56d-2d5cf4cf16a5")
var SurveyorFlowID = FlowID(10005)
var SurveyorFlowUUID = assets.FlowUUID("ed8cf8d4-a42c-4ce1-a7e3-44a2918e3cec")
var TestersGroupID = GroupID(10001)
var TestersGroupUUID = assets.GroupUUID("5e9d8fab-5e7e-4f51-b533-261af5dea70d")
var TestingLabelID = LabelID(10001)
var TestingLabelUUID = assets.LabelUUID("a6338cdc-7938-4437-8b05-2d5d785e3a08")
var TwilioChannelID = ChannelID(10000)
var TwilioChannelUUID = assets.ChannelUUID("74729f45-7f29-4868-9dc4-90e491e3c7d8")
var TwitterChannelID = ChannelID(10002)
var TwitterChannelUUID = assets.ChannelUUID("0f661e8b-ea9d-4bd3-9953-d368340acf91")
Functions ¶
func ActiveChannelConnectionCount ¶ added in v0.0.74
ActiveChannelConnectionCount returns the number of ongoing connections for the passed in channel
func AddContactsToGroups ¶ added in v0.0.38
AddContactsToGroups fires a bulk SQL query to remove all the contacts in the passed in groups
func AddEventFires ¶ added in v0.0.38
AddEventFires adds the passed in event fires to our db
func AddMsgLabels ¶ added in v0.0.53
AddMsgLabels inserts the passed in msg labels to our db
func ApplyEvent ¶
func ApplyEvent(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, session *Session, e flows.Event) error
ApplyEvent applies the passed in event, IE, creates the db objects required etc..
func ApplyPostEventHooks ¶ added in v0.0.17
func ApplyPostEventHooks(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, sessions []*Session) error
ApplyPostEventHooks runs through all the post event hooks for the passed in sessions and applies their events
func ApplyPreEventHooks ¶ added in v0.0.17
func ApplyPreEventHooks(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, sessions []*Session) error
ApplyPreEventHooks runs through all the pre event hooks for the passed in sessions and applies their events
func CalculateDynamicGroups ¶ added in v0.0.58
func CalculateDynamicGroups(ctx context.Context, tx Queryer, org *OrgAssets, contact *flows.Contact) error
CalculateDynamicGroups recalculates all the dynamic groups for the passed in contact, recalculating campaigns as necessary based on those group changes.
func ContactIDsFromURNs ¶ added in v0.0.58
func ContactIDsFromURNs(ctx context.Context, db *sqlx.DB, org *OrgAssets, assets flows.SessionAssets, us []urns.URN) (map[urns.URN]ContactID, error)
ContactIDsFromURNs will fetch or create the contacts for the passed in URNs, returning a map the same length as the passed in URNs with the ids of the contacts.
func ContactLock ¶ added in v0.0.86
ContactLock returns the lock key for a particular contact, used with locker
func DeleteEventFires ¶ added in v0.0.27
DeleteEventFires deletes all event fires passed in (used when an event has been marked as inactive)
func DeleteUnfiredContactEvents ¶ added in v0.0.58
DeleteUnfiredContactEvents deletes all unfired event fires for the passed in contact
func DeleteUnfiredEventFires ¶ added in v0.0.38
DeleteUnfiredEventFires removes event fires for the passed in event and contact
func Exec ¶ added in v0.0.74
Exec calls ExecContext on the passed in Queryer, logging time taken if any rows were affected
func ExitSessions ¶ added in v0.0.74
func ExitSessions(ctx context.Context, tx Queryer, sessionIDs []SessionID, exitType ExitType, now time.Time) error
ExitSessions marks the passed in sessions as completed, also doing so for all associated runs
func ExpireRunsAndSessions ¶ added in v0.0.74
func ExpireRunsAndSessions(ctx context.Context, db Queryer, runIDs []FlowRunID, sessionIDs []SessionID) error
ExpireRunsAndSessions expires all the passed in runs and sessions. Note this should only be called for runs that have no parents or no way of continuing
func GetSessionAssets ¶ added in v0.0.38
func GetSessionAssets(org *OrgAssets) (flows.SessionAssets, error)
GetSessionAssets returns a goflow session assets object for the passed in org assets
func InsertFlowStarts ¶ added in v0.0.126
InsertFlowStarts inserts all the passed in starts
func InsertMessages ¶ added in v0.0.38
InsertMessages inserts the passed in messages in a single query
func InsertWebhookEvents ¶ added in v0.0.84
func InsertWebhookEvents(ctx context.Context, db Queryer, events []*WebhookEvent) error
InsertWebhookEvents inserts the passed in webhook events, assigning them ids
func InsertWebhookResults ¶ added in v0.0.76
func InsertWebhookResults(ctx context.Context, db Queryer, results []*WebhookResult) error
InsertWebhookResults will insert the passed in webhook results, setting the ID parameter on each
func InterruptContactRuns ¶ added in v0.0.27
func InterruptContactRuns(ctx context.Context, tx *sqlx.Tx, contactIDs []flows.ContactID, now time.Time) error
InterruptContactRuns interrupts all runs and sesions that exist for the passed in list of contacts
func MarkEventsFired ¶ added in v0.0.19
func MarkEventsFired(ctx context.Context, tx Queryer, fires []*EventFire, fired time.Time, result EventFireResult) error
MarkEventsFired updates the passed in event fires with the fired time and result
func MarkMessagesPending ¶ added in v0.0.5
MarkMessagesPending marks the passed in messages as pending
func MarkMessagesQueued ¶ added in v0.0.2
MarkMessagesQueued marks the passed in messages as queued
func MarkStartComplete ¶ added in v0.0.27
MarkStartComplete sets the status for the passed in flow start
func MarkStartStarted ¶ added in v0.0.28
MarkStartStarted sets the status for the passed in flow start to S and updates the contact count on it
func NewSessionAssets ¶ added in v0.0.51
func NewSessionAssets(org *OrgAssets) (flows.SessionAssets, error)
NewSessionAssets creates new sessions assets, returning the result
func NormalizeAttachment ¶ added in v0.0.74
func NormalizeAttachment(attachment flows.Attachment) flows.Attachment
NormalizeAttachment will turn any relative URL in the passed in attachment and normalize it to include the full host for attachment domains
func RegisterEventHook ¶ added in v0.0.38
func RegisterEventHook(eventType string, handler EventHandler)
RegisterEventHook registers the passed in handler as being interested in the passed in type
func RemoveContactsFromGroups ¶ added in v0.0.38
func RemoveContactsFromGroups(ctx context.Context, tx Queryer, removals []*GroupRemove) error
RemoveContactsFromGroups fires a bulk SQL query to remove all the contacts in the passed in groups
func RunExpiration ¶ added in v0.0.66
RunExpiration looks up the run expiration for the passed in run, can return nil if the run is no longer active
func StopContact ¶ added in v0.0.38
StopContact stops the contact with the passed in id, removing them from all groups and setting their state to stopped.
func URNForID ¶ added in v0.0.74
URNForID will return a URN for the passed in ID including all the special query parameters set that goflow and mailroom depend on. Generally this URN is build when loading a contact but occasionally we need to load URNs one by one and this accomplishes that
func URNForURN ¶ added in v0.0.74
URNForURN will return a URN for the passed in URN including all the special query parameters set that goflow and mailroom depend on.
func UnsubscribeResthooks ¶ added in v0.0.38
UnsubscribeResthooks unsubscribles all the resthooks passed in
func UpdateChannelConnectionStatuses ¶ added in v0.0.74
func UpdateChannelConnectionStatuses(ctx context.Context, db Queryer, connectionIDs []ConnectionID, status ConnectionStatus) error
UpdateChannelConnectionStatuses updates the status for all the passed in connection ids
func UpdateContactModifiedOn ¶ added in v0.0.48
UpdateContactModifiedOn updates modified on on the passed in contact
func UpdateContactURNs ¶ added in v0.0.48
func UpdateContactURNs(ctx context.Context, tx Queryer, org *OrgAssets, changes []*ContactURNsChanged) error
UpdateContactURNs updates the contact urns in our database to match the passed in changes
Types ¶
type Broadcast ¶ added in v0.0.60
type Broadcast struct {
// contains filtered or unexported fields
}
Broadcast represents a broadcast that needs to be sent
func NewBroadcastFromEvent ¶ added in v0.0.60
func NewBroadcastFromEvent(ctx context.Context, tx Queryer, org *OrgAssets, event *events.BroadcastCreatedEvent) (*Broadcast, error)
NewBroadcastFromEvent creates a broadcast object from the passed in broadcast event
func (*Broadcast) ContactIDs ¶ added in v0.0.60
func (*Broadcast) CreateBatch ¶ added in v0.0.60
func (b *Broadcast) CreateBatch(contactIDs []ContactID) *BroadcastBatch
func (*Broadcast) MarshalJSON ¶ added in v0.0.60
func (*Broadcast) Translations ¶ added in v0.0.60
func (b *Broadcast) Translations() map[utils.Language]*BroadcastTranslation
func (*Broadcast) UnmarshalJSON ¶ added in v0.0.60
type BroadcastBatch ¶ added in v0.0.60
type BroadcastBatch struct {
// contains filtered or unexported fields
}
BroadcastBatch represents a batch of contacts that need messages sent for
func (*BroadcastBatch) BaseLanguage ¶ added in v0.0.60
func (b *BroadcastBatch) BaseLanguage() utils.Language
func (*BroadcastBatch) ContactIDs ¶ added in v0.0.60
func (b *BroadcastBatch) ContactIDs() []ContactID
func (*BroadcastBatch) IsLast ¶ added in v0.0.60
func (b *BroadcastBatch) IsLast() bool
func (*BroadcastBatch) MarshalJSON ¶ added in v0.0.60
func (b *BroadcastBatch) MarshalJSON() ([]byte, error)
func (*BroadcastBatch) OrgID ¶ added in v0.0.60
func (b *BroadcastBatch) OrgID() OrgID
func (*BroadcastBatch) SetIsLast ¶ added in v0.0.60
func (b *BroadcastBatch) SetIsLast(last bool)
func (*BroadcastBatch) SetURNs ¶ added in v0.0.60
func (b *BroadcastBatch) SetURNs(urns map[ContactID]urns.URN)
func (*BroadcastBatch) Translations ¶ added in v0.0.60
func (b *BroadcastBatch) Translations() map[utils.Language]*BroadcastTranslation
func (*BroadcastBatch) URNs ¶ added in v0.0.60
func (b *BroadcastBatch) URNs() map[ContactID]urns.URN
func (*BroadcastBatch) UnmarshalJSON ¶ added in v0.0.60
func (b *BroadcastBatch) UnmarshalJSON(data []byte) error
type BroadcastID ¶ added in v0.0.60
type BroadcastID int64
type BroadcastTranslation ¶ added in v0.0.60
type BroadcastTranslation struct { Text string `json:"text"` Attachments []flows.Attachment `json:"attachments,omitempty"` QuickReplies []string `json:"quick_replies,omitempty"` }
BroadcastTranslation is the translation for the passed in language
type Campaign ¶ added in v0.0.17
type Campaign struct {
// contains filtered or unexported fields
}
Campaign is our struct for a campaign and all its events
func (*Campaign) Events ¶ added in v0.0.17
func (c *Campaign) Events() []*CampaignEvent
Events returns the list of events for this campaign
func (*Campaign) GroupID ¶ added in v0.0.17
GroupID returns the id of the group this campaign works against
func (*Campaign) GroupUUID ¶ added in v0.0.17
GroupUUID returns the uuid of the group this campaign works against
func (*Campaign) ID ¶ added in v0.0.17
func (c *Campaign) ID() CampaignID
ID return the database id of this campaign
func (*Campaign) UUID ¶ added in v0.0.17
func (c *Campaign) UUID() CampaignUUID
UUID returns the UUID of this campaign
type CampaignEvent ¶ added in v0.0.17
type CampaignEvent struct {
// contains filtered or unexported fields
}
func (*CampaignEvent) Campaign ¶ added in v0.0.17
func (e *CampaignEvent) Campaign() *Campaign
Campaign returns the campaign this event is part of
func (*CampaignEvent) DeliveryHour ¶ added in v0.0.17
func (e *CampaignEvent) DeliveryHour() int
DeliveryHour returns the hour this event should send at, if any
func (*CampaignEvent) ID ¶ added in v0.0.17
func (e *CampaignEvent) ID() CampaignEventID
ID returns the database id for this campaign event
func (*CampaignEvent) Offset ¶ added in v0.0.17
func (e *CampaignEvent) Offset() int
Offset returns the offset for thi campaign event
func (*CampaignEvent) QualifiesByField ¶ added in v0.0.50
func (e *CampaignEvent) QualifiesByField(contact *flows.Contact) bool
QualifiesByField returns whether the passed in contact qualifies for this event by group membership
func (*CampaignEvent) QualifiesByGroup ¶ added in v0.0.50
func (e *CampaignEvent) QualifiesByGroup(contact *flows.Contact) bool
QualifiesByGroup returns whether the passed in contact qualifies for this event by group membership
func (*CampaignEvent) RelativeToID ¶ added in v0.0.17
func (e *CampaignEvent) RelativeToID() FieldID
RelativeToID returns the ID of the field this event is relative to
func (*CampaignEvent) RelativeToKey ¶ added in v0.0.17
func (e *CampaignEvent) RelativeToKey() string
RelativeToKey returns the key of the field this event is relative to
func (*CampaignEvent) ScheduleForContact ¶ added in v0.0.38
func (e *CampaignEvent) ScheduleForContact(tz *time.Location, now time.Time, contact *flows.Contact) (*time.Time, error)
ScheduleForContact calculates the next fire ( if any) for the passed in contact
func (*CampaignEvent) ScheduleForTime ¶ added in v0.0.17
func (e *CampaignEvent) ScheduleForTime(tz *time.Location, now time.Time, start time.Time) (*time.Time, error)
ScheduleForTime calculates the next fire (if any) for the passed in time and timezone
func (*CampaignEvent) StartMode ¶ added in v0.0.42
func (e *CampaignEvent) StartMode() StartMode
StartMode returns the start mode for this campaign event
func (*CampaignEvent) UUID ¶ added in v0.0.17
func (e *CampaignEvent) UUID() CampaignEventUUID
UUID returns the UUID of this campaign event
func (*CampaignEvent) Unit ¶ added in v0.0.17
func (e *CampaignEvent) Unit() OffsetUnit
Unit returns the unit for this campaign event
func (*CampaignEvent) UnmarshalJSON ¶ added in v0.0.17
func (e *CampaignEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON is our unmarshaller for json data
type CampaignEventID ¶ added in v0.0.17
type CampaignEventID int
CampaignEventID is our type for campaign event ids
type CampaignEventUUID ¶ added in v0.0.17
CampaignEventUUID is our type for campaign event UUIDs
type CampaignUUID ¶ added in v0.0.17
CampaignUUID is our type for campaign UUIDs
type Channel ¶ added in v0.0.5
type Channel struct {
// contains filtered or unexported fields
}
Channel is the mailroom struct that represents channels
func (*Channel) ChannelReference ¶ added in v0.0.38
func (c *Channel) ChannelReference() *assets.ChannelReference
ChannelReference return a channel reference for this channel
func (*Channel) ConfigValue ¶ added in v0.0.73
ConfigValue returns the config value for the passed in key
func (*Channel) MatchPrefixes ¶ added in v0.0.5
MatchPrefixes returns the prefixes we should also match when determining channel affinity
func (*Channel) Parent ¶ added in v0.0.5
func (c *Channel) Parent() *assets.ChannelReference
Parent returns a reference to the parent channel of this channel (if any)
func (*Channel) Roles ¶ added in v0.0.5
func (c *Channel) Roles() []assets.ChannelRole
Roles returns the roles this channel supports
func (*Channel) TPS ¶ added in v0.0.5
TPS returns the max number of transactions per second this channel supports
func (*Channel) Type ¶ added in v0.0.5
func (c *Channel) Type() ChannelType
Type returns the channel type for this channel
func (*Channel) UUID ¶ added in v0.0.5
func (c *Channel) UUID() assets.ChannelUUID
UUID returns the UUID of this channel
type ChannelConnection ¶ added in v0.0.74
type ChannelConnection struct {
// contains filtered or unexported fields
}
func InsertIVRConnection ¶ added in v0.0.74
func InsertIVRConnection(ctx context.Context, db *sqlx.DB, orgID OrgID, channelID ChannelID, startID StartID, contactID ContactID, urnID URNID, direction ConnectionDirection, status ConnectionStatus, externalID string) (*ChannelConnection, error)
InsertIVRConnection creates a new IVR session for the passed in org, channel and contact, inserting it
func LoadChannelConnectionsToRetry ¶ added in v0.0.74
func LoadChannelConnectionsToRetry(ctx context.Context, db Queryer, limit int) ([]*ChannelConnection, error)
LoadChannelConnectionsToRetry returns up to limit connections that need to be retried
func SelectChannelConnection ¶ added in v0.0.74
func SelectChannelConnection(ctx context.Context, db Queryer, id ConnectionID) (*ChannelConnection, error)
SelectChannelConnection loads a channel connection by id
func SelectChannelConnectionByExternalID ¶ added in v0.0.74
func SelectChannelConnectionByExternalID(ctx context.Context, db Queryer, channelID ChannelID, connType ConnectionType, externalID string) (*ChannelConnection, error)
SelectChannelConnectionByExternalID loads a channel connection by id
func (*ChannelConnection) ChannelID ¶ added in v0.0.74
func (c *ChannelConnection) ChannelID() ChannelID
func (*ChannelConnection) ContactID ¶ added in v0.0.74
func (c *ChannelConnection) ContactID() ContactID
func (*ChannelConnection) ContactURNID ¶ added in v0.0.74
func (c *ChannelConnection) ContactURNID() URNID
func (*ChannelConnection) ExternalID ¶ added in v0.0.74
func (c *ChannelConnection) ExternalID() string
func (*ChannelConnection) ID ¶ added in v0.0.74
func (c *ChannelConnection) ID() ConnectionID
func (*ChannelConnection) MarkErrored ¶ added in v0.0.74
func (c *ChannelConnection) MarkErrored(ctx context.Context, db Queryer, now time.Time, wait time.Duration) error
MarkErrored updates the status for this connection to errored and schedules a retry if appropriate
func (*ChannelConnection) MarkFailed ¶ added in v0.0.74
MarkFailed updates the status for this connection
func (*ChannelConnection) MarkStarted ¶ added in v0.0.74
MarkStarted updates the status for this connection as well as sets the started on date
func (*ChannelConnection) MarkThrottled ¶ added in v0.0.74
MarkThrottled updates the status for this connection to be queued, to be retried in a minute
func (*ChannelConnection) NextAttempt ¶ added in v0.0.74
func (c *ChannelConnection) NextAttempt() *time.Time
func (*ChannelConnection) OrgID ¶ added in v0.0.74
func (c *ChannelConnection) OrgID() OrgID
func (*ChannelConnection) StartID ¶ added in v0.0.74
func (c *ChannelConnection) StartID() StartID
func (*ChannelConnection) Status ¶ added in v0.0.74
func (c *ChannelConnection) Status() ConnectionStatus
func (*ChannelConnection) UpdateExternalID ¶ added in v0.0.74
UpdateExternalID updates the external id on the passed in channel session
func (*ChannelConnection) UpdateStatus ¶ added in v0.0.74
func (c *ChannelConnection) UpdateStatus(ctx context.Context, db Queryer, status ConnectionStatus, duration int, now time.Time) error
UpdateStatus updates the status for this connection
type ChannelEvent ¶ added in v0.0.74
type ChannelEvent struct {
// contains filtered or unexported fields
}
ChannelEvent represents an event that occurred associated with a channel, such as a referral, missed call, etc..
func NewChannelEvent ¶ added in v0.0.74
func NewChannelEvent(eventType ChannelEventType, orgID OrgID, channelID ChannelID, contactID ContactID, urnID URNID, extra map[string]string, isNewContact bool) *ChannelEvent
NewChannelEvent creates a new channel event for the passed in parameters, returning it
func (*ChannelEvent) ChannelID ¶ added in v0.0.74
func (e *ChannelEvent) ChannelID() ChannelID
func (*ChannelEvent) ContactID ¶ added in v0.0.74
func (e *ChannelEvent) ContactID() ContactID
func (*ChannelEvent) Extra ¶ added in v0.0.74
func (e *ChannelEvent) Extra() map[string]string
func (*ChannelEvent) ID ¶ added in v0.0.74
func (e *ChannelEvent) ID() ChannelEventID
func (*ChannelEvent) Insert ¶ added in v0.0.74
Insert inserts this channel event to our DB. The ID of the channel event will be set if no error is returned
func (*ChannelEvent) IsNewContact ¶ added in v0.0.74
func (e *ChannelEvent) IsNewContact() bool
func (*ChannelEvent) MarshalJSON ¶ added in v0.0.74
func (e *ChannelEvent) MarshalJSON() ([]byte, error)
MarshalJSON is our custom marshaller so that our inner struct get output
func (*ChannelEvent) OrgID ¶ added in v0.0.74
func (e *ChannelEvent) OrgID() OrgID
func (*ChannelEvent) URNID ¶ added in v0.0.74
func (e *ChannelEvent) URNID() URNID
func (*ChannelEvent) UnmarshalJSON ¶ added in v0.0.74
func (e *ChannelEvent) UnmarshalJSON(b []byte) error
UnmarshalJSON is our custom marshaller so that our inner struct get output
type ChannelEventID ¶ added in v0.0.74
type ChannelEventID int64
type ChannelEventType ¶ added in v0.0.74
type ChannelEventType string
type ChannelID ¶
func GetURNChannelID ¶ added in v0.0.73
func (ChannelID) MarshalJSON ¶ added in v0.0.134
MarshalJSON marshals into JSON. 0 values will become null
func (*ChannelID) UnmarshalJSON ¶ added in v0.0.134
UnmarshalJSON unmarshals from JSON. null values become 0
type ChannelLog ¶ added in v0.0.74
type ChannelLog struct {
// contains filtered or unexported fields
}
ChannelLog is the mailroom struct that represents channel logs
func InsertChannelLog ¶ added in v0.0.74
func InsertChannelLog(ctx context.Context, db *sqlx.DB, desc string, isError bool, method string, url string, request []byte, status int, response []byte, createdOn time.Time, elapsed time.Duration, channel *Channel, conn *ChannelConnection) (*ChannelLog, error)
InsertChannelLog writes a channel log to the db returning the inserted log
func (*ChannelLog) ID ¶ added in v0.0.74
func (l *ChannelLog) ID() ChannelLogID
ID returns the id of this channel log
type ChannelLogID ¶ added in v0.0.74
type ChannelLogID int64
ChannelLogID is our type for a channel log id
type ChannelType ¶ added in v0.0.5
type ChannelType string
type ConnectionDirection ¶ added in v0.0.74
type ConnectionDirection string
type ConnectionID ¶
func (ConnectionID) MarshalJSON ¶ added in v0.0.134
func (i ConnectionID) MarshalJSON() ([]byte, error)
MarshalJSON marshals into JSON. 0 values will become null
func (*ConnectionID) Scan ¶ added in v0.0.134
func (i *ConnectionID) Scan(value interface{}) error
Scan scans from the db value. null values become 0
func (*ConnectionID) UnmarshalJSON ¶ added in v0.0.134
func (i *ConnectionID) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals from JSON. null values become 0
type ConnectionStatus ¶ added in v0.0.74
type ConnectionStatus string
type ConnectionType ¶ added in v0.0.74
type ConnectionType string
type Contact ¶ added in v0.0.38
type Contact struct {
// contains filtered or unexported fields
}
Contact is our mailroom struct that represents a contact
func LoadContacts ¶ added in v0.0.5
func LoadContacts(ctx context.Context, db Queryer, org *OrgAssets, ids []ContactID) ([]*Contact, error)
LoadContacts loads a set of contacts for the passed in ids
func (*Contact) FlowContact ¶ added in v0.0.38
FlowContact converts our mailroom contact into a flow contact for use in the engine
func (*Contact) ModifiedOn ¶ added in v0.0.38
func (*Contact) URNForID ¶ added in v0.0.74
URNForID returns the flow URN for the passed in URN, return NilURN if not found
func (*Contact) UUID ¶ added in v0.0.38
func (c *Contact) UUID() flows.ContactUUID
func (*Contact) Unstop ¶ added in v0.0.38
Unstop sets the is_stopped attribute to false for this contact
func (*Contact) UpdatePreferredURN ¶ added in v0.0.48
func (c *Contact) UpdatePreferredURN(ctx context.Context, tx Queryer, org *OrgAssets, urnID URNID, channel *Channel) error
UpdatePreferredURN updates the URNs for the contact (if needbe) to have the passed in URN as top priority with the passed in channel as the preferred channel
type ContactID ¶
ContactID is our type for contact ids, which can be null
func ContactIDsForGroupIDs ¶ added in v0.0.60
func ContactIDsForGroupIDs(ctx context.Context, tx Queryer, groupIDs []GroupID) ([]ContactID, error)
ContactIDsForGroupIDs returns the unique contacts that are in the passed in groups
func ContactIDsFromReferences ¶ added in v0.0.58
func ContactIDsFromReferences(ctx context.Context, tx Queryer, org *OrgAssets, refs []*flows.ContactReference) ([]ContactID, error)
ContactIDsFromReferences queries the contacts for the passed in org, returning the contact ids for the references
func CreateContact ¶ added in v0.0.58
func CreateContact(ctx context.Context, db *sqlx.DB, org *OrgAssets, assets flows.SessionAssets, urn urns.URN) (ContactID, error)
CreateContact creates a new contact for the passed in org with the passed in URNs
func FindActiveSessionOverlap ¶ added in v0.0.133
func FindActiveSessionOverlap(ctx context.Context, db *sqlx.DB, contacts []ContactID) ([]ContactID, error)
FindActiveSessionOverlap returns the list of contact ids which overlap with those passed in which are active in any other flows
func FindFlowStartedOverlap ¶ added in v0.0.27
func FindFlowStartedOverlap(ctx context.Context, db *sqlx.DB, flowID FlowID, contacts []ContactID) ([]ContactID, error)
FindFlowStartedOverlap returns the list of contact ids which overlap with those passed in and which have been in the flow passed in.
func (ContactID) MarshalJSON ¶ added in v0.0.86
MarshalJSON marshals into JSON. 0 values will become null
func (*ContactID) UnmarshalJSON ¶ added in v0.0.86
UnmarshalJSON unmarshals from JSON. null values become 0
type ContactURN ¶ added in v0.0.74
type ContactURN struct { ID URNID `json:"id" db:"id"` Priority int `json:"priority" db:"priority"` Scheme string `json:"scheme" db:"scheme"` Path string `json:"path" db:"path"` Display string `json:"display" db:"display"` Auth string `json:"auth" db:"auth"` ChannelID ChannelID `json:"channel_id" db:"channel_id"` }
type ContactURNsChanged ¶ added in v0.0.48
ContactURNsChanged represents the new status of URNs for a contact
type EventCommitHook ¶ added in v0.0.19
type EventCommitHook interface {
Apply(context.Context, *sqlx.Tx, *redis.Pool, *OrgAssets, map[*Session][]interface{}) error
}
EventCommitHook defines a callback that will accept a certain type of events across session, either before or after committing
type EventFire ¶ added in v0.0.19
type EventFire struct { FireID FireID `db:"fire_id"` EventID CampaignEventID `db:"event_id"` ContactID ContactID `db:"contact_id"` Scheduled time.Time `db:"scheduled"` Fired *time.Time `db:"fired"` FiredResult EventFireResult `db:"fired_result"` }
EventFire represents a single campaign event fire for an event and contact
type EventFireResult ¶ added in v0.0.133
EventFireResult represents how a event fire was fired
type EventHandler ¶ added in v0.0.17
type EventHandler func(context.Context, *sqlx.Tx, *redis.Pool, *OrgAssets, *Session, flows.Event) error
EventHandler defines a call for handling events that occur in a flow
type EventStatus ¶ added in v0.0.84
type EventStatus string
type Field ¶ added in v0.0.5
type Field struct {
// contains filtered or unexported fields
}
Field is our mailroom type for contact field types
type FireAdd ¶ added in v0.0.38
type FireAdd struct { ContactID ContactID `db:"contact_id"` EventID CampaignEventID `db:"event_id"` Scheduled time.Time `db:"scheduled"` }
type FireDelete ¶ added in v0.0.38
type FireDelete struct { ContactID ContactID `db:"contact_id"` EventID CampaignEventID `db:"event_id"` }
type Flow ¶ added in v0.0.5
type Flow struct {
// contains filtered or unexported fields
}
Flow is the mailroom type for a flow
func (*Flow) Definition ¶ added in v0.0.5
func (f *Flow) Definition() json.RawMessage
Definition returns the definition for this flow
func (*Flow) FlowReference ¶ added in v0.0.38
func (f *Flow) FlowReference() *assets.FlowReference
FlowReference return a flow reference for this flow
func (*Flow) IgnoreTriggers ¶ added in v0.0.38
IgnoreTriggers returns whether this flow ignores triggers
func (*Flow) IntConfigValue ¶ added in v0.0.74
IntConfigValue returns the value for the key passed in as an int. If the value is not an integer or is not present then the defaultValue is returned
func (*Flow) IsArchived ¶ added in v0.0.27
IsArchived returns whether this flow is archived
func (*Flow) SetDefinition ¶ added in v0.0.49
func (f *Flow) SetDefinition(definition json.RawMessage)
SetDefinition sets our definition from the passed in new definition format
func (*Flow) SetLegacyDefinition ¶ added in v0.0.49
func (f *Flow) SetLegacyDefinition(legacyDefinition json.RawMessage) error
SetLegacyDefinition sets our definition from the passed in legacy definition
func (*Flow) StringConfigValue ¶ added in v0.0.74
StringConfigValue returns the value for the key passed in as a string. If the value is not a string or is not present then the defaultValue is returned
type FlowRun ¶
type FlowRun struct {
// contains filtered or unexported fields
}
FlowRun is the mailroom type for a FlowRun
func (*FlowRun) MarshalJSON ¶ added in v0.0.77
MarshalJSON is our custom marshaller so that our inner struct get output
func (*FlowRun) ModifiedOn ¶
func (*FlowRun) SetConnectionID ¶ added in v0.0.77
func (r *FlowRun) SetConnectionID(connID *ConnectionID)
func (*FlowRun) SetSessionID ¶ added in v0.0.77
func (*FlowRun) SetStartID ¶ added in v0.0.77
func (*FlowRun) UnmarshalJSON ¶ added in v0.0.77
UnmarshalJSON is our custom marshaller so that our inner struct get output
type FlowStart ¶ added in v0.0.27
type FlowStart struct {
// contains filtered or unexported fields
}
FlowStart represents the top level flow start in our system
func NewFlowStart ¶ added in v0.0.27
func NewFlowStart( orgID OrgID, flowType FlowType, flowID FlowID, groupIDs []GroupID, contactIDs []ContactID, urns []urns.URN, createContact bool, restartParticipants bool, includeActive bool, parent json.RawMessage, extra json.RawMessage) *FlowStart
NewFlowStart creates a new flow start objects for the passed in parameters
func (*FlowStart) ContactIDs ¶ added in v0.0.27
func (*FlowStart) CreateBatch ¶ added in v0.0.27
func (s *FlowStart) CreateBatch(contactIDs []ContactID) *FlowStartBatch
CreateBatch creates a batch for this start using the passed in contact ids
func (*FlowStart) CreateContact ¶ added in v0.0.58
func (*FlowStart) Extra ¶ added in v0.0.82
func (s *FlowStart) Extra() json.RawMessage
func (*FlowStart) IncludeActive ¶ added in v0.0.27
func (*FlowStart) MarshalJSON ¶ added in v0.0.27
func (*FlowStart) Parent ¶ added in v0.0.58
func (s *FlowStart) Parent() json.RawMessage
func (*FlowStart) RestartParticipants ¶ added in v0.0.27
func (*FlowStart) UnmarshalJSON ¶ added in v0.0.27
type FlowStartBatch ¶ added in v0.0.27
type FlowStartBatch struct {
// contains filtered or unexported fields
}
FlowStartBatch represents a single flow batch that needs to be started
func (*FlowStartBatch) ContactIDs ¶ added in v0.0.27
func (b *FlowStartBatch) ContactIDs() []ContactID
func (*FlowStartBatch) Extra ¶ added in v0.0.82
func (b *FlowStartBatch) Extra() json.RawMessage
func (*FlowStartBatch) FlowID ¶ added in v0.0.27
func (b *FlowStartBatch) FlowID() FlowID
func (*FlowStartBatch) IncludeActive ¶ added in v0.0.27
func (b *FlowStartBatch) IncludeActive() bool
func (*FlowStartBatch) IsLast ¶ added in v0.0.27
func (b *FlowStartBatch) IsLast() bool
func (*FlowStartBatch) MarshalJSON ¶ added in v0.0.27
func (b *FlowStartBatch) MarshalJSON() ([]byte, error)
func (*FlowStartBatch) OrgID ¶ added in v0.0.27
func (b *FlowStartBatch) OrgID() OrgID
func (*FlowStartBatch) Parent ¶ added in v0.0.58
func (b *FlowStartBatch) Parent() json.RawMessage
func (*FlowStartBatch) RestartParticipants ¶ added in v0.0.27
func (b *FlowStartBatch) RestartParticipants() bool
func (*FlowStartBatch) SetIsLast ¶ added in v0.0.27
func (b *FlowStartBatch) SetIsLast(last bool)
func (*FlowStartBatch) StartID ¶ added in v0.0.27
func (b *FlowStartBatch) StartID() StartID
func (*FlowStartBatch) UnmarshalJSON ¶ added in v0.0.27
func (b *FlowStartBatch) UnmarshalJSON(data []byte) error
type Group ¶ added in v0.0.5
type Group struct {
// contains filtered or unexported fields
}
Group is our mailroom type for contact groups
type GroupRemove ¶ added in v0.0.38
GroupRemove is our struct to track group removals
type Label ¶ added in v0.0.5
type Label struct {
// contains filtered or unexported fields
}
Label is our mailroom type for message labels
type Location ¶ added in v0.0.5
type Location struct { Name_ string `json:"name"` Aliases_ []string `json:"aliases"` Children_ []*Location `json:"children"` // contains filtered or unexported fields }
Location is our mailroom type for administrative locations TODO: convert to something less jank when we have real location constructors
type Msg ¶
type Msg struct {
// contains filtered or unexported fields
}
Msg is our type for mailroom messages
func CreateBroadcastMessages ¶ added in v0.0.60
func CreateBroadcastMessages(ctx context.Context, db *sqlx.DB, org *OrgAssets, sa flows.SessionAssets, bcast *BroadcastBatch) ([]*Msg, error)
func NewIncomingIVR ¶ added in v0.0.74
func NewIncomingIVR(orgID OrgID, conn *ChannelConnection, in *flows.MsgIn, createdOn time.Time) *Msg
NewIncomingIVR creates a new incoming IVR message for the passed in text and attachment
func NewIncomingMsg ¶ added in v0.0.77
func NewIncomingMsg(orgID OrgID, channel *Channel, contactID ContactID, in *flows.MsgIn, createdOn time.Time) *Msg
NewIncomingMsg creates a new incoming message for the passed in text and attachment
func NewOutgoingIVR ¶ added in v0.0.74
func NewOutgoingIVR(orgID OrgID, conn *ChannelConnection, out *flows.MsgOut, createdOn time.Time) (*Msg, error)
NewOutgoingIVR creates a new IVR message for the passed in text with the optional attachment
func NewOutgoingMsg ¶ added in v0.0.17
func NewOutgoingMsg(orgID OrgID, channel *Channel, contactID ContactID, out *flows.MsgOut, createdOn time.Time) (*Msg, error)
NewOutgoingMsg creates an outgoing message for the passed in flow message. Note that this message is created in a queued state!
func (*Msg) Attachments ¶
func (m *Msg) Attachments() []flows.Attachment
func (*Msg) ChannelUUID ¶
func (m *Msg) ChannelUUID() assets.ChannelUUID
func (*Msg) ConnectionID ¶
func (m *Msg) ConnectionID() *ConnectionID
func (*Msg) ContactURNID ¶
func (*Msg) Direction ¶
func (m *Msg) Direction() MsgDirection
func (*Msg) ErrorCount ¶
func (*Msg) ExternalID ¶
func (*Msg) HighPriority ¶
func (*Msg) MarshalJSON ¶ added in v0.0.38
func (*Msg) ModifiedOn ¶
func (*Msg) NextAttempt ¶
func (*Msg) SetChannelID ¶ added in v0.0.77
func (*Msg) SetResponseTo ¶ added in v0.0.53
SetResponseTo set the incoming message that this session should be associated with in this sprint
func (*Msg) SetTimeout ¶ added in v0.0.68
SetTimeout sets the timeout for this message
func (*Msg) Visibility ¶
func (m *Msg) Visibility() MsgVisibility
type MsgDirection ¶
type MsgDirection string
type MsgID ¶
MsgID is our internal type for msg ids, which can be null/0
func (MsgID) MarshalJSON ¶ added in v0.0.86
MarshalJSON marshals into JSON. 0 values will become null
func (*MsgID) UnmarshalJSON ¶ added in v0.0.86
UnmarshalJSON unmarshals from JSON. null values become 0
type MsgLabelAdd ¶ added in v0.0.53
MsgLabelAdd represents a single label that should be added to a message
type MsgVisibility ¶
type MsgVisibility string
type OffsetUnit ¶ added in v0.0.17
type OffsetUnit string
OffsetUnit defines what time unit our offset is in
type Org ¶ added in v0.0.5
type Org struct {
// contains filtered or unexported fields
}
Org is mailroom's type for RapidPro orgs. It also implements the utils.Environment interface for GoFlow
func (*Org) AllowedLanguages ¶ added in v0.0.38
AllowedLanguages returns the list of supported languages for this org
func (*Org) ConfigValue ¶ added in v0.0.44
ConfigValue returns the string value for the passed in config (or default if not found)
func (*Org) DateFormat ¶ added in v0.0.5
func (o *Org) DateFormat() utils.DateFormat
DateFormat returns the date format for this org
func (*Org) DefaultCountry ¶ added in v0.0.49
DefaultCountry returns the default country for this organization (mostly used for number parsing)
func (*Org) DefaultLanguage ¶ added in v0.0.38
DefaultLanguage returns the primary language for this org
func (*Org) Equal ¶ added in v0.0.38
func (o *Org) Equal(env utils.Environment) bool
Equal return whether we are equal to the passed in environment
func (*Org) Extension ¶ added in v0.0.5
func (o *Org) Extension(name string) json.RawMessage
Extension returns the extension with the passed in name for this org
func (*Org) MarshalJSON ¶ added in v0.0.22
MarshalJSON is our custom marshaller so that our inner env get output
func (*Org) MaxValueLength ¶ added in v0.0.84
MaxValueLength returns our max value length for contact fields and run results
func (*Org) NumberFormat ¶ added in v0.0.38
func (o *Org) NumberFormat() *utils.NumberFormat
NumberFormat returns the date format for this org
func (*Org) RedactionPolicy ¶ added in v0.0.5
func (o *Org) RedactionPolicy() utils.RedactionPolicy
RedactionPolicy returns the redaction policy (are we anonymous) for this org
func (*Org) TimeFormat ¶ added in v0.0.5
func (o *Org) TimeFormat() utils.TimeFormat
TimeFormat returns the time format for this org
type OrgAssets ¶
type OrgAssets struct {
// contains filtered or unexported fields
}
OrgAssets is our top level cache of all things contained in an org. It is used to build SessionAssets for the engine but also used to cache campaigns and other org level attributes
func GetOrgAssets ¶ added in v0.0.5
GetOrgAssets creates or gets org assets for the passed in org
func NewOrgAssets ¶
func NewOrgAssets(ctx context.Context, db *sqlx.DB, orgID OrgID, prev *OrgAssets) (*OrgAssets, error)
NewOrgAssets creates and returns a new org assets objects, potentially using the previous org assets passed in to prevent refetching locations
func (*OrgAssets) AddTestChannel ¶ added in v0.0.85
AddTestChannel adds a test channel to our org, this is only used in session assets during simulation
func (*OrgAssets) CampaignByGroupID ¶ added in v0.0.17
func (*OrgAssets) CampaignEventByID ¶ added in v0.0.27
func (a *OrgAssets) CampaignEventByID(eventID CampaignEventID) *CampaignEvent
func (*OrgAssets) CampaignEventsByFieldID ¶ added in v0.0.17
func (a *OrgAssets) CampaignEventsByFieldID(fieldID FieldID) []*CampaignEvent
func (*OrgAssets) ChannelByID ¶ added in v0.0.5
func (*OrgAssets) ChannelByUUID ¶ added in v0.0.5
func (a *OrgAssets) ChannelByUUID(channelUUID assets.ChannelUUID) *Channel
func (*OrgAssets) Env ¶ added in v0.0.5
func (a *OrgAssets) Env() utils.Environment
func (*OrgAssets) FieldByKey ¶ added in v0.0.17
func (*OrgAssets) FieldByUUID ¶ added in v0.0.5
func (*OrgAssets) GroupByUUID ¶ added in v0.0.5
func (*OrgAssets) LabelByUUID ¶ added in v0.0.53
func (*OrgAssets) Locations ¶ added in v0.0.5
func (a *OrgAssets) Locations() ([]assets.LocationHierarchy, error)
func (*OrgAssets) ResthookBySlug ¶ added in v0.0.83
type OrgID ¶
type OrgID int
func OrgIDForChannelUUID ¶ added in v0.0.74
func OrgIDForChannelUUID(ctx context.Context, db *sqlx.DB, channelUUID assets.ChannelUUID) (OrgID, error)
OrgIDForChannelUUID returns the org id for the passed in channel UUID if any
type Queryer ¶ added in v0.0.38
type Queryer interface { Rebind(query string) string QueryxContext(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error) GetContext(ctx context.Context, value interface{}, query string, args ...interface{}) error }
type Resthook ¶ added in v0.0.5
type Resthook struct {
// contains filtered or unexported fields
}
Resthook is the mailroom type for resthooks
func (*Resthook) ID ¶ added in v0.0.5
func (r *Resthook) ID() ResthookID
ID returns the ID of this resthook
func (*Resthook) Subscribers ¶ added in v0.0.5
Subscribers returns the subscribers for this resthook
type ResthookID ¶ added in v0.0.5
type ResthookID int64
ResthookID is our type for the database id of a resthook
type ResthookUnsubscribe ¶ added in v0.0.38
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is the mailroom type for a FlowSession
func ActiveSessionForContact ¶ added in v0.0.38
func ActiveSessionForContact(ctx context.Context, db *sqlx.DB, org *OrgAssets, sessionType FlowType, contact *flows.Contact) (*Session, error)
ActiveSessionForContact returns the active session for the passed in contact, if any
func NewSession ¶ added in v0.0.17
NewSession a session objects from the passed in flow session. It does NOT commit said session to the database.
func WriteSessions ¶ added in v0.0.10
func WriteSessions(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, ss []flows.Session, sprints []flows.Sprint, hook SessionCommitHook) ([]*Session, error)
WriteSessions writes the passed in session to our database, writes any runs that need to be created as well as appying any events created in the session
func (*Session) AddPostCommitEvent ¶ added in v0.0.17
func (s *Session) AddPostCommitEvent(hook EventCommitHook, event interface{})
AddPostCommitEvent adds a new event to be handled by a post commit hook
func (*Session) AddPreCommitEvent ¶ added in v0.0.17
func (s *Session) AddPreCommitEvent(hook EventCommitHook, event interface{})
AddPreCommitEvent adds a new event to be handled by a pre commit hook
func (*Session) ChannelConnection ¶ added in v0.0.74
func (s *Session) ChannelConnection() *ChannelConnection
func (*Session) ConnectionID ¶ added in v0.0.74
func (s *Session) ConnectionID() *ConnectionID
func (*Session) ContactUUID ¶ added in v0.0.17
func (s *Session) ContactUUID() flows.ContactUUID
ContactUUID returns the UUID of our contact
func (*Session) CurrentFlowID ¶ added in v0.0.38
func (*Session) FlowSession ¶ added in v0.0.38
func (s *Session) FlowSession(sa flows.SessionAssets, env utils.Environment) (flows.Session, error)
FlowSession creates a flow session for the passed in session object. It also populates the runs we know about
func (*Session) IncomingMsgExternalID ¶ added in v0.0.77
func (*Session) IncomingMsgID ¶ added in v0.0.38
func (*Session) MarshalJSON ¶ added in v0.0.77
MarshalJSON is our custom marshaller so that our inner struct get output
func (*Session) SessionType ¶ added in v0.0.77
func (*Session) SetChannelConnection ¶ added in v0.0.74
func (s *Session) SetChannelConnection(cc *ChannelConnection)
SetChannelConnection sets the channel connection associated with this sprint
func (*Session) SetIncomingMsg ¶ added in v0.0.38
SetIncomingMsg set the incoming message that this session should be associated with in this sprint
func (*Session) Status ¶
func (s *Session) Status() SessionStatus
func (*Session) Timeout ¶ added in v0.0.68
Timeout returns the amount of time after our last message sends that we should timeout
func (*Session) UnmarshalJSON ¶ added in v0.0.77
UnmarshalJSON is our custom marshaller so that our inner struct get output
func (*Session) WaitStartedOn ¶ added in v0.0.68
func (*Session) WriteUpdatedSession ¶ added in v0.0.38
func (s *Session) WriteUpdatedSession(ctx context.Context, tx *sqlx.Tx, rp *redis.Pool, org *OrgAssets, fs flows.Session, sprint flows.Sprint, hook SessionCommitHook) error
WriteUpdatedSession updates the session based on the state passed in from our engine session, this also takes care of applying any event hooks
type SessionCommitHook ¶ added in v0.0.19
type SessionStatus ¶
type SessionStatus string
type StartID ¶ added in v0.0.27
StartID is our type for flow start idst
func (StartID) MarshalJSON ¶ added in v0.0.86
MarshalJSON marshals into JSON. 0 values will become null
func (*StartID) UnmarshalJSON ¶ added in v0.0.86
UnmarshalJSON unmarshals from JSON. null values become 0
type StartMode ¶ added in v0.0.42
type StartMode string
StartMode defines how a campaign event should be started
type Step ¶
type Step struct { UUID flows.StepUUID `json:"uuid"` NodeUUID flows.NodeUUID `json:"node_uuid"` ArrivedOn time.Time `json:"arrived_on"` ExitUUID flows.ExitUUID `json:"exit_uuid,omitempty"` }
Step represents a single step in a run, this struct is used for serialization to the steps
type Topup ¶ added in v0.0.10
type Topup struct { ID TopupID `db:"id"` Remaining int `db:"remaining"` Expiration time.Time `db:"expires_on"` }
Topup is our internal struct representing an org's topup and expiration date
type TopupID ¶ added in v0.0.10
TopupID is our type for topup ids, which can be null
func DecrementOrgCredits ¶ added in v0.0.17
func (TopupID) MarshalJSON ¶ added in v0.0.86
MarshalJSON marshals into JSON. 0 values will become null
func (*TopupID) UnmarshalJSON ¶ added in v0.0.86
UnmarshalJSON unmarshals from JSON. null values become 0
type Trigger ¶ added in v0.0.38
type Trigger struct {
// contains filtered or unexported fields
}
Trigger represents a trigger in an organization
func FindMatchingMOCallTrigger ¶ added in v0.0.74
FindMatchingMOCallTrigger finds any trigger set up for incoming calls (these would be IVR flows) Contact is needed as this trigger can be filtered by contact group
func FindMatchingMissedCallTrigger ¶ added in v0.0.74
FindMatchingMissedCallTrigger finds any trigger set up for incoming calls (these would be IVR flows)
func FindMatchingMsgTrigger ¶ added in v0.0.38
FindMatchingMsgTrigger returns the matching trigger (if any) for the passed in text and channel id TODO: with a different structure this could probably be a lot faster.. IE, we could have a map of list of triggers by keyword that is built when we load the triggers, then just evaluate against that.
func FindMatchingNewConversationTrigger ¶ added in v0.0.38
FindMatchingNewConversationTrigger returns the matching trigger for the passed in trigger type
func FindMatchingReferralTrigger ¶ added in v0.0.38
FindMatchingReferralTrigger returns the matching trigger for the passed in trigger type Matches are based on referrer_id first (if present), then channel, then any referrer trigger
func (*Trigger) KeywordMatchType ¶ added in v0.0.38
func (t *Trigger) KeywordMatchType() triggers.KeywordMatchType
func (*Trigger) Match ¶ added in v0.0.111
func (t *Trigger) Match() *triggers.KeywordMatch
Match returns the match for this trigger, if any
func (*Trigger) ReferrerID ¶ added in v0.0.38
func (*Trigger) TriggerType ¶ added in v0.0.38
func (t *Trigger) TriggerType() TriggerType
type TriggerType ¶ added in v0.0.38
type TriggerType string
type URNID ¶ added in v0.0.38
URNID is our type for urn ids, which can be null
func (URNID) MarshalJSON ¶ added in v0.0.86
MarshalJSON marshals into JSON. 0 values will become null
func (*URNID) UnmarshalJSON ¶ added in v0.0.86
UnmarshalJSON unmarshals from JSON. null values become 0
type WebhookEvent ¶ added in v0.0.84
type WebhookEvent struct {
// contains filtered or unexported fields
}
WebhookEvent represents an event that was created, mostly used for resthooks
func NewWebhookEvent ¶ added in v0.0.84
func NewWebhookEvent(orgID OrgID, resthookID ResthookID, data string, createdOn time.Time) *WebhookEvent
NewWebhookEvent creates a new webhook event
func (*WebhookEvent) ID ¶ added in v0.0.84
func (e *WebhookEvent) ID() WebhookEventID
type WebhookEventID ¶ added in v0.0.84
type WebhookEventID int64
type WebhookResult ¶ added in v0.0.76
type WebhookResult struct {
// contains filtered or unexported fields
}
WebhookResult represents a result of a webhook or resthook call
func NewWebhookResult ¶ added in v0.0.76
func NewWebhookResult( orgID OrgID, contactID ContactID, url string, request string, statusCode int, response string, elapsed time.Duration, createdOn time.Time) *WebhookResult
NewWebhookResult creates a new webhook result with the passed in parameters
func (*WebhookResult) ID ¶ added in v0.0.76
func (r *WebhookResult) ID() ResultID