Help us shape the future of Go! Take the 2026 Go Developer Survey

actions

package
v0.261.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CategorySuccess = "Success"
	CategorySkipped = "Skipped"
	CategoryFailure = "Failure"
)

common category names

View Source
const (
	// TypeOpenTicket is the type for the open ticket action
	TypeOpenTicket string = "open_ticket"

	OpenTicketOutputLocal = "_new_ticket"
)
View Source
const (
	// TypeTransferAirtime is the type for the transfer airtime action
	TypeTransferAirtime string = "transfer_airtime"

	TransferAirtimeOutputLocal = "_new_transfer"
)
View Source
const LLMErrorOutput = "<ERROR>"

LLMErrorOutput is the output used when the LLM call fails

View Source
const ResthookPayload = `` /* 928-byte string literal not displayed */

ResthookPayload is the POST payload used by resthooks

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 TypeCallClassifier string = "call_classifier"

TypeCallClassifier is the type for the call classifier action

View Source
const TypeCallLLM string = "call_llm"

TypeCallLLM is the type for the call LLM 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 TypeRequestOptIn string = "request_optin"

TypeRequestOptIn is the type for the send optin 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 TypeSetContactStatus string = "set_contact_status"

TypeSetContactStatus is the type for the set contact status action

View Source
const TypeSetContactTimezone string = "set_contact_timezone"

TypeSetContactTimezone is the type for the set contact timezone action

View Source
const TypeSetRunLocal string = "set_run_local"

TypeSetRunLocal is the type for the set run result 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 Read added in v0.249.0

func Read(data []byte) (flows.Action, error)

Read reads an action from the given JSON

func RegisteredTypes added in v0.23.0

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

RegisteredTypes gets the registered types of action

Types

type AddContactGroups added in v0.249.0

type AddContactGroups struct {
	Groups []*assets.GroupReference `json:"groups" validate:"required,max=100,dive"`
	// contains filtered or unexported fields
}

AddContactGroups 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 NewAddContactGroups added in v0.48.0

func NewAddContactGroups(uuid flows.ActionUUID, groups []*assets.GroupReference) *AddContactGroups

NewAddContactGroups creates a new add to groups action

func (*AddContactGroups) AllowedFlowTypes added in v0.249.0

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

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

func (*AddContactGroups) Execute added in v0.249.0

func (a *AddContactGroups) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute adds our contact to the specified groups

func (*AddContactGroups) Inspect added in v0.249.0

func (a *AddContactGroups) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*AddContactGroups) LocalizationUUID added in v0.249.0

func (a *AddContactGroups) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*AddContactGroups) Type added in v0.249.0

func (a *AddContactGroups) Type() string

Type returns the type of this action

func (*AddContactGroups) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*AddContactGroups) Validate added in v0.249.0

func (a *AddContactGroups) Validate() error

Validate validates our action is valid

type AddContactURN added in v0.249.0

type AddContactURN struct {
	Scheme string `json:"scheme" validate:"urnscheme"`
	Path   string `json:"path" validate:"required" engine:"evaluated"`
	// contains filtered or unexported fields
}

AddContactURN 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.value"
}

@action add_contact_urn

func NewAddContactURN added in v0.48.0

func NewAddContactURN(uuid flows.ActionUUID, scheme string, path string) *AddContactURN

NewAddContactURN creates a new add URN action

func (*AddContactURN) AllowedFlowTypes added in v0.249.0

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

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

func (*AddContactURN) Execute added in v0.249.0

func (a *AddContactURN) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs the labeling action

func (*AddContactURN) Inspect added in v0.249.0

func (a *AddContactURN) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*AddContactURN) LocalizationUUID added in v0.249.0

func (a *AddContactURN) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*AddContactURN) Type added in v0.249.0

func (a *AddContactURN) Type() string

Type returns the type of this action

func (*AddContactURN) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*AddContactURN) Validate added in v0.249.0

func (a *AddContactURN) Validate() error

Validate validates our action is valid

type AddInputLabels added in v0.249.0

