Documentation
¶
Index ¶
- Constants
- Variables
- func ContactQueryEscaping(s string) string
- func Context(env envs.Environment, contextable Contextable) types.XValue
- func ContextFunc(env envs.Environment, fn func(envs.Environment) map[string]types.XValue) *types.XObject
- func ExtractJSON(body []byte) []byte
- func GroupReferences(groups []*Group) []*assets.GroupReference
- func LabelReferences(labels []*Label) []*assets.LabelReference
- func NewAssetsEnvironment(base envs.Environment, sa SessionAssets) envs.Environment
- func NewChildHistory(parent Session) *core.SessionHistory
- func NewNodeUUID() core.NodeUUID
- func NewSessionEnvironment(s Session) envs.Environment
- func TranslationsForContact(e envs.Environment, b core.BroadcastTranslations, c *Contact, ...) (*core.MsgContent, i18n.Locale)
- func ValidateURN(fl validator.FieldLevel) bool
- func ValidateURNScheme(fl validator.FieldLevel) bool
- type Action
- type ActionUUID
- type AirtimeService
- type Call
- type Campaign
- type CampaignAssets
- type Category
- type CategoryUUID
- type Channel
- func (c *Channel) Asset() assets.Channel
- func (c *Channel) Context(env envs.Environment) map[string]types.XValue
- func (c *Channel) HasFeature(feat assets.ChannelFeature) bool
- func (c *Channel) HasRole(role assets.ChannelRole) bool
- func (c *Channel) Reference() *assets.ChannelReference
- func (c *Channel) String() string
- func (c *Channel) SupportsScheme(scheme string) bool
- type ChannelAssets
- type CheckSendableCallback
- type ClaimURNCallback
- type Contact
- func NewContact(sa SessionAssets, uuid core.ContactUUID, id ContactID, name string, ...) (*Contact, error)
- func NewEmptyContact(sa SessionAssets, name string, language i18n.Language, timezone *time.Location) *Contact
- func ReadContact(sa SessionAssets, data []byte, missing assets.MissingCallback) (*Contact, error)
- func (c *Contact) AddRoute(urn urns.URN, channel *Channel) bool
- func (c *Contact) Clone() *Contact
- func (c *Contact) Context(env envs.Environment) map[string]types.XValue
- func (c *Contact) Country() i18n.Country
- func (c *Contact) CreatedOn() time.Time
- func (c *Contact) Fields() FieldValues
- func (c *Contact) Format(env envs.Environment) string
- func (c *Contact) Groups() *GroupList
- func (c *Contact) HasURN(urn urns.URN) bool
- func (c *Contact) ID() ContactID
- func (c *Contact) Language() i18n.Language
- func (c *Contact) LastSeenOn() *time.Time
- func (c *Contact) Locale(env envs.Environment) i18n.Locale
- func (c *Contact) Marshal() *ContactEnvelope
- func (c *Contact) MarshalJSON() ([]byte, error)
- func (c *Contact) Name() string
- func (c *Contact) PreferredChannel() *Channel
- func (c *Contact) PreferredURN() *URN
- func (c *Contact) QueryProperty(env envs.Environment, key string, propType contactql.PropertyType) []any
- func (c *Contact) ReevaluateQueryBasedGroups(env envs.Environment) ([]*Group, []*Group)
- func (c *Contact) Reference() *core.ContactReference
- func (c *Contact) RemoveURN(urn urns.URN) bool
- func (c *Contact) ResolveRoutes(all bool) []Route
- func (c *Contact) SetAffinity(urn urns.URN, ch *Channel) bool
- func (c *Contact) SetLanguage(lang i18n.Language)
- func (c *Contact) SetLastSeenOn(t time.Time)
- func (c *Contact) SetName(name string)
- func (c *Contact) SetRoutes(routes []Route) bool
- func (c *Contact) SetStatus(status core.ContactStatus)
- func (c *Contact) SetTimezone(tz *time.Location)
- func (c *Contact) Status() core.ContactStatus
- func (c *Contact) Tickets() *TicketList
- func (c *Contact) Timezone() *time.Location
- func (c *Contact) URNs() URNList
- func (c *Contact) UUID() core.ContactUUID
- func (c *Contact) UpdatePreferredChannel(channel *Channel) bool
- type ContactEnvelope
- type ContactID
- type Contextable
- type Dependency
- type EmailService
- type Engine
- type EngineOptions
- type Exit
- type ExitUUID
- type ExtractedReference
- type ExtractedResult
- type ExtractedTemplate
- type Field
- type FieldAssets
- func (s *FieldAssets) All() []*Field
- func (s *FieldAssets) FirstOfType(valueType assets.FieldType) *Field
- func (s *FieldAssets) Get(key string) *Field
- func (s *FieldAssets) ResolveField(key string) assets.Field
- func (s *FieldAssets) ResolveFlow(name string) assets.Flow
- func (s *FieldAssets) ResolveGroup(name string) assets.Group
- type FieldValue
- type FieldValues
- type Flow
- type FlowAssets
- type FlowType
- type FlowTypeRestricted
- type Global
- type GlobalAssets
- type Group
- type GroupAssets
- type GroupList
- func (l *GroupList) Add(group *Group) bool
- func (l *GroupList) All() []*Group
- func (l *GroupList) Clear()
- func (l *GroupList) Count() int
- func (l *GroupList) FindByUUID(uuid assets.GroupUUID) *Group
- func (l *GroupList) Remove(group *Group) bool
- func (l *GroupList) ToXValue(env envs.Environment) types.XValue
- type Info
- type Input
- type Issue
- type LLM
- type LLMAssets
- type LLMService
- type Label
- type LabelAssets
- type LegacyExtraContributor
- type Localizable
- type Localization
- type Locals
- func (l *Locals) Clear(key string)
- func (l *Locals) Context(env envs.Environment) map[string]types.XValue
- func (l *Locals) Get(key string) string
- func (l *Locals) IsZero() bool
- func (l *Locals) MarshalJSON() ([]byte, error)
- func (l *Locals) Set(key string, value string)
- func (l *Locals) UnmarshalJSON(data []byte) error
- type LocationAssets
- func (s *LocationAssets) FindLocations(env envs.Environment, name string, level envs.LocationLevel, ...) []*envs.Location
- func (s *LocationAssets) FindLocationsFuzzy(env envs.Environment, text string, level envs.LocationLevel, ...) []*envs.Location
- func (s *LocationAssets) LookupLocation(path envs.LocationPath) *envs.Location
- type Modifier
- type Node
- type OptIn
- type OptInAssets
- type Resthook
- type ResthookAssets
- type ResultInfo
- type ResultSpec
- type Results
- type Resume
- type Route
- type Router
- type Run
- type RunSummary
- type Segment
- type Services
- type Session
- type SessionAssets
- type SessionStatus
- type Sprint
- type SprintUUID
- type Step
- type StepUUID
- type Template
- type TemplateAssets
- type TemplateEnumerator
- type TemplateTranslation
- type Ticket
- func (t *Ticket) Assignee() *User
- func (t *Ticket) Context(env envs.Environment) map[string]types.XValue
- func (t *Ticket) Marshal() *core.TicketEnvelope
- func (t *Ticket) SetAssignee(user *User)
- func (t *Ticket) SetStatus(status core.TicketStatus)
- func (t *Ticket) SetTopic(topic *Topic)
- func (t *Ticket) Status() core.TicketStatus
- func (t *Ticket) Topic() *Topic
- func (t *Ticket) UUID() core.TicketUUID
- type TicketList
- func (l *TicketList) Add(t *Ticket)
- func (l *TicketList) All() []*Ticket
- func (l *TicketList) Count() int
- func (l *TicketList) Find(uuid core.TicketUUID) *Ticket
- func (l *TicketList) LastOpen() *Ticket
- func (l *TicketList) Marshal() []*core.TicketEnvelope
- func (l *TicketList) Open() *TicketList
- func (l *TicketList) ToXValue(env envs.Environment) types.XValue
- type Timeout
- type Topic
- type TopicAssets
- type Trigger
- type TriggerWithRun
- type URN
- type URNList
- type User
- type UserAssets
- type Wait
- type WebhookCall
- type WebhookService
Constants ¶
const ( MaxNodesPerFlow = 1000 // max number of nodes in a flow MaxActionsPerNode = 100 // max number of actions in a node MaxExitsPerNode = 100 // max number of exits in a node MaxCategoriesPerRouter = 100 // max number of categories a router can have MaxCasesPerRouter = 100 // max number of categories a switch router can have MaxArgumentsPerCase = 10 // max number of test arguments a switch router case can have )
const ( LocationLevelState = envs.LocationLevel(1) LocationLevelDistrict = envs.LocationLevel(2) LocationLevelWard = envs.LocationLevel(3) )
location levels which can be field types
const MaxContactURNs = 50
MaxContactURNs is maximum number of URNs a contact can have
Variables ¶
var RunContextTopLevels = []string{
"child",
"contact",
"fields",
"globals",
"input",
"legacy_extra",
"node",
"parent",
"locals",
"results",
"resume",
"run",
"ticket",
"trigger",
"urns",
"webhook",
}
RunContextTopLevels are the allowed top-level variables for expression evaluations
Functions ¶
func ContactQueryEscaping ¶ added in v0.55.0
ContactQueryEscaping is the escaping function used for expressions in contact queries
func Context ¶
func Context(env envs.Environment, contextable Contextable) types.XValue
Context generates a lazy object for use in expressions
func ContextFunc ¶ added in v0.33.8
func ContextFunc(env envs.Environment, fn func(envs.Environment) map[string]types.XValue) *types.XObject
ContextFunc generates a lazy object for use in expressions
func ExtractJSON ¶ added in v0.236.0
func GroupReferences ¶ added in v0.278.0
func GroupReferences(groups []*Group) []*assets.GroupReference
GroupReferences converts a slice of groups to a slice of references
func LabelReferences ¶ added in v0.278.0
func LabelReferences(labels []*Label) []*assets.LabelReference
LabelReferences converts a slice of labels to a slice of references
func NewAssetsEnvironment ¶ added in v0.190.1
func NewAssetsEnvironment(base envs.Environment, sa SessionAssets) envs.Environment
NewAssetsEnvironment creates a new environment that has access to assets which can be used for resolving locations.
func NewChildHistory ¶ added in v0.96.0
func NewChildHistory(parent Session) *core.SessionHistory
NewChildHistory creates a new history for a child of the given session
func NewNodeUUID ¶ added in v0.251.6
NewNodeUUID generates a new UUID for a node
func NewSessionEnvironment ¶ added in v0.190.1
func NewSessionEnvironment(s Session) envs.Environment
NewSessionEnvironment creates a new environment from a session's base environment that merges some properties with those from the contact.
func TranslationsForContact ¶ added in v0.278.0
func TranslationsForContact(e envs.Environment, b core.BroadcastTranslations, c *Contact, baseLanguage i18n.Language) (*core.MsgContent, i18n.Locale)
TranslationsForContact is a utility to help callers get the message content for a contact
func ValidateURN ¶ added in v0.4.0
func ValidateURN(fl validator.FieldLevel) bool
ValidateURN validates whether the field value is a valid URN
func ValidateURNScheme ¶ added in v0.4.0
func ValidateURNScheme(fl validator.FieldLevel) bool
ValidateURNScheme validates whether the field value is a valid URN scheme
Types ¶
type Action ¶
type Action interface {
utils.Typed
Localizable
FlowTypeRestricted
UUID() ActionUUID
Execute(context.Context, Run, Step, events.EventLogger) error
Validate() error
Inspect(func(assets.Reference), func(string), func(*ResultInfo))
}
Action is an action within a flow node
type ActionUUID ¶
ActionUUID is the UUID of an action
func NewActionUUID ¶ added in v0.251.6
func NewActionUUID() ActionUUID
NewActionUUID generates a new UUID for an action
type AirtimeService ¶ added in v0.48.0
type AirtimeService interface {
// Create initiates a new airtime transfer to the given URN. For providers with a two-step lifecycle,
// this submits the transaction in an unconfirmed state and returns its identifier in ExternalID; the
// host then calls Confirm to actually trigger the send. For providers that initiate immediately, this
// method does the send and Confirm is a no-op.
//
// transferUUID is pre-allocated by the caller and is the UUID that will be assigned to the resulting
// airtime_created event; implementations may pass it to the provider as their own reference (e.g.
// DT One's external_id field) so that subsequent provider callbacks can be correlated back to the
// event/transfer by the host without needing the provider's transaction id.
Create(ctx context.Context, transferUUID events.EventUUID, sender urns.URN, recipient urns.URN, amounts map[string]decimal.Decimal, logHTTP core.HTTPLogCallback) (*core.AirtimeTransfer, error)
// Confirm completes initiation of a transfer previously surfaced by Create. Hosts typically call
// Confirm after the session commits, so the airtime is only actually sent once the surrounding work
// is durably recorded. Implementations whose Create already triggers the send should make Confirm a
// no-op.
//
// The transfer argument is the value Create returned. Implementations are expected to use whichever
// fields they need (typically ExternalID) to address the provider transaction. Confirm should only be
// invoked for transfers that Create returned without error; hosts should not call Confirm on a
// partially-populated transfer left over from a failed Create.
//
// Confirm is not required to be idempotent — implementations may return an error on a duplicate
// confirmation. Hosts that need at-most-once delivery semantics should ensure Confirm is called at
// most once per transfer. On error, the airtime was not sent; hosts are responsible for surfacing
// that to their users.
Confirm(ctx context.Context, transfer *core.AirtimeTransfer, logHTTP core.HTTPLogCallback) error
}
AirtimeService provides airtime functionality to the engine
type Call ¶ added in v0.171.0
type Call struct {
// contains filtered or unexported fields
}
Call represents a call over a specific channel and URN
func ReadCall ¶ added in v0.278.0
func ReadCall(sa SessionAssets, e *core.CallEnvelope, missing assets.MissingCallback) *Call
ReadCall reads a call from the passed in envelope.
func (*Call) Marshal ¶ added in v0.247.8
func (c *Call) Marshal() *core.CallEnvelope
Marshal marshals a call into an envelope.
type Campaign ¶ added in v0.247.5
Campaign adds some functionality to campaign assets.
func NewCampaign ¶ added in v0.247.5
NewCampaign returns a new campaign object from the given campaign asset
func (*Campaign) Context ¶ added in v0.247.5
Context returns the properties available in expressions
uuid:text -> the UUID of the campaign name:text -> the name of the campaign
@context campaign
func (*Campaign) Reference ¶ added in v0.247.5
func (c *Campaign) Reference() *assets.CampaignReference
Reference returns a reference to this campaign
type CampaignAssets ¶ added in v0.247.5
type CampaignAssets struct {
// contains filtered or unexported fields
}
CampaignAssets provides access to all campaign assets
func NewCampaignAssets ¶ added in v0.247.5
func NewCampaignAssets(campaigns []assets.Campaign) *CampaignAssets
NewCampaignAssets creates a new set of campaign assets
func (*CampaignAssets) Get ¶ added in v0.247.5
func (s *CampaignAssets) Get(uuid assets.CampaignUUID) *Campaign
Get finds the campaign with the given UUID
type Category ¶ added in v0.79.0
type Category interface {
Localizable
UUID() CategoryUUID
Name() string
ExitUUID() ExitUUID
}
Category is how routers map results to exits
type CategoryUUID ¶ added in v0.30.2
CategoryUUID is the UUID of a node category
type Channel ¶
Channel represents a means for sending and receiving input during a flow run
func NewChannel ¶ added in v0.6.0
NewChannel creates a new channenl
func (*Channel) Context ¶ added in v0.33.8
Context returns the properties available in expressions
__default__:text -> the name uuid:text -> the UUID of the channel name:text -> the name of the channel address:text -> the address of the channel
@context channel
func (*Channel) HasFeature ¶ added in v0.195.0
func (c *Channel) HasFeature(feat assets.ChannelFeature) bool
HasFeature returns whether this channel has the given feature
func (*Channel) HasRole ¶ added in v0.6.0
func (c *Channel) HasRole(role assets.ChannelRole) bool
HasRole returns whether this channel has the given role
func (*Channel) Reference ¶ added in v0.5.0
func (c *Channel) Reference() *assets.ChannelReference
Reference returns a reference to this channel
func (*Channel) SupportsScheme ¶ added in v0.6.0
SupportsScheme returns whether this channel supports the given URN scheme
type ChannelAssets ¶ added in v0.15.0
type ChannelAssets struct {
// contains filtered or unexported fields
}
ChannelAssets provides access to all channel assets
func NewChannelAssets ¶ added in v0.15.0
func NewChannelAssets(channels []assets.Channel) *ChannelAssets
NewChannelAssets creates a new set of channel assets
func (*ChannelAssets) Get ¶ added in v0.15.0
func (s *ChannelAssets) Get(uuid assets.ChannelUUID) *Channel
Get returns the channel with the given UUID
func (*ChannelAssets) GetForURN ¶ added in v0.15.0
func (s *ChannelAssets) GetForURN(urn *URN, role assets.ChannelRole) *Channel
GetForURN returns the best channel for the given URN
type CheckSendableCallback ¶ added in v0.257.3
type CheckSendableCallback func(context.Context, SessionAssets, *Contact, *core.MsgContent) (core.UnsendableReason, error)
type ClaimURNCallback ¶ added in v0.263.0
type Contact ¶
type Contact struct {
// contains filtered or unexported fields
}
Contact represents a person who is interacting with the flow
func NewContact ¶ added in v0.5.1
func NewContact( sa SessionAssets, uuid core.ContactUUID, id ContactID, name string, language i18n.Language, status core.ContactStatus, timezone *time.Location, createdOn time.Time, lastSeenOn *time.Time, urns []urns.URN, groups []*assets.GroupReference, fields map[string]*core.Value, tickets []*Ticket, missing assets.MissingCallback) (*Contact, error)
NewContact creates a new contact with the passed in attributes
func NewEmptyContact ¶ added in v0.14.7
func NewEmptyContact(sa SessionAssets, name string, language i18n.Language, timezone *time.Location) *Contact
NewEmptyContact creates a new empy contact with the passed in name, language and location
func ReadContact ¶
func ReadContact(sa SessionAssets, data []byte, missing assets.MissingCallback) (*Contact, error)
ReadContact decodes a contact from the passed in JSON
func (*Contact) AddRoute ¶ added in v0.273.0
AddRoute adds a new URN to this contact with optional channel affinity. Returns whether the contact was changed. If the URN is already on the contact this is a no-op - to update channel affinity use SetAffinity or SetRoutes.
func (*Contact) Clone ¶ added in v0.4.0
Clone clones this contact when we need to snapshot as part of parent run summary.
func (*Contact) Context ¶ added in v0.33.8
Context returns the properties available in expressions
__default__:text -> the name or URN uuid:text -> the UUID of the contact ref:text -> the reference identifier of the contact first_name:text -> the first name of the contact name:text -> the name of the contact language:text -> the language of the contact as 3-letter ISO code status:text -> the status of the contact created_on:datetime -> the creation date of the contact last_seen_on:any -> the last seen date of the contact urns:[]text -> the URNs belonging to the contact urn:text -> the preferred URN of the contact groups:[]group -> the groups the contact belongs to fields:fields -> the custom field values of the contact channel:channel -> the preferred channel of the contact
@context contact
func (*Contact) Country ¶ added in v0.89.0
Country gets the country for this contact..
TODO: currently this is derived from their preferred channel or any tel URNs but probably should become an explicit field at some point
func (*Contact) Fields ¶
func (c *Contact) Fields() FieldValues
Fields returns this contact's field values
func (*Contact) Format ¶ added in v0.10.18
func (c *Contact) Format(env envs.Environment) string
Format returns a friendly string version of this contact depending on what fields are set
func (*Contact) LastSeenOn ¶ added in v0.100.0
LastSeenOn returns the last seen on time of this contact
func (*Contact) Locale ¶ added in v0.89.0
func (c *Contact) Locale(env envs.Environment) i18n.Locale
Locale gets the locale for this contact, using the environment country if contact doesn't have one
func (*Contact) Marshal ¶ added in v0.248.3
func (c *Contact) Marshal() *ContactEnvelope
func (*Contact) MarshalJSON ¶
MarshalJSON marshals this contact into JSON
func (*Contact) PreferredChannel ¶ added in v0.11.0
PreferredChannel gets the preferred channel for this contact, i.e. the channel we would use for sending
func (*Contact) PreferredURN ¶ added in v0.27.5
PreferredURN gets the preferred URN for this contact, i.e. the URN we would use for sending
func (*Contact) QueryProperty ¶ added in v0.45.1
func (c *Contact) QueryProperty(env envs.Environment, key string, propType contactql.PropertyType) []any
QueryProperty resolves a contact query search key for this contact
Note that this method excludes id, ref, group and flow search attributes as those are disallowed query based groups.
func (*Contact) ReevaluateQueryBasedGroups ¶ added in v0.103.0
func (c *Contact) ReevaluateQueryBasedGroups(env envs.Environment) ([]*Group, []*Group)
ReevaluateQueryBasedGroups reevaluates membership of all query based groups for this contact
func (*Contact) Reference ¶ added in v0.4.0
func (c *Contact) Reference() *core.ContactReference
Reference returns a reference to this contact
func (*Contact) ResolveRoutes ¶ added in v0.273.0
ResolveRoutes resolves possible URN/channel routes for sending
func (*Contact) SetAffinity ¶ added in v0.266.0
SetAffinity sets the preferred URN/channel for this contact by moving it to the front of the list and returns whether any change was made. If the URN is not already associated with the contact then this is a no-op and returns false.
func (*Contact) SetLanguage ¶
SetLanguage sets the language for this contact
func (*Contact) SetLastSeenOn ¶ added in v0.100.0
SetLastSeenOn sets the last seen on time of this contact
func (*Contact) SetRoutes ¶ added in v0.273.0
SetRoutes replaces this contact's URNs with the given routes, each carrying optional channel affinity.
func (*Contact) SetStatus ¶ added in v0.84.0
func (c *Contact) SetStatus(status core.ContactStatus)
SetStatus sets the status of this contact (blocked, stopped or active)
func (*Contact) SetTimezone ¶
SetTimezone sets the timezone of this contact
func (*Contact) Status ¶ added in v0.84.0
func (c *Contact) Status() core.ContactStatus
Status returns the contact status
func (*Contact) Tickets ¶ added in v0.118.0
func (c *Contact) Tickets() *TicketList
Tickets returns the tickets for this contact
func (*Contact) UUID ¶
func (c *Contact) UUID() core.ContactUUID
UUID returns the UUID of this contact
func (*Contact) UpdatePreferredChannel ¶ added in v0.6.0
UpdatePreferredChannel updates the preferred channel and returns whether any change was made
type ContactEnvelope ¶ added in v0.248.3
type ContactEnvelope struct {
UUID core.ContactUUID `json:"uuid" validate:"required,uuid"`
ID ContactID `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Language i18n.Language `json:"language,omitempty"`
Status core.ContactStatus `json:"status,omitempty" validate:"required,contact_status"`
Timezone string `json:"timezone,omitempty"`
CreatedOn time.Time `json:"created_on" validate:"required"`
LastSeenOn *time.Time `json:"last_seen_on,omitempty"`
URNs []urns.URN `json:"urns,omitempty" validate:"dive,urn"`
Groups []*assets.GroupReference `json:"groups,omitempty" validate:"dive"`
Fields map[string]*core.Value `json:"fields,omitempty"`
Tickets []*core.TicketEnvelope `json:"tickets,omitempty"`
}
func (*ContactEnvelope) Unmarshal ¶ added in v0.248.3
func (e *ContactEnvelope) Unmarshal(sa SessionAssets, missing assets.MissingCallback) (*Contact, error)
type Contextable ¶ added in v0.33.8
type Contextable interface {
Context(env envs.Environment) map[string]types.XValue
}
Contextable is an object that can accessed in expressions as a object with properties
type Dependency ¶ added in v0.68.0
type EmailService ¶ added in v0.61.0
EmailService provides email functionality to the engine
type Engine ¶ added in v0.27.4
type Engine interface {
NewSession(context.Context, SessionAssets, envs.Environment, *Contact, Trigger, *Call) (Session, Sprint, error)
ReadSession(SessionAssets, []byte, envs.Environment, *Contact, *Call, assets.MissingCallback) (Session, error)
Evaluator() *excellent.Evaluator
Services() Services
Options() *EngineOptions
}
Engine provides callers with session starting and resuming
type EngineOptions ¶ added in v0.190.0
type EngineOptions struct {
MaxStepsPerSprint int
MaxSprintsPerSession int
MaxTemplateChars int
MaxFieldChars int
MaxResultChars int
LLMPrompts map[string]*template.Template
CheckSendable CheckSendableCallback
ClaimURN ClaimURNCallback
}
type ExtractedReference ¶ added in v0.71.2
type ExtractedReference struct {
Reference assets.Reference
// contains filtered or unexported fields
}
ExtractedReference is a reference and its location in a flow
func NewExtractedReference ¶ added in v0.74.0
func NewExtractedReference(n Node, a Action, r Router, l i18n.Language, ref assets.Reference) ExtractedReference
NewExtractedReference creates a new extracted reference
type ExtractedResult ¶ added in v0.71.3
type ExtractedResult struct {
Node Node
Action Action
Router Router
Info *ResultInfo
}
type ExtractedTemplate ¶ added in v0.74.0
type ExtractedTemplate struct {
Template string
// contains filtered or unexported fields
}
ExtractedTemplate is a template and its location in a flow
func NewExtractedTemplate ¶ added in v0.74.0
NewExtractedTemplate creates a new extracted template
type Field ¶
Field represents a contact field
func (*Field) Reference ¶ added in v0.24.0
func (f *Field) Reference() *assets.FieldReference
Reference returns a reference to this field
type FieldAssets ¶ added in v0.15.0
type FieldAssets struct {
// contains filtered or unexported fields
}
FieldAssets provides access to all field assets
func NewFieldAssets ¶ added in v0.15.0
func NewFieldAssets(fields []assets.Field) *FieldAssets
NewFieldAssets creates a new set of field assets
func (*FieldAssets) All ¶ added in v0.15.0
func (s *FieldAssets) All() []*Field
All returns all the fields in this set
func (*FieldAssets) FirstOfType ¶ added in v0.15.0
func (s *FieldAssets) FirstOfType(valueType assets.FieldType) *Field
FirstOfType returns the first field in this set with the given value type
func (*FieldAssets) Get ¶ added in v0.15.0
func (s *FieldAssets) Get(key string) *Field
Get returns the contact field with the given key
func (*FieldAssets) ResolveField ¶ added in v0.78.0
func (s *FieldAssets) ResolveField(key string) assets.Field
func (*FieldAssets) ResolveFlow ¶ added in v0.151.0
func (s *FieldAssets) ResolveFlow(name string) assets.Flow
func (*FieldAssets) ResolveGroup ¶ added in v0.78.0
func (s *FieldAssets) ResolveGroup(name string) assets.Group
type FieldValue ¶ added in v0.4.0
FieldValue represents a field and a set of values for that field
func NewFieldValue ¶ added in v0.4.0
func NewFieldValue(field *Field, value *core.Value) *FieldValue
NewFieldValue creates a new field value
func (*FieldValue) QueryValue ¶ added in v0.32.0
func (v *FieldValue) QueryValue() any
QueryValue returns the value for use in contact queries
func (*FieldValue) ToXValue ¶ added in v0.32.0
func (v *FieldValue) ToXValue(env envs.Environment) types.XValue
ToXValue returns a representation of this object for use in expressions
type FieldValues ¶ added in v0.4.0
type FieldValues map[string]*FieldValue
FieldValues is the set of all field values for a contact
func NewFieldValues ¶ added in v0.15.2
func NewFieldValues(a SessionAssets, values map[string]*core.Value, missing assets.MissingCallback) FieldValues
NewFieldValues creates a new field value map
func (FieldValues) Context ¶ added in v0.30.4
func (f FieldValues) Context(env envs.Environment) map[string]types.XValue
Context returns the properties available in expressions
func (FieldValues) Get ¶ added in v0.19.2
func (f FieldValues) Get(field *Field) *core.Value
Get gets the value set for the given field
func (FieldValues) Parse ¶ added in v0.24.0
func (f FieldValues) Parse(env envs.Environment, fields *FieldAssets, field *Field, rawValue string) *core.Value
Parse parses a raw string field value into the different possible types
type Flow ¶
type Flow interface {
Contextable
// spec properties
UUID() assets.FlowUUID
Name() string
Revision() int
Language() i18n.Language
Type() FlowType
ExpireAfter() time.Duration
Localization() Localization
UI() json.RawMessage
Nodes() []Node
GetNode(uuid core.NodeUUID) Node
Asset() assets.Flow
Reference(bool) *assets.FlowReference
Inspect(sa SessionAssets) *Info
ExtractTemplates() []string
ExtractLocalizables() []string
ChangeLanguage(i18n.Language) (Flow, error)
}
Flow describes the ordered logic of actions and routers
type FlowAssets ¶ added in v0.15.0
FlowAssets provides access to flow assets
type FlowType ¶ added in v0.14.0
type FlowType string
FlowType represents the different types of flows
const ( // FlowTypeMessaging is a flow that is run over a messaging channel FlowTypeMessaging FlowType = "messaging" // FlowTypeMessagingBackground is a non-interactive messaging flow (i.e. never waits for input) FlowTypeMessagingBackground FlowType = "messaging_background" // FlowTypeMessagingOffline is a flow which is run over an offline messaging client like Surveyor FlowTypeMessagingOffline FlowType = "messaging_offline" // FlowTypeVoice is a flow which is run over IVR FlowTypeVoice FlowType = "voice" )
func (FlowType) Allows ¶ added in v0.107.0
func (t FlowType) Allows(r FlowTypeRestricted) bool
Allows returns whether this flow type allows the given item
type FlowTypeRestricted ¶ added in v0.107.0
type FlowTypeRestricted interface {
AllowedFlowTypes() []FlowType
}
FlowTypeRestricted is a part of a flow which can be restricted to certain flow types
type Global ¶ added in v0.57.0
Global represents a constant value available in expressions.
func (*Global) Reference ¶ added in v0.57.0
func (g *Global) Reference() *assets.GlobalReference
Reference returns a reference to this global
type GlobalAssets ¶ added in v0.57.0
type GlobalAssets struct {
// contains filtered or unexported fields
}
GlobalAssets provides access to all global assets
func NewGlobalAssets ¶ added in v0.57.0
func NewGlobalAssets(globals []assets.Global) *GlobalAssets
NewGlobalAssets creates a new set of global assets
func (*GlobalAssets) Context ¶ added in v0.57.0
func (s *GlobalAssets) Context(env envs.Environment) map[string]types.XValue
Context returns the properties available in expressions
func (*GlobalAssets) Get ¶ added in v0.57.0
func (s *GlobalAssets) Get(key string) *Global
Get returns the global with the given key
type Group ¶
Group adds some functionality to group assets.
func NewGroup ¶
func NewGroup(env envs.Environment, fields *FieldAssets, asset assets.Group) (*Group, error)
NewGroup returns a new group object from the given group asset
func (*Group) CheckQueryBasedMembership ¶ added in v0.103.0
func (g *Group) CheckQueryBasedMembership(env envs.Environment, contact *Contact) bool
CheckQueryBasedMembership returns whether the given contact belongs in a query based group
func (*Group) Reference ¶ added in v0.4.0
func (g *Group) Reference() *assets.GroupReference
Reference returns a reference to this group
type GroupAssets ¶ added in v0.15.0
type GroupAssets struct {
// contains filtered or unexported fields
}
GroupAssets provides access to all group assets
func NewGroupAssets ¶ added in v0.15.0
func NewGroupAssets(env envs.Environment, fields *FieldAssets, groups []assets.Group) (*GroupAssets, []assets.Group)
NewGroupAssets creates a new set of group assets
func (*GroupAssets) All ¶ added in v0.15.0
func (s *GroupAssets) All() []*Group
All returns all the groups
func (*GroupAssets) FindByName ¶ added in v0.15.0
func (s *GroupAssets) FindByName(name string) *Group
FindByName looks for a group with the given name (case-insensitive)
type GroupList ¶
type GroupList struct {
// contains filtered or unexported fields
}
GroupList defines a contact's list of groups
func NewGroupList ¶ added in v0.4.0
func NewGroupList(a SessionAssets, refs []*assets.GroupReference, missing assets.MissingCallback) *GroupList
NewGroupList creates a new group list
func (*GroupList) Clear ¶ added in v0.150.1
func (l *GroupList) Clear()
Clear clears this group list
func (*GroupList) FindByUUID ¶ added in v0.4.0
FindByUUID returns the group with the passed in UUID or nil if not found
type Info ¶ added in v0.240.2
type Info struct {
Counts map[string]int `json:"counts"`
Dependencies []Dependency `json:"dependencies"`
Locals []string `json:"locals"`
Results []*ResultSpec `json:"results"`
ParentRefs []string `json:"parent_refs"`
Issues []Issue `json:"issues"`
}
Info contains the results of flow inspection
type Input ¶
type Input interface {
utils.Typed
Contextable
UUID() core.InputUUID
CreatedOn() time.Time
Channel() *Channel
}
Input describes input from the contact and currently we only support one type of input: `msg`
type Issue ¶ added in v0.72.0
type Issue interface {
utils.Typed
NodeUUID() core.NodeUUID
ActionUUID() ActionUUID
Language() i18n.Language
Description() string
}
Issue is a problem found during flow inspection
type LLM ¶ added in v0.232.0
LLM represents a large language model.
func (*LLM) Reference ¶ added in v0.232.0
func (l *LLM) Reference() *assets.LLMReference
Reference returns a reference to this LLM
type LLMAssets ¶ added in v0.232.0
type LLMAssets struct {
// contains filtered or unexported fields
}
LLMAssets provides access to all LLM assets
func NewLLMAssets ¶ added in v0.232.0
NewLLMAssets creates a new set of LLM assets
type LLMService ¶ added in v0.232.1
type LLMService interface {
Response(ctx context.Context, instructions, input string, maxTokens int) (*core.LLMResponse, error)
}
LLMService provides LLM functionality to the engine
type Label ¶
Label represents a message label
func (*Label) Reference ¶ added in v0.4.0
func (l *Label) Reference() *assets.LabelReference
Reference returns a reference to this label
type LabelAssets ¶ added in v0.15.0
type LabelAssets struct {
// contains filtered or unexported fields
}
LabelAssets provides access to all label assets
func NewLabelAssets ¶ added in v0.15.0
func NewLabelAssets(labels []assets.Label) *LabelAssets
NewLabelAssets creates a new set of label assets
func (*LabelAssets) All ¶ added in v0.15.0
func (s *LabelAssets) All() []*Label
All returns all the labels
func (*LabelAssets) FindByName ¶ added in v0.15.0
func (s *LabelAssets) FindByName(name string) *Label
FindByName looks for a label with the given name (case-insensitive)
type LegacyExtraContributor ¶ added in v0.21.3
type LegacyExtraContributor interface {
LegacyExtra() Results
}
LegacyExtraContributor is something which contributes results for constructing @legacy_extra
type Localizable ¶ added in v0.29.0
Localizable is anything in the flow definition which can be localized and therefore needs a UUID
type Localization ¶ added in v0.6.2
type Localization interface {
Validate() error
GetItemTranslation(i18n.Language, uuids.UUID, string) []string
SetItemTranslation(i18n.Language, uuids.UUID, string, []string)
Languages() []i18n.Language
}
Localization provide a way to get the translations for a specific language
type Locals ¶ added in v0.235.0
type Locals struct {
// contains filtered or unexported fields
}
Locals is a map of local variables for a run
func NewLocals ¶ added in v0.235.0
func NewLocals() *Locals
NewLocals creates a new empty locals instance
func (*Locals) MarshalJSON ¶ added in v0.235.0
func (*Locals) UnmarshalJSON ¶ added in v0.235.0
type LocationAssets ¶ added in v0.15.0
type LocationAssets struct {
// contains filtered or unexported fields
}
LocationAssets provides access to location assets and implements envs.LocationResolver
func NewLocationAssets ¶ added in v0.15.0
func NewLocationAssets(hierarchies []assets.LocationHierarchy) *LocationAssets
NewLocationAssets creates a new set of location assets
func (*LocationAssets) FindLocations ¶ added in v0.235.0
func (s *LocationAssets) FindLocations(env envs.Environment, name string, level envs.LocationLevel, parent *envs.Location) []*envs.Location
FindLocations returns locations with the matching name (case-insensitive), level and parent (optional)
func (*LocationAssets) FindLocationsFuzzy ¶ added in v0.235.0
func (s *LocationAssets) FindLocationsFuzzy(env envs.Environment, text string, level envs.LocationLevel, parent *envs.Location) []*envs.Location
FindLocationsFuzzy returns matching locations like FindLocations but attempts the following strategies to find locations:
- Exact match
- Match with punctuation removed
- Split input into words and try to match each word
- Try to match pairs of words
func (*LocationAssets) LookupLocation ¶ added in v0.235.0
func (s *LocationAssets) LookupLocation(path envs.LocationPath) *envs.Location
type Modifier ¶ added in v0.24.0
type Modifier interface {
utils.Typed
Apply(context.Context, Engine, envs.Environment, SessionAssets, *Contact, events.EventLogger) (bool, error)
}
Modifier is something which can modify a contact
type Node ¶
type Node interface {
UUID() core.NodeUUID
Actions() []Action
Router() Router
Exits() []Exit
Validate(Flow, map[uuids.UUID]bool) error
Inspect(func(Action, Router, assets.Reference), func(Action, Router, string), func(Action, Router, *ResultInfo))
EnumerateTemplates(Localization, func(Action, Router, i18n.Language, string))
EnumerateLocalizables(func(uuids.UUID, string, []string, func([]string)))
}
Node is a single node in a flow
type OptIn ¶ added in v0.195.0
OptIn adds some functionality to optin assets.
func (*OptIn) Context ¶ added in v0.195.0
Context returns the properties available in expressions
uuid:text -> the UUID of the optin name:text -> the name of the optin
@context optin
func (*OptIn) Reference ¶ added in v0.195.0
func (o *OptIn) Reference() *assets.OptInReference
Reference returns a reference to this optin
type OptInAssets ¶ added in v0.195.0
type OptInAssets struct {
// contains filtered or unexported fields
}
OptInAssets provides access to all optin assets
func NewOptInAssets ¶ added in v0.195.0
func NewOptInAssets(optins []assets.OptIn) *OptInAssets
NewOptInAssets creates a new set of optin assets
type Resthook ¶ added in v0.10.20
Resthook represents a named event and a set of subscribers
func NewResthook ¶ added in v0.10.20
NewResthook returns a new resthook object
type ResthookAssets ¶ added in v0.15.0
type ResthookAssets struct {
// contains filtered or unexported fields
}
ResthookAssets provides access to all resthook assets
func NewResthookAssets ¶ added in v0.15.0
func NewResthookAssets(resthooks []assets.Resthook) *ResthookAssets
NewResthookAssets creates a new set of resthook assets
func (*ResthookAssets) FindBySlug ¶ added in v0.15.0
func (s *ResthookAssets) FindBySlug(slug string) *Resthook
FindBySlug finds the group with the given UUID
type ResultInfo ¶ added in v0.40.0
type ResultInfo struct {
Key string `json:"key"`
Name string `json:"name"`
Categories []string `json:"categories"`
}
ResultInfo is possible result that a flow might generate
func NewResultInfo ¶ added in v0.40.0
func NewResultInfo(name string, categories []string) *ResultInfo
NewResultInfo creates a new result spec
func (*ResultInfo) String ¶ added in v0.40.0
func (r *ResultInfo) String() string
type ResultSpec ¶ added in v0.30.2
type ResultSpec struct {
ResultInfo
NodeUUIDs []string `json:"node_uuids"`
}
func NewResultSpecs ¶ added in v0.71.3
func NewResultSpecs(results []ExtractedResult) []*ResultSpec
NewResultSpecs merges extracted results based on key
type Results ¶
Results is our wrapper around a map of snakified result names to result objects
func (Results) Save ¶
Save saves a new result in our map using the snakified name as the key. Returns the old result if it existed.
func (*Results) UnmarshalJSON ¶
type Resume ¶ added in v0.20.0
type Resume interface {
utils.Typed
Contextable
Event() events.Event
ResumedOn() time.Time
Input(SessionAssets) Input
}
Resume represents something which can resume a session with the flow engine
type Router ¶
type Router interface {
utils.Typed
Wait() Wait
Categories() []Category
ResultName() string
AllowTimeout() bool
Route(Run, Step, events.EventLogger) (ExitUUID, string, error)
RouteTimeout(Run, Step, events.EventLogger) (ExitUUID, error)
Validate(Flow, []Exit) error
Inspect(func(*ResultInfo), func(assets.Reference))
EnumerateTemplates(Localization, func(i18n.Language, string))
EnumerateLocalizables(func(uuids.UUID, string, []string, func([]string)))
}
Router is a router on a note which can pick an exit
type Run ¶ added in v0.146.0
type Run interface {
Contextable
RunSummary
FlowReference() *assets.FlowReference
Session() Session
Locals() *Locals
SetResult(*core.Result) (*core.Result, bool)
Webhook() *WebhookCall
SetWebhook(*WebhookCall)
CreateStep(Node) Step
Path() []Step
PathLocation() (Step, Node, error)
HadInput() bool
EvaluateTemplateValue(string, events.EventLogger) (types.XValue, bool)
EvaluateTemplateText(string, excellent.Escaping, bool, events.EventLogger) (string, bool)
EvaluateTemplate(string, events.EventLogger) (string, bool)
RootContext(envs.Environment) map[string]types.XValue
GetText(uuids.UUID, string, string) (string, i18n.Language)
GetTextArray(uuids.UUID, string, []string, []i18n.Language) ([]string, i18n.Language)
Snapshot() RunSummary
Parent() RunSummary
Ancestors() []Run
CreatedOn() time.Time
ModifiedOn() time.Time
ExitedOn() *time.Time
Exit(core.RunStatus)
}
Run is a single contact's journey through a flow. It records the path they have taken, and the results that have been collected.
type RunSummary ¶ added in v0.4.0
type RunSummary interface {
UUID() core.RunUUID
Contact() *Contact
Flow() Flow
Status() core.RunStatus
Results() Results
}
RunSummary represents the minimum information available about all runs (current or related) and is the representation of runs made accessible to router tests.
type Segment ¶ added in v0.142.0
type Segment interface {
Flow() Flow
Node() Node
Exit() Exit
Operand() string
Destination() Node
Time() time.Time
}
Segment is a movement on the flow graph from an exit to another node
type Services ¶ added in v0.48.0
type Services interface {
Email(SessionAssets) (EmailService, error)
Webhook(SessionAssets) (WebhookService, error)
LLM(*LLM) (LLMService, error)
Airtime(SessionAssets) (AirtimeService, error)
}
Services groups together interfaces for several services whose implementation is provided outside of the flow engine.
type Session ¶
type Session interface {
Assets() SessionAssets
UUID() core.SessionUUID
Type() FlowType
CreatedOn() time.Time
Environment() envs.Environment
MergedEnvironment() envs.Environment
Contact() *Contact
Call() *Call
Input() Input
Sprints() int
Status() SessionStatus
Trigger() Trigger
CurrentResume() Resume
BatchStart() bool
PushFlow(Flow, Run, bool)
Resume(context.Context, Resume) (Sprint, error)
Runs() []Run
ParentRun() RunSummary
CurrentContext() *types.XObject
History() *core.SessionHistory
Engine() Engine
}
Session represents the session of a flow run which may contain many runs
type SessionAssets ¶ added in v0.4.0
type SessionAssets interface {
contactql.Resolver
Source() assets.Source
Campaigns() *CampaignAssets
Channels() *ChannelAssets
Fields() *FieldAssets
Flows() FlowAssets
Globals() *GlobalAssets
Groups() *GroupAssets
Labels() *LabelAssets
LLMs() *LLMAssets
Locations() *LocationAssets
OptIns() *OptInAssets
Resthooks() *ResthookAssets
Templates() *TemplateAssets
Topics() *TopicAssets
Users() *UserAssets
}
SessionAssets is the assets available to a session
type SessionStatus ¶ added in v0.4.0
type SessionStatus string
SessionStatus represents the current status of the engine session
const ( // SessionStatusActive represents a session that is still active SessionStatusActive SessionStatus = "active" // SessionStatusCompleted represents a session that has run to completion SessionStatusCompleted SessionStatus = "completed" // SessionStatusWaiting represents a session which is waiting for something from the caller SessionStatusWaiting SessionStatus = "waiting" // SessionStatusFailed represents a session that encountered an unrecoverable error SessionStatusFailed SessionStatus = "failed" // SessionStatusExpired is never used by the engine but callers may put sessions into this state SessionStatusExpired SessionStatus = "expired" // SessionStatusInterrupted is never used by the engine but callers may put sessions into this state SessionStatusInterrupted SessionStatus = "interrupted" )
type Sprint ¶ added in v0.24.0
type Sprint interface {
UUID() SprintUUID
IsInitial() bool
Events() []events.Event
Segments() []Segment
Flows() []Flow
}
Sprint is an interaction with the engine - i.e. a start or resume of a session
type Step ¶
type Step interface {
Contextable
UUID() StepUUID
NodeUUID() core.NodeUUID
ExitUUID() ExitUUID
ArrivedOn() time.Time
Leave(ExitUUID)
Run() Run
}
Step is a single step in the path thru a flow
type Template ¶ added in v0.32.0
Template represents messaging templates used by channels types such as WhatsApp
func NewTemplate ¶ added in v0.32.0
NewTemplate returns a new template objects based on the passed in asset
func (*Template) FindTranslation ¶ added in v0.32.0
func (t *Template) FindTranslation(channel *Channel, locales []i18n.Locale) *TemplateTranslation
FindTranslation finds the matching translation for the passed in channel and languages (in priority order)
func (*Template) Reference ¶ added in v0.38.1
func (t *Template) Reference() *assets.TemplateReference
Reference returns the reference for this template
func (*Template) Templating ¶ added in v0.218.2
func (t *Template) Templating(tt *TemplateTranslation, vars []string) *core.MsgTemplating
Templating generates a templating object for the passed in translation and variables
type TemplateAssets ¶ added in v0.32.0
type TemplateAssets struct {
// contains filtered or unexported fields
}
TemplateAssets is our type for all the templates in an environment
func NewTemplateAssets ¶ added in v0.32.0
func NewTemplateAssets(ts []assets.Template) *TemplateAssets
NewTemplateAssets creates a new template list
func (*TemplateAssets) Get ¶ added in v0.38.1
func (a *TemplateAssets) Get(uuid assets.TemplateUUID) *Template
Get returns the template with the passed in UUID if any
type TemplateEnumerator ¶ added in v0.200.1
type TemplateEnumerator interface {
EnumerateTemplates(Localization, func(i18n.Language, string))
}
type TemplateTranslation ¶ added in v0.32.0
type TemplateTranslation struct {
assets.TemplateTranslation
}
TemplateTranslation represents a single translation for a template
func NewTemplateTranslation ¶ added in v0.32.0
func NewTemplateTranslation(t assets.TemplateTranslation) *TemplateTranslation
NewTemplateTranslation returns a new TemplateTranslation for the passed in asset
func (*TemplateTranslation) Asset ¶ added in v0.32.0
func (t *TemplateTranslation) Asset() assets.TemplateTranslation
Asset returns the underlying asset
func (*TemplateTranslation) Preview ¶ added in v0.201.0
func (t *TemplateTranslation) Preview(vars []*core.TemplatingVariable) *core.MsgContent
Preview returns message content which will act as a preview of a message sent with this template
type Ticket ¶ added in v0.86.0
type Ticket struct {
// contains filtered or unexported fields
}
Ticket is a ticket in a ticketing system
func NewTicket ¶ added in v0.86.0
func NewTicket(uuid core.TicketUUID, status core.TicketStatus, topic *Topic, assignee *User) *Ticket
NewTicket creates a new ticket
func OpenTicket ¶ added in v0.122.0
OpenTicket creates a new ticket. Used by ticketing services to open a new ticket.
func ReadTicket ¶ added in v0.122.0
func ReadTicket(sa SessionAssets, e *core.TicketEnvelope, missing assets.MissingCallback) *Ticket
ReadTicket reads a ticket from the passed in envelope. If the topic or assigned user can't be found in the assets, we report the missing asset and return ticket without those.
func (*Ticket) Context ¶ added in v0.118.2
Context returns the properties available in expressions
uuid:text -> the UUID of the ticket topic:any -> the topic of the ticket assignee:any -> the assignee of the ticket
@context ticket
func (*Ticket) Marshal ¶ added in v0.247.3
func (t *Ticket) Marshal() *core.TicketEnvelope
Marshal marshals a ticket into an envelope.
func (*Ticket) SetAssignee ¶ added in v0.256.0
func (*Ticket) SetStatus ¶ added in v0.256.0
func (t *Ticket) SetStatus(status core.TicketStatus)
func (*Ticket) Status ¶ added in v0.256.0
func (t *Ticket) Status() core.TicketStatus
func (*Ticket) UUID ¶ added in v0.86.0
func (t *Ticket) UUID() core.TicketUUID
type TicketList ¶ added in v0.118.0
type TicketList struct {
// contains filtered or unexported fields
}
func NewTicketList ¶ added in v0.118.0
func NewTicketList(tickets []*Ticket) *TicketList
func (*TicketList) Add ¶ added in v0.118.0
func (l *TicketList) Add(t *Ticket)
func (*TicketList) All ¶ added in v0.118.0
func (l *TicketList) All() []*Ticket
func (*TicketList) Count ¶ added in v0.118.0
func (l *TicketList) Count() int
func (*TicketList) Find ¶ added in v0.256.8
func (l *TicketList) Find(uuid core.TicketUUID) *Ticket
func (*TicketList) LastOpen ¶ added in v0.256.3
func (l *TicketList) LastOpen() *Ticket
func (*TicketList) Marshal ¶ added in v0.256.3
func (l *TicketList) Marshal() []*core.TicketEnvelope
func (*TicketList) Open ¶ added in v0.256.6
func (l *TicketList) Open() *TicketList
func (*TicketList) ToXValue ¶ added in v0.118.0
func (l *TicketList) ToXValue(env envs.Environment) types.XValue
ToXValue returns a representation of this object for use in expressions
type Timeout ¶ added in v0.33.0
type Timeout interface {
Seconds() int
CategoryUUID() CategoryUUID
}
Timeout is a way to skip a wait after X amount of time
type Topic ¶ added in v0.132.0
Topic represents a ticket topic
func (*Topic) Context ¶ added in v0.133.0
Context returns the properties available in expressions
__default__:text -> the name uuid:text -> the UUID of the topic name:text -> the name of the topic
@context topic
func (*Topic) Reference ¶ added in v0.132.0
func (t *Topic) Reference() *assets.TopicReference
Reference returns a reference to this topic
type TopicAssets ¶ added in v0.132.0
type TopicAssets struct {
// contains filtered or unexported fields
}
TopicAssets provides access to all topic assets
func NewTopicAssets ¶ added in v0.132.0
func NewTopicAssets(topics []assets.Topic) *TopicAssets
NewTopicAssets creates a new set of topic assets
func (*TopicAssets) FindByName ¶ added in v0.133.0
func (s *TopicAssets) FindByName(name string) *Topic
FindByName looks for a topic with the given name (case-insensitive)
type Trigger ¶ added in v0.4.0
type Trigger interface {
utils.Typed
Contextable
Event() events.Event
Flow() *assets.FlowReference
Batch() bool
Params() *types.XObject
History() *core.SessionHistory
TriggeredOn() time.Time
Input(SessionAssets) Input
}
Trigger represents something which can initiate a session with the flow engine
type TriggerWithRun ¶ added in v0.24.0
TriggerWithRun is special case of trigger that provides a parent run to the session
type URN ¶
URN adds additional functionality around urns.URN such as channel affinity.
func ParseURN ¶ added in v0.260.0
func ParseURN(ca *ChannelAssets, encoded urns.URN, missing assets.MissingCallback) (*URN, error)
ParseURN converts an encoded urns.URN to a URN
type URNList ¶
type URNList []*URN
URNList is the list of a contact's URNs
func NewURNList ¶ added in v0.260.0
func NewURNList(sa SessionAssets, encoded []urns.URN, missing assets.MissingCallback) (URNList, error)
func (URNList) MapContext ¶ added in v0.31.0
MapContext returns a map of the highest priority URN for each scheme - exposed in expressions as @urns
func (URNList) ToXValue ¶ added in v0.32.0
func (l URNList) ToXValue(env envs.Environment) types.XValue
ToXValue returns a representation of this object for use in expressions
func (URNList) WithScheme ¶ added in v0.4.4
WithScheme returns a new URN list containing of only URNs of the given schemes
type User ¶ added in v0.124.0
User adds some functionality to user assets.
func (*User) Context ¶ added in v0.124.0
Context returns the properties available in expressions
__default__:text -> the name or email email:text -> the email address of the user name:text -> the name of the user first_name:text -> the first name of the user
@context user
func (*User) Format ¶ added in v0.124.4
Format returns a friendly string version of this user depending on what fields are set
func (*User) Reference ¶ added in v0.124.0
func (u *User) Reference() *assets.UserReference
Reference returns a reference to this user
type UserAssets ¶ added in v0.124.0
type UserAssets struct {
// contains filtered or unexported fields
}
UserAssets provides access to all user assets
func NewUserAssets ¶ added in v0.124.0
func NewUserAssets(users []assets.User) *UserAssets
NewUserAssets creates a new set of user assets
func (*UserAssets) FindByEmail ¶ added in v0.245.1
func (s *UserAssets) FindByEmail(email string) *User
FindByEmail looks for a user with the given email (case-insensitive)
type Wait ¶
type Wait interface {
utils.Typed
FlowTypeRestricted
Timeout() Timeout
Begin(Run, events.EventLogger) bool
Accepts(Resume) bool
}
Wait tells the engine that the session requires input from the user
type WebhookCall ¶ added in v0.8.0
type WebhookCall struct {
Method string `json:"method"`
URL string `json:"url"`
ResponseStatus int `json:"status"`
ResponseHeaders map[string]string `json:"headers"`
ResponseJSON json.RawMessage `json:"json"`
}
WebhookCall holds the details of a webhook call
func NewWebhookCall ¶ added in v0.10.20
func NewWebhookCall(t *httpx.Trace) *WebhookCall
NewWebhookCall creates a new webhook call from a trace
func (*WebhookCall) Context ¶ added in v0.204.0
func (w *WebhookCall) Context(env envs.Environment) map[string]types.XValue
Context returns the properties available in expressions
__default__:text -> the method and URL status:number -> the response status code headers:any -> the response headers json:any -> the response body if valid JSON
@context webhook