actions

package
v0.29.8 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: AGPL-3.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const TypeAddContactGroups string = "add_contact_groups"

TypeAddContactGroups is our type for the add to groups action

View Source
const TypeAddContactURN string = "add_contact_urn"

TypeAddContactURN is our type for the add URN action

View Source
const TypeAddInputLabels string = "add_input_labels"

TypeAddInputLabels is the type for the add label action

View Source
const TypeCallResthook string = "call_resthook"

TypeCallResthook is the type for the call resthook action

View Source
const TypeCallWebhook string = "call_webhook"

TypeCallWebhook is the type for the call webhook action

View Source
const TypeEnterFlow string = "enter_flow"

TypeEnterFlow is the type for the enter flow action

View Source
const TypePlayAudio string = "play_audio"

TypePlayAudio is the type for the play audio action

View Source
const TypeRemoveContactGroups string = "remove_contact_groups"

TypeRemoveContactGroups is the type for the remove from groups action

View Source
const TypeSayMsg string = "say_msg"

TypeSayMsg is the type for the say message action

View Source
const TypeSendBroadcast string = "send_broadcast"

TypeSendBroadcast is the type for the send broadcast action

View Source
const TypeSendEmail string = "send_email"

TypeSendEmail is the type for the send email action

View Source
const TypeSendMsg string = "send_msg"

TypeSendMsg is the type for the send message action

View Source
const TypeSetContactChannel string = "set_contact_channel"

TypeSetContactChannel is the type for the set contact channel action

View Source
const TypeSetContactField string = "set_contact_field"

TypeSetContactField is the type for the set contact field action

View Source
const TypeSetContactLanguage string = "set_contact_language"

TypeSetContactLanguage is the type for the set contact Language action

View Source
const TypeSetContactName string = "set_contact_name"

TypeSetContactName is the type for the set contact name action

View Source
const TypeSetContactTimezone string = "set_contact_timezone"

TypeSetContactTimezone is the type for the set contact timezone action

View Source
const TypeSetRunResult string = "set_run_result"

TypeSetRunResult is the type for the set run result action

View Source
const TypeStartSession string = "start_session"

TypeStartSession is the type for the start session action

Variables

This section is empty.

Functions

func ReadAction added in v0.11.0

func ReadAction(data json.RawMessage) (flows.Action, error)

ReadAction reads an action from the given JSON

func RegisterType added in v0.11.0

func RegisterType(name string, initFunc func() flows.Action)

RegisterType registers a new type of action

func RegisteredTypes added in v0.23.0

func RegisteredTypes() map[string](func() flows.Action)

RegisteredTypes gets the registered types of action

Types

type AddContactGroupsAction added in v0.6.0

type AddContactGroupsAction struct {
	BaseAction

	Groups []*assets.GroupReference `json:"groups" validate:"required,dive"`
	// contains filtered or unexported fields
}

AddContactGroupsAction can be used to add a contact to one or more groups. A [event:contact_groups_changed] event will be created for the groups which the contact has been added to.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "add_contact_groups",
  "groups": [{
    "uuid": "1e1ce1e1-9288-4504-869e-022d1003c72a",
    "name": "Customers"
  }]
}

@action add_contact_groups

func NewAddContactGroupsAction added in v0.22.0

func NewAddContactGroupsAction(uuid flows.ActionUUID, groups []*assets.GroupReference) *AddContactGroupsAction

NewAddContactGroupsAction creates a new add to groups action

func (*AddContactGroupsAction) AllowedFlowTypes added in v0.14.0

func (a *AddContactGroupsAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*AddContactGroupsAction) Execute added in v0.6.0