type AddInputLabels struct {
	Labels []*assets.LabelReference `json:"labels" validate:"required,max=100,dive"`
	// contains filtered or unexported fields
}

AddInputLabels 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 NewAddInputLabels added in v0.48.0

func NewAddInputLabels(uuid flows.ActionUUID, labels []*assets.LabelReference) *AddInputLabels

NewAddInputLabels creates a new add labels action

func (*AddInputLabels) AllowedFlowTypes added in v0.249.0

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

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

func (*AddInputLabels) Execute added in v0.249.0

func (a *AddInputLabels) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs the labeling action

func (*AddInputLabels) Inspect added in v0.249.0

func (a *AddInputLabels) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*AddInputLabels) LocalizationUUID added in v0.249.0

func (a *AddInputLabels) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*AddInputLabels) Type added in v0.249.0

func (a *AddInputLabels) Type() string

Type returns the type of this action

func (*AddInputLabels) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*AddInputLabels) Validate added in v0.249.0

func (a *AddInputLabels) Validate() error

Validate validates our action is valid

type CallClassifier added in v0.249.0

type CallClassifier struct {
	Classifier *assets.ClassifierReference `json:"classifier" validate:"required"`
	Input      string                      `json:"input" validate:"required" engine:"evaluated"`
	ResultName string                      `json:"result_name" validate:"required,result_name"`
	// contains filtered or unexported fields
}

CallClassifier can be used to classify the intent and entities from a given input using an NLU classifier. It always saves a result indicating whether the classification was successful, skipped or failed, and what the extracted intents and entities were.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "call_classifier",
  "classifier": {
    "uuid": "1c06c884-39dd-4ce4-ad9f-9a01cbe6c000",
    "name": "Booking"
  },
  "input": "@input.text",
  "result_name": "Intent"
}

@action call_classifier

func NewCallClassifier added in v0.51.0

func NewCallClassifier(uuid flows.ActionUUID, classifier *assets.ClassifierReference, input string, resultName string) *CallClassifier

NewCallClassifier creates a new call classifier action

func (*CallClassifier) AllowedFlowTypes added in v0.249.0

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

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

func (*CallClassifier) Execute added in v0.249.0

func (a *CallClassifier) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*CallClassifier) Inspect added in v0.249.0

func (a *CallClassifier) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*CallClassifier) LocalizationUUID added in v0.249.0

func (a *CallClassifier) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*CallClassifier) Type added in v0.249.0

func (a *CallClassifier) Type() string

Type returns the type of this action

func (*CallClassifier) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*CallClassifier) Validate added in v0.249.0

func (a *CallClassifier) Validate() error

Validate validates our action is valid

type CallLLM added in v0.249.0

type CallLLM struct {
	LLM          *assets.LLMReference `json:"llm"          validate:"required"`
	Instructions string               `json:"instructions" validate:"required"            engine:"evaluated"`
	Input        string               `json:"input"                                       engine:"evaluated"`
	OutputLocal  string               `json:"output_local" validate:"required,local_ref"`
	// contains filtered or unexported fields
}

CallLLM can be used to call an LLM.

An [event:llm_called] event will be created if the LLM could be called.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "call_llm",
  "llm": {
    "uuid": "14115c03-b4c5-49e2-b9ac-390c43e9d7ce",
    "name": "GPT-4"
  },
  "instructions": "Categorize the following text as positive or negative",
  "input": "@input.text",
  "output_local": "_llm_output"
}

@action call_llm

func NewCallLLM added in v0.235.0

func NewCallLLM(uuid flows.ActionUUID, llm *assets.LLMReference, instructions, input, outputLocal string) *CallLLM

NewCallLLM creates a new call LLM action

func (*CallLLM) AllowedFlowTypes added in v0.249.0

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

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

func (*CallLLM) Execute added in v0.249.0

func (a *CallLLM) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*CallLLM) Inspect added in v0.249.0

func (a *CallLLM) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*CallLLM) LocalizationUUID added in v0.249.0

func (a *CallLLM) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*CallLLM) Type added in v0.249.0

func (a *CallLLM) Type() string

Type returns the type of this action

func (*CallLLM) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*CallLLM) Validate added in v0.249.0

func (a *CallLLM) Validate() error

Validate validates our action is valid

type CallResthook added in v0.249.0

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

CallResthook 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 NewCallResthook added in v0.48.0

func NewCallResthook(uuid flows.ActionUUID, resthook string, resultName string) *CallResthook

NewCallResthook creates a new call resthook action

func (*CallResthook) AllowedFlowTypes added in v0.249.0

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

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

func (*CallResthook) Execute added in v0.249.0

func (a *CallResthook) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*CallResthook) Inspect added in v0.249.0

func (a *CallResthook) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*CallResthook) LocalizationUUID added in v0.249.0

func (a *CallResthook) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*CallResthook) Type added in v0.249.0

func (a *CallResthook) Type() string

Type returns the type of this action

func (*CallResthook) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*CallResthook) Validate added in v0.249.0

func (a *CallResthook) Validate() error

Validate validates our action is valid

type CallWebhook added in v0.249.0

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

CallWebhook 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 additionally it will create a new result with that name. The value of the result will be the status code and the category will be `Success` or `Failed`. If the webhook returned valid JSON which is less than 10000 bytes, that will be accessible through `extra` on the result. The last JSON response from a webhook call in the current sprint will additionally be accessible in expressions as `@webhook` regardless of size.

{
  "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 NewCallWebhook added in v0.48.0

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

NewCallWebhook creates a new call webhook action

func (*CallWebhook) AllowedFlowTypes added in v0.249.0

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

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

func (*CallWebhook) Execute added in v0.249.0

func (a *CallWebhook) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*CallWebhook) Inspect added in v0.249.0

func (a *CallWebhook) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*CallWebhook) LocalizationUUID added in v0.249.0

func (a *CallWebhook) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*CallWebhook) Type added in v0.249.0

func (a *CallWebhook) Type() string

Type returns the type of this action

func (*CallWebhook) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*CallWebhook) Validate added in v0.249.0

func (a *CallWebhook) Validate() error

Validate validates our action is valid

type EnterFlow added in v0.249.0

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

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

A [event:run_started] event will be created to record that a new run 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 NewEnterFlow added in v0.48.0

func NewEnterFlow(uuid flows.ActionUUID, flow *assets.FlowReference, terminal bool) *EnterFlow

NewEnterFlow creates a new start flow action

func (*EnterFlow) AllowedFlowTypes added in v0.249.0

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

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

func (*EnterFlow) Execute added in v0.249.0

func (a *EnterFlow) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs our action

func (*EnterFlow) Inspect added in v0.249.0

func (a *EnterFlow) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*EnterFlow) LocalizationUUID added in v0.249.0

func (a *EnterFlow) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*EnterFlow) Type added in v0.249.0

func (a *EnterFlow) Type() string

Type returns the type of this action

func (*EnterFlow) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*EnterFlow) Validate added in v0.249.0

func (a *EnterFlow) Validate() error

Validate validates our action is valid

type LocalOperation added in v0.235.0

type LocalOperation string
const (
	LocalOperationSet       LocalOperation = "set"
	LocalOperationIncrement LocalOperation = "increment"
	LocalOperationClear     LocalOperation = "clear"
)

type OpenTicket added in v0.249.0

type OpenTicket struct {
	Topic    *assets.TopicReference `json:"topic"`
	Note     string                 `json:"note"                engine:"evaluated"`
	Assignee *assets.UserReference  `json:"assignee,omitempty"`
	// contains filtered or unexported fields
}

OpenTicket is used to open a ticket for the contact if they don't already have an open ticket.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "open_ticket",
  "topic": {
    "uuid": "472a7a73-96cb-4736-b567-056d987cc5b4",
    "name": "Weather"
  },
  "note": "@input",
  "assignee": {"uuid": "0c78ef47-7d56-44d8-8f57-96e0f30e8f44", "name": "Bob McTickets"}
}

@action open_ticket

func NewOpenTicket added in v0.86.0