func (a *AddContactGroupsAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute adds our contact to the specified groups

func (*AddContactGroupsAction) Inspect added in v0.29.0

func (a *AddContactGroupsAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

type AddContactURNAction added in v0.6.0

type AddContactURNAction struct {
	BaseAction

	Scheme string `json:"scheme" validate:"urnscheme"`
	Path   string `json:"path" validate:"required"`
	// contains filtered or unexported fields
}

AddContactURNAction can be used to add a URN to the current contact. A [event:contact_urns_changed] event will be created when this action is encountered.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "add_contact_urn",
  "scheme": "tel",
  "path": "@results.phone_number"
}

@action add_contact_urn

func NewAddContactURNAction added in v0.22.0

func NewAddContactURNAction(uuid flows.ActionUUID, scheme string, path string) *AddContactURNAction

NewAddContactURNAction creates a new add URN action

func (*AddContactURNAction) AllowedFlowTypes added in v0.14.0

func (a *AddContactURNAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*AddContactURNAction) EnumerateTemplates added in v0.29.0

func (a *AddContactURNAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*AddContactURNAction) Execute added in v0.6.0

func (a *AddContactURNAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs the labeling action

func (*AddContactURNAction) Inspect added in v0.29.0

func (a *AddContactURNAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*AddContactURNAction) RewriteTemplates added in v0.29.0

func (a *AddContactURNAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type AddInputLabelsAction added in v0.6.0

type AddInputLabelsAction struct {
	BaseAction

	Labels []*assets.LabelReference `json:"labels" validate:"required,dive"`
	// contains filtered or unexported fields
}

AddInputLabelsAction can be used to add labels to the last user input on a flow. An [event:input_labels_added] event will be created with the labels added when this action is encountered. If there is no user input at that point then this action will be ignored.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "add_input_labels",
  "labels": [{
    "uuid": "3f65d88a-95dc-4140-9451-943e94e06fea",
    "name": "Spam"
  }]
}

@action add_input_labels

func NewAddInputLabelsAction added in v0.22.0

func NewAddInputLabelsAction(uuid flows.ActionUUID, labels []*assets.LabelReference) *AddInputLabelsAction

NewAddInputLabelsAction creates a new add labels action

func (*AddInputLabelsAction) AllowedFlowTypes added in v0.14.0

func (a *AddInputLabelsAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*AddInputLabelsAction) Execute added in v0.6.0

func (a *AddInputLabelsAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs the labeling action

func (*AddInputLabelsAction) Inspect added in v0.29.0

func (a *AddInputLabelsAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

type BaseAction

type BaseAction struct {
	Type_ string           `json:"type" validate:"required"`
	UUID_ flows.ActionUUID `json:"uuid" validate:"required,uuid4"`
}

BaseAction is our base action

func NewBaseAction added in v0.4.0

func NewBaseAction(typeName string, uuid flows.ActionUUID) BaseAction

func (*BaseAction) EnumerateDependencies added in v0.29.0

func (a *BaseAction) EnumerateDependencies(localization flows.Localization, include func(assets.Reference))

EnumerateDependencies enumerates all dependencies on this object and its children

func (*BaseAction) EnumerateResultNames added in v0.29.0

func (a *BaseAction) EnumerateResultNames(include func(string))

EnumerateResultNames enumerates all result names on this object

func (*BaseAction) EnumerateTemplates added in v0.29.0

func (a *BaseAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*BaseAction) LocalizationUUID added in v0.29.0

func (a *BaseAction) LocalizationUUID() utils.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*BaseAction) RewriteTemplates added in v0.29.0

func (a *BaseAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

func (*BaseAction) Type added in v0.22.0

func (a *BaseAction) Type() string

Type returns the type of this action

func (*BaseAction) UUID

func (a *BaseAction) UUID() flows.ActionUUID

UUID returns the UUID of the action

func (*BaseAction) Validate added in v0.29.0

func (a *BaseAction) Validate() error

Validate validates our action is valid

type CallResthookAction added in v0.10.20

type CallResthookAction struct {
	BaseAction

	Resthook   string `json:"resthook" validate:"required"`
	ResultName string `json:"result_name,omitempty"`
	// contains filtered or unexported fields
}

CallResthookAction can be used to call a resthook.

A [event:webhook_called] event will be created for each subscriber of the resthook with the results of the HTTP call. If the action has `result_name` set, a result will be created with that name, and if the resthook returns valid JSON, that will be accessible through `extra` on the result.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "call_resthook",
  "resthook": "new-registration"
}

@action call_resthook

func NewCallResthookAction added in v0.22.0

func NewCallResthookAction(uuid flows.ActionUUID, resthook string, resultName string) *CallResthookAction

NewCallResthookAction creates a new call resthook action

func (*CallResthookAction) AllowedFlowTypes added in v0.14.0

func (a *CallResthookAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*CallResthookAction) EnumerateResultNames added in v0.29.0

func (a *CallResthookAction) EnumerateResultNames(include func(string))

EnumerateResultNames enumerates all result names on this object

func (*CallResthookAction) Execute added in v0.10.20

func (a *CallResthookAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*CallResthookAction) Inspect added in v0.29.0

func (a *CallResthookAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

type CallWebhookAction added in v0.6.0

type CallWebhookAction struct {
	BaseAction

	Method     string            `json:"method" validate:"required,http_method"`
	URL        string            `json:"url" validate:"required"`
	Headers    map[string]string `json:"headers,omitempty"`
	Body       string            `json:"body,omitempty"`
	ResultName string            `json:"result_name,omitempty"`
	// contains filtered or unexported fields
}

CallWebhookAction can be used to call an external service. The body, header and url fields may be templates and will be evaluated at runtime. A [event:webhook_called] event will be created based on the results of the HTTP call. If this action has a `result_name`, then addtionally it will create a new result with that name. If the webhook returned valid JSON, that will be accessible through `extra` on the result.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "call_webhook",
  "method": "GET",
  "url": "http://localhost:49998/?cmd=success",
  "headers": {
    "Authorization": "Token AAFFZZHH"
  },
  "result_name": "webhook"
}

@action call_webhook

func NewCallWebhookAction added in v0.22.0

func NewCallWebhookAction(uuid flows.ActionUUID, method string, url string, headers map[string]string, body string, resultName string) *CallWebhookAction

NewCallWebhookAction creates a new call webhook action

func (*CallWebhookAction) AllowedFlowTypes added in v0.14.0

func (a *CallWebhookAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*CallWebhookAction) EnumerateResultNames added in v0.29.0

func (a *CallWebhookAction) EnumerateResultNames(include func(string))

EnumerateResultNames enumerates all result names on this object

func (*CallWebhookAction) EnumerateTemplates added in v0.29.0

func (a *CallWebhookAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*CallWebhookAction) Execute added in v0.6.0

func (a *CallWebhookAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*CallWebhookAction) Inspect added in v0.29.0

func (a *CallWebhookAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*CallWebhookAction) RewriteTemplates added in v0.29.0

func (a *CallWebhookAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

func (*CallWebhookAction) Validate added in v0.6.0

func (a *CallWebhookAction) Validate() error

Validate validates our action is valid

type EnterFlowAction added in v0.25.0

type EnterFlowAction struct {
	BaseAction

	Flow     *assets.FlowReference `json:"flow" validate:"required"`
	Terminal bool                  `json:"terminal,omitempty"`
	// contains filtered or unexported fields
}

EnterFlowAction can be used to start a contact down another flow. The current flow will pause until the subflow exits or expires.

A [event:flow_entered] event will be created to record that the flow was started.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "enter_flow",
  "flow": {"uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d", "name": "Collect Language"},
  "terminal": false
}

@action enter_flow

func NewEnterFlowAction added in v0.25.0

func NewEnterFlowAction(uuid flows.ActionUUID, flow *assets.FlowReference, terminal bool) *EnterFlowAction

NewEnterFlowAction creates a new start flow action

func (*EnterFlowAction) AllowedFlowTypes added in v0.25.0

func (a *EnterFlowAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*EnterFlowAction) Execute added in v0.25.0

func (a *EnterFlowAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs our action

func (*EnterFlowAction) Inspect added in v0.29.0

func (a *EnterFlowAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

type PlayAudioAction added in v0.24.0

type PlayAudioAction struct {
	BaseAction

	AudioURL string `json:"audio_url" validate:"required"`
	// contains filtered or unexported fields
}

PlayAudioAction can be used to play an audio recording in a voice flow. It will generate an [event:ivr_created] event if there is a valid audio URL. This will contain a message which the caller should handle as an IVR play command using the audio attachment.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "play_audio",
  "audio_url": "http://uploads.temba.io/2353262.m4a"
}

@action play_audio

func NewPlayAudioAction added in v0.24.0

func NewPlayAudioAction(uuid flows.ActionUUID, audioURL string) *PlayAudioAction

NewPlayAudioAction creates a new play message action

func (*PlayAudioAction) AllowedFlowTypes added in v0.24.0

func (a *PlayAudioAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*PlayAudioAction) EnumerateTemplates added in v0.29.0

func (a *PlayAudioAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*PlayAudioAction) Execute added in v0.24.0

func (a *PlayAudioAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*PlayAudioAction) Inspect added in v0.29.0

func (a *PlayAudioAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*PlayAudioAction) RewriteTemplates added in v0.29.0

func (a *PlayAudioAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type RemoveContactGroupsAction added in v0.6.0

type RemoveContactGroupsAction struct {
	BaseAction

	Groups    []*assets.GroupReference `json:"groups,omitempty" validate:"dive"`
	AllGroups bool                     `json:"all_groups,omitempty"`
	// contains filtered or unexported fields
}

RemoveContactGroupsAction can be used to remove a contact from one or more groups. A [event:contact_groups_changed] event will be created for the groups which the contact is removed from. Groups can either be explicitly provided or `all_groups` can be set to true to remove the contact from all non-dynamic groups.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "remove_contact_groups",
  "groups": [{
    "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d",
    "name": "Registered Users"
  }]
}

@action remove_contact_groups

func NewRemoveContactGroupsAction added in v0.22.0

func NewRemoveContactGroupsAction(uuid flows.ActionUUID, groups []*assets.GroupReference, allGroups bool) *RemoveContactGroupsAction

NewRemoveContactGroupsAction creates a new remove from groups action

func (*RemoveContactGroupsAction) AllowedFlowTypes added in v0.14.0

func (a *RemoveContactGroupsAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*RemoveContactGroupsAction) Execute added in v0.6.0

func (a *RemoveContactGroupsAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs the action

func (*RemoveContactGroupsAction) Inspect added in v0.29.0

func (a *RemoveContactGroupsAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*RemoveContactGroupsAction) Validate added in v0.6.0

func (a *RemoveContactGroupsAction) Validate() error

Validate validates our action is valid

type SayMsgAction added in v0.24.0

type SayMsgAction struct {
	BaseAction

	Text     string `json:"text" validate:"required"`
	AudioURL string `json:"audio_url,omitempty"`
	// contains filtered or unexported fields
}

SayMsgAction can be used to communicate with the contact in a voice flow by either reading a message with TTS or playing a pre-recorded audio file. It will generate an [event:ivr_created] event if there is a valid audio URL or backdown text. This will contain a message which the caller should handle as an IVR play command if it has an audio attachment, or otherwise an IVR say command using the message text.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "say_msg",
  "audio_url": "http://uploads.temba.io/2353262.m4a",
  "text": "Hi @contact.name, are you ready to complete today's survey?"
}

@action say_msg

func NewSayMsgAction added in v0.24.0

func NewSayMsgAction(uuid flows.ActionUUID, text string, audioURL string) *SayMsgAction

NewSayMsgAction creates a new say message action

func (*SayMsgAction) AllowedFlowTypes added in v0.24.0

func (a *SayMsgAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SayMsgAction) EnumerateTemplates added in v0.29.0

func (a *SayMsgAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*SayMsgAction) Execute added in v0.24.0

func (a *SayMsgAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*SayMsgAction) Inspect added in v0.29.0

func (a *SayMsgAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*SayMsgAction) RewriteTemplates added in v0.29.0

func (a *SayMsgAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type SendBroadcastAction added in v0.6.0

type SendBroadcastAction struct {
	BaseAction
	// contains filtered or unexported fields
}

SendBroadcastAction can be used to send a message to one or more contacts. It accepts a list of URNs, a list of groups and a list of contacts.

The URNs and text fields may be templates. A [event:broadcast_created] event will be created for each unique urn, contact and group with the evaluated text.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "send_broadcast",
  "urns": ["tel:+12065551212"],
  "text": "Hi @contact.name, are you ready to complete today's survey?"
}

@action send_broadcast

func NewSendBroadcastAction added in v0.22.0

func NewSendBroadcastAction(uuid flows.ActionUUID, text string, attachments []string, quickReplies []string, urns []urns.URN, contacts []*flows.ContactReference, groups []*assets.GroupReference, legacyVars []string) *SendBroadcastAction

NewSendBroadcastAction creates a new send broadcast action

func (*SendBroadcastAction) AllowedFlowTypes added in v0.14.0

func (a *SendBroadcastAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SendBroadcastAction) EnumerateTemplates added in v0.29.0

func (a *SendBroadcastAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*SendBroadcastAction) Execute added in v0.6.0

func (a *SendBroadcastAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*SendBroadcastAction) Inspect added in v0.29.0

func (a *SendBroadcastAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*SendBroadcastAction) RewriteTemplates added in v0.29.0

func (a *SendBroadcastAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type SendEmailAction added in v0.6.0

type SendEmailAction struct {
	BaseAction

	Addresses []string `json:"addresses" validate:"required,min=1"`
	Subject   string   `json:"subject" validate:"required"`
	Body      string   `json:"body" validate:"required"`
	// contains filtered or unexported fields
}

SendEmailAction can be used to send an email to one or more recipients. The subject, body and addresses can all contain expressions.

An [event:email_created] event will be created for each email address.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "send_email",
  "addresses": ["@(contact.urns.mailto[0])"],
  "subject": "Here is your activation token",
  "body": "Your activation token is @contact.fields.activation_token"
}

@action send_email

func NewSendEmailAction added in v0.22.0

func NewSendEmailAction(uuid flows.ActionUUID, addresses []string, subject string, body string) *SendEmailAction

NewSendEmailAction creates a new send email action

func (*SendEmailAction) AllowedFlowTypes added in v0.14.0

func (a *SendEmailAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SendEmailAction) EnumerateTemplates added in v0.29.0

func (a *SendEmailAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*SendEmailAction) Execute added in v0.6.0

func (a *SendEmailAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute creates the email events

func (*SendEmailAction) Inspect added in v0.29.0

func (a *SendEmailAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*SendEmailAction) RewriteTemplates added in v0.29.0

func (a *SendEmailAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type SendMsgAction

type SendMsgAction struct {
	BaseAction

	AllURNs bool `json:"all_urns,omitempty"`
	// contains filtered or unexported fields
}

SendMsgAction can be used to reply to the current contact in a flow. The text field may contain templates. The action will attempt to find pairs of URNs and channels which can be used for sending. If it can't find such a pair, it will create a message without a channel or URN.

A [event:msg_created] event will be created with the evaluated text.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "send_msg",
  "text": "Hi @contact.name, are you ready to complete today's survey?",
  "attachments": [],
  "all_urns": false
}

@action send_msg

func NewSendMsgAction added in v0.22.0

func NewSendMsgAction(uuid flows.ActionUUID, text string, attachments []string, quickReplies []string, allURNs bool) *SendMsgAction

NewSendMsgAction creates a new send msg action

func (*SendMsgAction) AllowedFlowTypes added in v0.14.0

func (a *SendMsgAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SendMsgAction) EnumerateTemplates added in v0.29.0

func (a *SendMsgAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*SendMsgAction) Execute

func (a *SendMsgAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*SendMsgAction) Inspect added in v0.29.0

func (a *SendMsgAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*SendMsgAction) RewriteTemplates added in v0.29.0

func (a *SendMsgAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type SetContactChannelAction added in v0.6.0

type SetContactChannelAction struct {
	BaseAction

	Channel *assets.ChannelReference `json:"channel" validate:"omitempty,dive"`
	// contains filtered or unexported fields
}

SetContactChannelAction can be used to change or clear the preferred channel of the current contact.

Because channel affinity is a property of a contact's URNs, a [event:contact_urns_changed] event will be created if any changes are made to the contact's URNs.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "set_contact_channel",
  "channel": {"uuid": "4bb288a0-7fca-4da1-abe8-59a593aff648", "name": "FAcebook Channel"}
}

@action set_contact_channel

func NewSetContactChannelAction added in v0.22.0

func NewSetContactChannelAction(uuid flows.ActionUUID, channel *assets.ChannelReference) *SetContactChannelAction

NewSetContactChannelAction creates a new set channel action

func (*SetContactChannelAction) AllowedFlowTypes added in v0.14.0

func (a *SetContactChannelAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SetContactChannelAction) Execute added in v0.6.0

func (a *SetContactChannelAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs our action

func (*SetContactChannelAction) Inspect added in v0.29.0

func (a *SetContactChannelAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

type SetContactFieldAction added in v0.6.0

type SetContactFieldAction struct {
	BaseAction

	Field *assets.FieldReference `json:"field" validate:"required"`
	Value string                 `json:"value"`
	// contains filtered or unexported fields
}

SetContactFieldAction can be used to update a field value on the contact. The value is a localizable template and white space is trimmed from the final value. An empty string clears the value. A [event:contact_field_changed] event will be created with the corresponding value.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "set_contact_field",
  "field": {"key": "gender", "name": "Gender"},
  "value": "Female"
}

@action set_contact_field

func NewSetContactFieldAction added in v0.22.0

func NewSetContactFieldAction(uuid flows.ActionUUID, field *assets.FieldReference, value string) *SetContactFieldAction

NewSetContactFieldAction creates a new set channel action

func (*SetContactFieldAction) AllowedFlowTypes added in v0.14.0

func (a *SetContactFieldAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SetContactFieldAction) EnumerateTemplates added in v0.29.0

func (a *SetContactFieldAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*SetContactFieldAction) Execute added in v0.6.0

func (a *SetContactFieldAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*SetContactFieldAction) Inspect added in v0.29.0

func (a *SetContactFieldAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*SetContactFieldAction) RewriteTemplates added in v0.29.0

func (a *SetContactFieldAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type SetContactLanguageAction added in v0.10.0

type SetContactLanguageAction struct {
	BaseAction

	Language string `json:"language"`
	// contains filtered or unexported fields
}

SetContactLanguageAction can be used to update the name of the contact. The language is a localizable template and white space is trimmed from the final value. An empty string clears the language. A [event:contact_language_changed] event will be created with the corresponding value.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "set_contact_language",
  "language": "eng"
}

@action set_contact_language

func NewSetContactLanguageAction added in v0.22.0

func NewSetContactLanguageAction(uuid flows.ActionUUID, language string) *SetContactLanguageAction

NewSetContactLanguageAction creates a new set language action

func (*SetContactLanguageAction) AllowedFlowTypes added in v0.14.0

func (a *SetContactLanguageAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SetContactLanguageAction) EnumerateTemplates added in v0.29.0

func (a *SetContactLanguageAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*SetContactLanguageAction) Execute added in v0.10.0

func (a *SetContactLanguageAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*SetContactLanguageAction) Inspect added in v0.29.0

func (a *SetContactLanguageAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*SetContactLanguageAction) RewriteTemplates added in v0.29.0

func (a *SetContactLanguageAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type SetContactNameAction added in v0.10.0

type SetContactNameAction struct {
	BaseAction

	Name string `json:"name"`
	// contains filtered or unexported fields
}

SetContactNameAction can be used to update the name of the contact. The name is a localizable template and white space is trimmed from the final value. An empty string clears the name. A [event:contact_name_changed] event will be created with the corresponding value.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "set_contact_name",
  "name": "Bob Smith"
}

@action set_contact_name

func NewSetContactNameAction added in v0.22.0

func NewSetContactNameAction(uuid flows.ActionUUID, name string) *SetContactNameAction

NewSetContactNameAction creates a new set name action

func (*SetContactNameAction) AllowedFlowTypes added in v0.14.0

func (a *SetContactNameAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SetContactNameAction) EnumerateTemplates added in v0.29.0

func (a *SetContactNameAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*SetContactNameAction) Execute added in v0.10.0

func (a *SetContactNameAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*SetContactNameAction) Inspect added in v0.29.0

func (a *SetContactNameAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*SetContactNameAction) RewriteTemplates added in v0.29.0

func (a *SetContactNameAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type SetContactTimezoneAction added in v0.10.0

type SetContactTimezoneAction struct {
	BaseAction

	Timezone string `json:"timezone"`
	// contains filtered or unexported fields
}

SetContactTimezoneAction can be used to update the timezone of the contact. The timezone is a localizable template and white space is trimmed from the final value. An empty string clears the timezone. A [event:contact_timezone_changed] event will be created with the corresponding value.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "set_contact_timezone",
  "timezone": "Africa/Kigali"
}

@action set_contact_timezone

func NewSetContactTimezoneAction added in v0.22.0

func NewSetContactTimezoneAction(uuid flows.ActionUUID, timezone string) *SetContactTimezoneAction

NewSetContactTimezoneAction creates a new set timezone action

func (*SetContactTimezoneAction) AllowedFlowTypes added in v0.14.0

func (a *SetContactTimezoneAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SetContactTimezoneAction) EnumerateTemplates added in v0.29.0

func (a *SetContactTimezoneAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*SetContactTimezoneAction) Execute added in v0.10.0

func (a *SetContactTimezoneAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*SetContactTimezoneAction) Inspect added in v0.29.0

func (a *SetContactTimezoneAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*SetContactTimezoneAction) RewriteTemplates added in v0.29.0

func (a *SetContactTimezoneAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type SetRunResultAction added in v0.6.0

type SetRunResultAction struct {
	BaseAction

	Name     string `json:"name" validate:"required"`
	Value    string `json:"value" validate:"required"`
	Category string `json:"category"`
	// contains filtered or unexported fields
}

SetRunResultAction can be used to save a result for a flow. The result will be available in the context for the run as @results.[name]. The optional category can be used as a way of categorizing results, this can be useful for reporting or analytics.

Both the value and category fields may be templates. A [event:run_result_changed] event will be created with the final values.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "set_run_result",
  "name": "Gender",
  "value": "m",
  "category": "Male"
}

@action set_run_result

func NewSetRunResultAction added in v0.22.0

func NewSetRunResultAction(uuid flows.ActionUUID, name string, value string, category string) *SetRunResultAction

NewSetRunResultAction creates a new set run result action

func (*SetRunResultAction) AllowedFlowTypes added in v0.14.0

func (a *SetRunResultAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*SetRunResultAction) EnumerateResultNames added in v0.29.0

func (a *SetRunResultAction) EnumerateResultNames(include func(string))

EnumerateResultNames enumerates all result names on this object

func (*SetRunResultAction) EnumerateTemplates added in v0.29.0

func (a *SetRunResultAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*SetRunResultAction) Execute added in v0.6.0

func (a *SetRunResultAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs this action

func (*SetRunResultAction) Inspect added in v0.29.0

func (a *SetRunResultAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*SetRunResultAction) RewriteTemplates added in v0.29.0

func (a *SetRunResultAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

type StartSessionAction added in v0.4.0

type StartSessionAction struct {
	BaseAction

	Flow          *assets.FlowReference `json:"flow" validate:"required"`
	CreateContact bool                  `json:"create_contact,omitempty"`
	// contains filtered or unexported fields
}

StartSessionAction can be used to trigger sessions for other contacts and groups. A [event:session_triggered] event will be created and it's the responsibility of the caller to act on that by initiating a new session with the flow engine.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "start_session",
  "flow": {"uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d", "name": "Registration"},
  "groups": [
    {"uuid": "1e1ce1e1-9288-4504-869e-022d1003c72a", "name": "Customers"}
  ]
}

@action start_session

func NewStartSessionAction added in v0.22.0

func NewStartSessionAction(uuid flows.ActionUUID, flow *assets.FlowReference, urns []urns.URN, contacts []*flows.ContactReference, groups []*assets.GroupReference, legacyVars []string, createContact bool) *StartSessionAction

NewStartSessionAction creates a new start session action

func (*StartSessionAction) AllowedFlowTypes added in v0.14.0

func (a *StartSessionAction) AllowedFlowTypes() []flows.FlowType

AllowedFlowTypes returns the flow types which this action is allowed to occur in

func (*StartSessionAction) EnumerateTemplates added in v0.29.0

func (a *StartSessionAction) EnumerateTemplates(localization flows.Localization, include func(string))

EnumerateTemplates enumerates all expressions on this object and its children

func (*StartSessionAction) Execute added in v0.4.0

func (a *StartSessionAction) Execute(run flows.FlowRun, step flows.Step, logModifier flows.ModifierCallback, logEvent flows.EventCallback) error

Execute runs our action

func (*StartSessionAction) Inspect added in v0.29.0

func (a *StartSessionAction) Inspect(inspect func(flows.Inspectable))

Inspect inspects this object and any children

func (*StartSessionAction) RewriteTemplates added in v0.29.0

func (a *StartSessionAction) RewriteTemplates(localization flows.Localization, rewrite func(string) string)

RewriteTemplates rewrites all templates on this object and its children

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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