func NewOpenTicket(uuid flows.ActionUUID, topic *assets.TopicReference, note string, assignee *assets.UserReference) *OpenTicket

NewOpenTicket creates a new open ticket action

func (*OpenTicket) AllowedFlowTypes added in v0.249.0

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

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

func (*OpenTicket) Execute added in v0.249.0

func (a *OpenTicket) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*OpenTicket) Inspect added in v0.249.0

func (a *OpenTicket) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*OpenTicket) LocalizationUUID added in v0.249.0

func (a *OpenTicket) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*OpenTicket) Type added in v0.249.0

func (a *OpenTicket) Type() string

Type returns the type of this action

func (*OpenTicket) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*OpenTicket) Validate added in v0.249.0

func (a *OpenTicket) Validate() error

Validate validates our action is valid

type PlayAudio added in v0.249.0

type PlayAudio struct {
	AudioURL string `json:"audio_url" validate:"required" engine:"localized,evaluated"`
	// contains filtered or unexported fields
}

PlayAudio 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 NewPlayAudio added in v0.48.0

func NewPlayAudio(uuid flows.ActionUUID, audioURL string) *PlayAudio

NewPlayAudio creates a new play message action

func (*PlayAudio) AllowedFlowTypes added in v0.249.0

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

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

func (*PlayAudio) Execute added in v0.249.0

func (a *PlayAudio) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*PlayAudio) Inspect added in v0.249.0

func (a *PlayAudio) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*PlayAudio) LocalizationUUID added in v0.249.0

func (a *PlayAudio) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*PlayAudio) Type added in v0.249.0

func (a *PlayAudio) Type() string

Type returns the type of this action

func (*PlayAudio) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*PlayAudio) Validate added in v0.249.0

func (a *PlayAudio) Validate() error

Validate validates our action is valid

type RemoveContactGroups added in v0.249.0

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

RemoveContactGroups 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-query based 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 NewRemoveContactGroups added in v0.48.0

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

NewRemoveContactGroups creates a new remove from groups action

func (*RemoveContactGroups) AllowedFlowTypes added in v0.249.0

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

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

func (*RemoveContactGroups) Execute added in v0.249.0

func (a *RemoveContactGroups) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs the action

func (*RemoveContactGroups) Inspect added in v0.249.0

func (a *RemoveContactGroups) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*RemoveContactGroups) LocalizationUUID added in v0.249.0

func (a *RemoveContactGroups) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*RemoveContactGroups) Type added in v0.249.0

func (a *RemoveContactGroups) Type() string

Type returns the type of this action

func (*RemoveContactGroups) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*RemoveContactGroups) Validate added in v0.249.0

func (a *RemoveContactGroups) Validate() error

Validate validates our action is valid

type RequestOptIn added in v0.249.0

type RequestOptIn struct {
	OptIn *assets.OptInReference `json:"optin" validate:"required"`
	// contains filtered or unexported fields
}

RequestOptIn can be used to send an optin to the contact if the channel supports that.

An [event:optin_requested] event will be created if the optin was requested.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "request_optin",
  "optin": {
    "uuid": "248be71d-78e9-4d71-a6c4-9981d369e5cb",
    "name": "Joke Of The Day"
  }
}

@action request_optin

func NewRequestOptIn added in v0.195.3

func NewRequestOptIn(uuid flows.ActionUUID, optIn *assets.OptInReference) *RequestOptIn

NewRequestOptIn creates a new request optin action

func (*RequestOptIn) AllowedFlowTypes added in v0.249.0

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

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

func (*RequestOptIn) Execute added in v0.249.0

func (a *RequestOptIn) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute creates the optin events

func (*RequestOptIn) Inspect added in v0.249.0

func (a *RequestOptIn) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*RequestOptIn) LocalizationUUID added in v0.249.0

func (a *RequestOptIn) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*RequestOptIn) Type added in v0.249.0

func (a *RequestOptIn) Type() string

Type returns the type of this action

func (*RequestOptIn) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*RequestOptIn) Validate added in v0.249.0

func (a *RequestOptIn) Validate() error

Validate validates our action is valid

type SayMsg added in v0.249.0

type SayMsg struct {
	Text     string `json:"text"                 validate:"required,max=10000" engine:"localized,evaluated"`
	AudioURL string `json:"audio_url,omitempty"`
	// contains filtered or unexported fields
}

SayMsg 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 NewSayMsg added in v0.48.0

func NewSayMsg(uuid flows.ActionUUID, text string, audioURL string) *SayMsg

NewSayMsg creates a new say message action

func (*SayMsg) AllowedFlowTypes added in v0.249.0

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

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

func (*SayMsg) Execute added in v0.249.0

func (a *SayMsg) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SayMsg) Inspect added in v0.249.0

func (a *SayMsg) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SayMsg) LocalizationUUID added in v0.249.0

func (a *SayMsg) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SayMsg) Type added in v0.249.0

func (a *SayMsg) Type() string

Type returns the type of this action

func (*SayMsg) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SayMsg) Validate added in v0.249.0

func (a *SayMsg) Validate() error

Validate validates our action is valid

type SendBroadcast added in v0.249.0

type SendBroadcast struct {
	// contains filtered or unexported fields
}

SendBroadcast 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 NewSendBroadcast added in v0.48.0

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

NewSendBroadcast creates a new send broadcast action

func (*SendBroadcast) AllowedFlowTypes added in v0.249.0

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

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

func (*SendBroadcast) Execute added in v0.249.0

func (a *SendBroadcast) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SendBroadcast) Inspect added in v0.249.0

func (a *SendBroadcast) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SendBroadcast) LocalizationUUID added in v0.249.0

func (a *SendBroadcast) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SendBroadcast) Type added in v0.249.0

func (a *SendBroadcast) Type() string

Type returns the type of this action

func (*SendBroadcast) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SendBroadcast) Validate added in v0.249.0

func (a *SendBroadcast) Validate() error

Validate validates our action is valid

type SendEmail added in v0.249.0

type SendEmail struct {
	Addresses []string `json:"addresses" validate:"required,min=1,dive,max=1000" engine:"evaluated"`
	Subject   string   `json:"subject"   validate:"required,max=1000"            engine:"localized,evaluated"`
	Body      string   `json:"body"      validate:"required,max=10000"           engine:"localized,evaluated"`
	// contains filtered or unexported fields
}

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

An [event:email_sent] event will be created if the email could be sent.

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

@action send_email

func NewSendEmail added in v0.48.0

func NewSendEmail(uuid flows.ActionUUID, addresses []string, subject string, body string) *SendEmail

NewSendEmail creates a new send email action

func (*SendEmail) AllowedFlowTypes added in v0.249.0

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

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

func (*SendEmail) Execute added in v0.249.0

func (a *SendEmail) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute creates the email events

func (*SendEmail) Inspect added in v0.249.0

func (a *SendEmail) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SendEmail) LocalizationUUID added in v0.249.0

func (a *SendEmail) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SendEmail) Type added in v0.249.0

func (a *SendEmail) Type() string

Type returns the type of this action

func (*SendEmail) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SendEmail) Validate added in v0.249.0

func (a *SendEmail) Validate() error

Validate validates our action is valid

type SendMsg added in v0.249.0

type SendMsg struct {
	AllURNs           bool                      `json:"all_urns,omitempty"`
	Template          *assets.TemplateReference `json:"template,omitempty"`
	TemplateVariables []string                  `json:"template_variables,omitempty" engine:"localized,evaluated"`
	// contains filtered or unexported fields
}

SendMsg 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,
  "template": {
    "uuid": "3ce100b7-a734-4b4e-891b-350b1279ade2",
    "name": "revive_issue"
  },
  "template_variables": ["@contact.name"]
}

@action send_msg

func NewSendMsg added in v0.48.0

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

NewSendMsg creates a new send msg action

func (*SendMsg) AllowedFlowTypes added in v0.249.0

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

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

func (*SendMsg) Execute added in v0.249.0

func (a *SendMsg) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SendMsg) Inspect added in v0.249.0

func (a *SendMsg) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SendMsg) LocalizationUUID added in v0.249.0

func (a *SendMsg) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SendMsg) Type added in v0.249.0

func (a *SendMsg) Type() string

Type returns the type of this action

func (*SendMsg) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SendMsg) Validate added in v0.249.0

func (a *SendMsg) Validate() error

Validate validates our action is valid

type SetContactChannel added in v0.249.0

type SetContactChannel struct {
	Channel *assets.ChannelReference `json:"channel" validate:"omitempty"`
	// contains filtered or unexported fields
}

SetContactChannel 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 NewSetContactChannel added in v0.48.0

func NewSetContactChannel(uuid flows.ActionUUID, channel *assets.ChannelReference) *SetContactChannel

NewSetContactChannel creates a new set channel action

func (*SetContactChannel) AllowedFlowTypes added in v0.249.0

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

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

func (*SetContactChannel) Execute added in v0.249.0

func (a *SetContactChannel) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs our action

func (*SetContactChannel) Inspect added in v0.249.0

func (a *SetContactChannel) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SetContactChannel) LocalizationUUID added in v0.249.0

func (a *SetContactChannel) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SetContactChannel) Type added in v0.249.0

func (a *SetContactChannel) Type() string

Type returns the type of this action

func (*SetContactChannel) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SetContactChannel) Validate added in v0.249.0

func (a *SetContactChannel) Validate() error

Validate validates our action is valid

type SetContactField added in v0.249.0

type SetContactField struct {
	Field *assets.FieldReference `json:"field" validate:"required"`
	Value string                 `json:"value" engine:"evaluated"`
	// contains filtered or unexported fields
}

SetContactField 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 NewSetContactField added in v0.48.0

func NewSetContactField(uuid flows.ActionUUID, field *assets.FieldReference, value string) *SetContactField

NewSetContactField creates a new set channel action

func (*SetContactField) AllowedFlowTypes added in v0.249.0

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

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

func (*SetContactField) Execute added in v0.249.0

func (a *SetContactField) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SetContactField) Inspect added in v0.249.0

func (a *SetContactField) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SetContactField) LocalizationUUID added in v0.249.0

func (a *SetContactField) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SetContactField) Type added in v0.249.0

func (a *SetContactField) Type() string

Type returns the type of this action

func (*SetContactField) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SetContactField) Validate added in v0.249.0

func (a *SetContactField) Validate() error

Validate validates our action is valid

type SetContactLanguage added in v0.249.0

type SetContactLanguage struct {
	Language string `json:"language" engine:"evaluated"`
	// contains filtered or unexported fields
}

SetContactLanguage 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 NewSetContactLanguage added in v0.48.0

func NewSetContactLanguage(uuid flows.ActionUUID, language string) *SetContactLanguage

NewSetContactLanguage creates a new set language action

func (*SetContactLanguage) AllowedFlowTypes added in v0.249.0

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

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

func (*SetContactLanguage) Execute added in v0.249.0

func (a *SetContactLanguage) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SetContactLanguage) Inspect added in v0.249.0

func (a *SetContactLanguage) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SetContactLanguage) LocalizationUUID added in v0.249.0

func (a *SetContactLanguage) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SetContactLanguage) Type added in v0.249.0

func (a *SetContactLanguage) Type() string

Type returns the type of this action

func (*SetContactLanguage) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SetContactLanguage) Validate added in v0.249.0

func (a *SetContactLanguage) Validate() error

Validate validates our action is valid

type SetContactName added in v0.249.0

type SetContactName struct {
	Name string `json:"name" validate:"max=1000" engine:"evaluated"`
	// contains filtered or unexported fields
}

SetContactName 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 NewSetContactName added in v0.48.0

func NewSetContactName(uuid flows.ActionUUID, name string) *SetContactName

NewSetContactName creates a new set name action

func (*SetContactName) AllowedFlowTypes added in v0.249.0

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

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

func (*SetContactName) Execute added in v0.249.0

func (a *SetContactName) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SetContactName) Inspect added in v0.249.0

func (a *SetContactName) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SetContactName) LocalizationUUID added in v0.249.0

func (a *SetContactName) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SetContactName) Type added in v0.249.0

func (a *SetContactName) Type() string

Type returns the type of this action

func (*SetContactName) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SetContactName) Validate added in v0.249.0

func (a *SetContactName) Validate() error

Validate validates our action is valid

type SetContactStatus added in v0.249.0

type SetContactStatus struct {
	Status flows.ContactStatus `json:"status" validate:"contact_status"`
	// contains filtered or unexported fields
}

SetContactStatus can be used to update the status of the contact, e.g. to block or unblock the contact. A [event:contact_status_changed] event will be created with the corresponding value.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "set_contact_status",
  "status": "blocked"
}

@action set_contact_status

func NewSetContactStatus added in v0.96.0

func NewSetContactStatus(uuid flows.ActionUUID, status flows.ContactStatus) *SetContactStatus

NewSetContactStatus creates a new set status action

func (*SetContactStatus) AllowedFlowTypes added in v0.249.0

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

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

func (*SetContactStatus) Execute added in v0.249.0

func (a *SetContactStatus) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SetContactStatus) Inspect added in v0.249.0

func (a *SetContactStatus) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SetContactStatus) LocalizationUUID added in v0.249.0

func (a *SetContactStatus) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SetContactStatus) Type added in v0.249.0

func (a *SetContactStatus) Type() string

Type returns the type of this action

func (*SetContactStatus) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SetContactStatus) Validate added in v0.249.0

func (a *SetContactStatus) Validate() error

Validate validates our action is valid

type SetContactTimezone added in v0.249.0

type SetContactTimezone struct {
	Timezone string `json:"timezone" engine:"evaluated"`
	// contains filtered or unexported fields
}

SetContactTimezone 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 NewSetContactTimezone added in v0.48.0

func NewSetContactTimezone(uuid flows.ActionUUID, timezone string) *SetContactTimezone

NewSetContactTimezone creates a new set timezone action

func (*SetContactTimezone) AllowedFlowTypes added in v0.249.0

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

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

func (*SetContactTimezone) Execute added in v0.249.0

func (a *SetContactTimezone) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SetContactTimezone) Inspect added in v0.249.0

func (a *SetContactTimezone) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SetContactTimezone) LocalizationUUID added in v0.249.0

func (a *SetContactTimezone) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SetContactTimezone) Type added in v0.249.0

func (a *SetContactTimezone) Type() string

Type returns the type of this action

func (*SetContactTimezone) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SetContactTimezone) Validate added in v0.249.0

func (a *SetContactTimezone) Validate() error

Validate validates our action is valid

type SetRunLocal added in v0.249.0

type SetRunLocal struct {
	Local     string         `json:"local"                              validate:"required,local_ref"`
	Value     string         `json:"value,omitempty" engine:"evaluated" validate:"max=1000"`
	Operation LocalOperation `json:"operation"                          validate:"required,eq=set|eq=increment|eq=clear"`
	// contains filtered or unexported fields
}

SetRunLocal can be used to save a local variable. The local will be available in the context for the run as @locals.[local]. The value field can be a template and will be evaluated.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "set_run_local",
  "local": "my_var",
  "value": "1",
  "operation": "increment"
}

@action set_run_local

func NewSetRunLocal added in v0.235.0

func NewSetRunLocal(uuid flows.ActionUUID, local, value string) *SetRunLocal

NewSetRunLocal creates a new set run local action

func (*SetRunLocal) AllowedFlowTypes added in v0.249.0

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

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

func (*SetRunLocal) Execute added in v0.249.0

func (a *SetRunLocal) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SetRunLocal) Inspect added in v0.249.0

func (a *SetRunLocal) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SetRunLocal) LocalizationUUID added in v0.249.0

func (a *SetRunLocal) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SetRunLocal) Type added in v0.249.0

func (a *SetRunLocal) Type() string

Type returns the type of this action

func (*SetRunLocal) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SetRunLocal) Validate added in v0.249.0

func (a *SetRunLocal) Validate() error

Validate validates our action is valid

type SetRunResult added in v0.249.0

type SetRunResult struct {
	Name     string `json:"name"                                  validate:"required,result_name"`
	Value    string `json:"value"              engine:"evaluated"`
	Category string `json:"category,omitempty" engine:"localized" validate:"omitempty,result_category"`
	// contains filtered or unexported fields
}

SetRunResult 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 NewSetRunResult added in v0.48.0

func NewSetRunResult(uuid flows.ActionUUID, name string, value string, category string) *SetRunResult

NewSetRunResult creates a new set run result action

func (*SetRunResult) AllowedFlowTypes added in v0.249.0

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

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

func (*SetRunResult) Execute added in v0.249.0

func (a *SetRunResult) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs this action

func (*SetRunResult) Inspect added in v0.249.0

func (a *SetRunResult) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*SetRunResult) LocalizationUUID added in v0.249.0

func (a *SetRunResult) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*SetRunResult) Type added in v0.249.0

func (a *SetRunResult) Type() string

Type returns the type of this action

func (*SetRunResult) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*SetRunResult) Validate added in v0.249.0

func (a *SetRunResult) Validate() error

Validate validates our action is valid

type StartSession added in v0.249.0

type StartSession struct {
	Flow          *assets.FlowReference `json:"flow" validate:"required"`
	Exclusions    events.Exclusions     `json:"exclusions"`
	CreateContact bool                  `json:"create_contact,omitempty"`
	// contains filtered or unexported fields
}

StartSession 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"}
  ],
  "exclusions": {"in_a_flow": true}
}

@action start_session

func NewStartSession added in v0.48.0

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

NewStartSession creates a new start session action

func (*StartSession) AllowedFlowTypes added in v0.249.0

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

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

func (*StartSession) Execute added in v0.249.0

func (a *StartSession) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute runs our action

func (*StartSession) Inspect added in v0.249.0

func (a *StartSession) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*StartSession) LocalizationUUID added in v0.249.0

func (a *StartSession) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*StartSession) Type added in v0.249.0

func (a *StartSession) Type() string

Type returns the type of this action

func (*StartSession) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*StartSession) Validate added in v0.249.0

func (a *StartSession) Validate() error

Validate validates our action is valid

type TransferAirtime added in v0.249.0

type TransferAirtime struct {
	Amounts map[string]decimal.Decimal `json:"amounts" validate:"required"`
	// contains filtered or unexported fields
}

TransferAirtime attempts to make an airtime transfer to the contact.

An [event:airtime_transferred] event will be created if the airtime could be sent.

{
  "uuid": "8eebd020-1af5-431c-b943-aa670fc74da9",
  "type": "transfer_airtime",
  "amounts": {"RWF": 500, "USD": 0.5}
}

@action transfer_airtime

func NewTransferAirtime added in v0.48.0

func NewTransferAirtime(uuid flows.ActionUUID, amounts map[string]decimal.Decimal) *TransferAirtime

NewTransferAirtime creates a new airtime transfer action

func (*TransferAirtime) AllowedFlowTypes added in v0.249.0

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

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

func (*TransferAirtime) Execute added in v0.249.0

func (a *TransferAirtime) Execute(ctx context.Context, run flows.Run, step flows.Step, log flows.EventLogger) error

Execute executes the transfer action

func (*TransferAirtime) Inspect added in v0.249.0

func (a *TransferAirtime) Inspect(dependency func(assets.Reference), local func(string), result func(*flows.ResultInfo))

func (*TransferAirtime) LocalizationUUID added in v0.249.0

func (a *TransferAirtime) LocalizationUUID() uuids.UUID

LocalizationUUID gets the UUID which identifies this object for localization

func (*TransferAirtime) Type added in v0.249.0

func (a *TransferAirtime) Type() string

Type returns the type of this action

func (*TransferAirtime) UUID added in v0.249.0

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

UUID returns the UUID of the action

func (*TransferAirtime) Validate added in v0.249.0

func (a *TransferAirtime) Validate() error

Validate validates our action is valid

Jump to

Keyboard shortcuts

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