events

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: May 3, 2018 License: AGPL-3.0 Imports: 7 Imported by: 16

Documentation

Index

Constants

View Source
const TypeBroadcastCreated string = "broadcast_created"

TypeBroadcastCreated is a constant for outgoing message events

View Source
const TypeContactChanged string = "contact_changed"

TypeContactChanged is the type of our set contact event

View Source
const TypeContactChannelChanged string = "contact_channel_changed"

TypeContactChannelChanged is the type of our set preferred channel event

View Source
const TypeContactFieldChanged string = "contact_field_changed"

TypeContactFieldChanged is the type of our save to contact event

View Source
const TypeContactGroupsAdded string = "contact_groups_added"

TypeContactGroupsAdded is the type of our add to group action

View Source
const TypeContactGroupsRemoved string = "contact_groups_removed"

TypeContactGroupsRemoved is the type fo our remove from group action

View Source
const TypeContactPropertyChanged string = "contact_property_changed"

TypeContactPropertyChanged is the type of our update contact event

View Source
const TypeContactURNAdded string = "contact_urn_added"

TypeContactURNAdded is the type of our add URN event

View Source
const TypeEmailCreated string = "email_created"

TypeEmailCreated is our type for the email event

View Source
const TypeEnvironmentChanged string = "environment_changed"

TypeEnvironmentChanged is the type of our environment changed event

View Source
const TypeError string = "error"

TypeError is the type of our error events

View Source
const TypeFlowTriggered string = "flow_triggered"

TypeFlowTriggered is the type of our flow triggered event

View Source
const TypeInputLabelsAdded string = "input_labels_added"

TypeInputLabelsAdded is the type of our add label action

View Source
const TypeMsgCreated string = "msg_created"

TypeMsgCreated is a constant for incoming messages

View Source
const TypeMsgReceived string = "msg_received"

TypeMsgReceived is a constant for incoming messages

View Source
const TypeMsgWait string = "msg_wait"

TypeMsgWait is the type of our msg wait event

View Source
const TypeNothingWait string = "nothing_wait"

TypeNothingWait is the type of our nothing wait event

View Source
const TypeRunExpired string = "run_expired"

TypeRunExpired is the type of our flow expired event

View Source
const TypeRunResultChanged string = "run_result_changed"

TypeRunResultChanged is the type of our run result event

View Source
const TypeSessionTriggered string = "session_triggered"

TypeSessionTriggered is the type of our session triggered event

View Source
const TypeWebhookCalled string = "webhook_called"

TypeWebhookCalled is the type for our webhook events

Variables

This section is empty.

Functions

func EventFromEnvelope

func EventFromEnvelope(envelope *utils.TypedEnvelope) (flows.Event, error)

EventFromEnvelope reads a single event from the given envelope

func EventsToEnvelopes added in v0.7.0

func EventsToEnvelopes(events []flows.Event) ([]*utils.TypedEnvelope, error)

EventsToEnvelopes converts the given events to typed envelopes

func ReadEvents added in v0.4.0

func ReadEvents(envelopes []*utils.TypedEnvelope) ([]flows.Event, error)

ReadEvents reads the events from the given envelopes

Types

type BroadcastCreatedEvent added in v0.5.0

type BroadcastCreatedEvent struct {
	Translations map[utils.Language]*BroadcastTranslation `json:"translations,min=1" validate:"dive"`
	BaseLanguage utils.Language                           `json:"base_language" validate:"required"`
	URNs         []urns.URN                               `json:"urns,omitempty" validate:"dive,urn"`
	Contacts     []*flows.ContactReference                `json:"contacts,omitempty" validate:"dive"`
	Groups       []*flows.GroupReference                  `json:"groups,omitempty" validate:"dive"`
	// contains filtered or unexported fields
}

BroadcastCreatedEvent events are created for outgoing broadcasts.

{
  "type": "broadcast_created",
  "created_on": "2006-01-02T15:04:05Z",
  "translations": {
    "eng": {
      "text": "hi, what's up",
      "attachments": [],
      "quick_replies": ["All good", "Got 99 problems"]
    },
    "spa": {
      "text": "Que pasa",
      "attachments": [],
      "quick_replies": ["Todo bien", "Tengo 99 problemas"]
    }
  },
  "base_language": "eng",
  "urns": ["tel:+12065551212"],
  "contacts": [{"uuid": "0e06f977-cbb7-475f-9d0b-a0c4aaec7f6a", "name": "Bob"}]
}

@event broadcast_created

func NewBroadcastCreatedEvent added in v0.5.0

func NewBroadcastCreatedEvent(translations map[utils.Language]*BroadcastTranslation, baseLanguage utils.Language, urns []urns.URN, contacts []*flows.ContactReference, groups []*flows.GroupReference) *BroadcastCreatedEvent

NewBroadcastCreatedEvent creates a new outgoing msg event for the given recipients

func (*BroadcastCreatedEvent) AllowedOrigin added in v0.6.0

func (e *BroadcastCreatedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*BroadcastCreatedEvent) Apply added in v0.5.0

func (e *BroadcastCreatedEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*BroadcastCreatedEvent) CreatedOn added in v0.6.2

func (e *BroadcastCreatedEvent) CreatedOn() time.Time

func (*BroadcastCreatedEvent) FromCaller added in v0.6.2

func (e *BroadcastCreatedEvent) FromCaller() bool

func (*BroadcastCreatedEvent) SetCreatedOn added in v0.6.2

func (e *BroadcastCreatedEvent) SetCreatedOn(time time.Time)

func (*BroadcastCreatedEvent) SetFromCaller added in v0.6.2

func (e *BroadcastCreatedEvent) SetFromCaller(fromCaller bool)

func (*BroadcastCreatedEvent) SetStepUUID added in v0.7.0

func (e *BroadcastCreatedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*BroadcastCreatedEvent) StepUUID added in v0.7.0

func (e *BroadcastCreatedEvent) StepUUID() flows.StepUUID

func (*BroadcastCreatedEvent) Type added in v0.5.0

func (e *BroadcastCreatedEvent) Type() string

Type returns the type of this event

func (*BroadcastCreatedEvent) Validate added in v0.6.0

func (e *BroadcastCreatedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs. We assume engine generated events are valid.

type BroadcastTranslation added in v0.6.1

type BroadcastTranslation struct {
	Text         string             `json:"text"`
	Attachments  []flows.Attachment `json:"attachments,omitempty"`
	QuickReplies []string           `json:"quick_replies,omitempty"`
}

BroadcastTranslation is the broadcast content in a particular language

type ContactChangedEvent added in v0.5.0

type ContactChangedEvent struct {
	Contact json.RawMessage `json:"contact"`
	// contains filtered or unexported fields
}

ContactChangedEvent events are created to set a contact on a session

{
  "type": "contact_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "contact": {
    "uuid": "0e06f977-cbb7-475f-9d0b-a0c4aaec7f6a",
    "name": "Bob",
    "urns": ["tel:+11231234567"]
  }
}

@event contact_changed

func (*ContactChangedEvent) AllowedOrigin added in v0.6.0

func (e *ContactChangedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*ContactChangedEvent) Apply added in v0.5.0

func (e *ContactChangedEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*ContactChangedEvent) CreatedOn added in v0.6.2

func (e *ContactChangedEvent) CreatedOn() time.Time

func (*ContactChangedEvent) FromCaller added in v0.6.2

func (e *ContactChangedEvent) FromCaller() bool

func (*ContactChangedEvent) SetCreatedOn added in v0.6.2

func (e *ContactChangedEvent) SetCreatedOn(time time.Time)

func (*ContactChangedEvent) SetFromCaller added in v0.6.2

func (e *ContactChangedEvent) SetFromCaller(fromCaller bool)

func (*ContactChangedEvent) SetStepUUID added in v0.7.0

func (e *ContactChangedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*ContactChangedEvent) StepUUID added in v0.7.0

func (e *ContactChangedEvent) StepUUID() flows.StepUUID

func (*ContactChangedEvent) Type added in v0.5.0

func (e *ContactChangedEvent) Type() string

Type returns the type of this event

func (*ContactChangedEvent) Validate added in v0.6.0

func (e *ContactChangedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type ContactChannelChangedEvent added in v0.5.0

type ContactChannelChangedEvent struct {
	Channel *flows.ChannelReference `json:"channel" validate:"required"`
	// contains filtered or unexported fields
}

ContactChannelChangedEvent events are created when a contact's preferred channel is changed.

{
  "type": "contact_channel_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "channel": {"uuid": "67a3ac69-e5e0-4ef0-8423-eddf71a71472", "name": "Twilio"}
}

@event contact_channel_changed

func NewContactChannelChangedEvent added in v0.5.0

func NewContactChannelChangedEvent(channel *flows.ChannelReference) *ContactChannelChangedEvent

NewContactChannelChangedEvent returns a new preferred channel event

func (*ContactChannelChangedEvent) AllowedOrigin added in v0.6.0

func (e *ContactChannelChangedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*ContactChannelChangedEvent) Apply added in v0.5.0

Apply applies this event to the given run

func (*ContactChannelChangedEvent) CreatedOn added in v0.6.2

func (e *ContactChannelChangedEvent) CreatedOn() time.Time

func (*ContactChannelChangedEvent) FromCaller added in v0.6.2

func (e *ContactChannelChangedEvent) FromCaller() bool

func (*ContactChannelChangedEvent) SetCreatedOn added in v0.6.2

func (e *ContactChannelChangedEvent) SetCreatedOn(time time.Time)

func (*ContactChannelChangedEvent) SetFromCaller added in v0.6.2

func (e *ContactChannelChangedEvent) SetFromCaller(fromCaller bool)

func (*ContactChannelChangedEvent) SetStepUUID added in v0.7.0

func (e *ContactChannelChangedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*ContactChannelChangedEvent) StepUUID added in v0.7.0

func (e *ContactChannelChangedEvent) StepUUID() flows.StepUUID

func (*ContactChannelChangedEvent) Type added in v0.5.0

Type returns the type of this event

func (*ContactChannelChangedEvent) Validate added in v0.6.0

Validate validates our event is valid and has all the assets it needs

type ContactFieldChangedEvent added in v0.5.0

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

ContactFieldChangedEvent events are created when a contact field is updated.

{
  "type": "contact_field_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "field": {"key": "gender", "name": "Gender"},
  "value": "Male"
}

@event contact_field_changed

func NewContactFieldChangedEvent added in v0.5.0

func NewContactFieldChangedEvent(field *flows.FieldReference, value string) *ContactFieldChangedEvent

NewContactFieldChangedEvent returns a new save to contact event

func (*ContactFieldChangedEvent) AllowedOrigin added in v0.6.0

func (e *ContactFieldChangedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*ContactFieldChangedEvent) Apply added in v0.5.0

Apply applies this event to the given run

func (*ContactFieldChangedEvent) CreatedOn added in v0.6.2

func (e *ContactFieldChangedEvent) CreatedOn() time.Time

func (*ContactFieldChangedEvent) FromCaller added in v0.6.2

func (e *ContactFieldChangedEvent) FromCaller() bool

func (*ContactFieldChangedEvent) SetCreatedOn added in v0.6.2

func (e *ContactFieldChangedEvent) SetCreatedOn(time time.Time)

func (*ContactFieldChangedEvent) SetFromCaller added in v0.6.2

func (e *ContactFieldChangedEvent) SetFromCaller(fromCaller bool)

func (*ContactFieldChangedEvent) SetStepUUID added in v0.7.0

func (e *ContactFieldChangedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*ContactFieldChangedEvent) StepUUID added in v0.7.0

func (e *ContactFieldChangedEvent) StepUUID() flows.StepUUID

func (*ContactFieldChangedEvent) Type added in v0.5.0

func (e *ContactFieldChangedEvent) Type() string

Type returns the type of this event

func (*ContactFieldChangedEvent) Validate added in v0.6.0

func (e *ContactFieldChangedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type ContactGroupsAddedEvent added in v0.5.0

type ContactGroupsAddedEvent struct {
	Groups []*flows.GroupReference `json:"groups" validate:"required,min=1,dive"`
	// contains filtered or unexported fields
}

ContactGroupsAddedEvent events will be created with the groups a contact was added to.

{
  "type": "contact_groups_added",
  "created_on": "2006-01-02T15:04:05Z",
  "groups": [{"uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d", "name": "Reporters"}]
}

@event contact_groups_added

func NewContactGroupsAddedEvent added in v0.5.0

func NewContactGroupsAddedEvent(groups []*flows.GroupReference) *ContactGroupsAddedEvent

NewContactGroupsAddedEvent returns a new contact_groups_added event

func (*ContactGroupsAddedEvent) AllowedOrigin added in v0.6.0

func (e *ContactGroupsAddedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*ContactGroupsAddedEvent) Apply added in v0.5.0

Apply applies this event to the given run

func (*ContactGroupsAddedEvent) CreatedOn added in v0.6.2

func (e *ContactGroupsAddedEvent) CreatedOn() time.Time

func (*ContactGroupsAddedEvent) FromCaller added in v0.6.2

func (e *ContactGroupsAddedEvent) FromCaller() bool

func (*ContactGroupsAddedEvent) SetCreatedOn added in v0.6.2

func (e *ContactGroupsAddedEvent) SetCreatedOn(time time.Time)

func (*ContactGroupsAddedEvent) SetFromCaller added in v0.6.2

func (e *ContactGroupsAddedEvent) SetFromCaller(fromCaller bool)

func (*ContactGroupsAddedEvent) SetStepUUID added in v0.7.0

func (e *ContactGroupsAddedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*ContactGroupsAddedEvent) StepUUID added in v0.7.0

func (e *ContactGroupsAddedEvent) StepUUID() flows.StepUUID

func (*ContactGroupsAddedEvent) Type added in v0.5.0

func (e *ContactGroupsAddedEvent) Type() string

Type returns the type of this event

func (*ContactGroupsAddedEvent) Validate added in v0.6.0

func (e *ContactGroupsAddedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type ContactGroupsRemovedEvent added in v0.5.0

type ContactGroupsRemovedEvent struct {
	Groups []*flows.GroupReference `json:"groups" validate:"required,min=1,dive"`
	// contains filtered or unexported fields
}

ContactGroupsRemovedEvent events are created when a contact has been removed from one or more groups.

{
  "type": "contact_groups_removed",
  "created_on": "2006-01-02T15:04:05Z",
  "groups": [{"uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d", "name": "Reporters"}]
}

@event contact_groups_removed

func NewContactGroupsRemovedEvent added in v0.5.0

func NewContactGroupsRemovedEvent(groups []*flows.GroupReference) *ContactGroupsRemovedEvent

NewContactGroupsRemovedEvent returns a new remove from group event

func (*ContactGroupsRemovedEvent) AllowedOrigin added in v0.6.0

func (e *ContactGroupsRemovedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*ContactGroupsRemovedEvent) Apply added in v0.5.0

Apply applies this event to the given run

func (*ContactGroupsRemovedEvent) CreatedOn added in v0.6.2

func (e *ContactGroupsRemovedEvent) CreatedOn() time.Time

func (*ContactGroupsRemovedEvent) FromCaller added in v0.6.2

func (e *ContactGroupsRemovedEvent) FromCaller() bool

func (*ContactGroupsRemovedEvent) SetCreatedOn added in v0.6.2

func (e *ContactGroupsRemovedEvent) SetCreatedOn(time time.Time)

func (*ContactGroupsRemovedEvent) SetFromCaller added in v0.6.2

func (e *ContactGroupsRemovedEvent) SetFromCaller(fromCaller bool)

func (*ContactGroupsRemovedEvent) SetStepUUID added in v0.7.0

func (e *ContactGroupsRemovedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*ContactGroupsRemovedEvent) StepUUID added in v0.7.0

func (e *ContactGroupsRemovedEvent) StepUUID() flows.StepUUID

func (*ContactGroupsRemovedEvent) Type added in v0.5.0

Type returns the type of this event

func (*ContactGroupsRemovedEvent) Validate added in v0.6.0

func (e *ContactGroupsRemovedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type ContactPropertyChangedEvent added in v0.5.0

type ContactPropertyChangedEvent struct {
	Property string `json:"property" validate:"required,eq=name|eq=language"`
	Value    string `json:"value"`
	// contains filtered or unexported fields
}

ContactPropertyChangedEvent events are created when a property of a contact has been changed

{
  "type": "contact_property_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "property": "language",
  "value": "eng"
}

@event contact_property_changed

func NewContactPropertyChangedEvent added in v0.5.0

func NewContactPropertyChangedEvent(property string, value string) *ContactPropertyChangedEvent

NewContactPropertyChangedEvent returns a new contact property changed event

func (*ContactPropertyChangedEvent) AllowedOrigin added in v0.6.0

func (e *ContactPropertyChangedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*ContactPropertyChangedEvent) Apply added in v0.5.0

Apply applies this event to the given run

func (*ContactPropertyChangedEvent) CreatedOn added in v0.6.2

func (e *ContactPropertyChangedEvent) CreatedOn() time.Time

func (*ContactPropertyChangedEvent) FromCaller added in v0.6.2

func (e *ContactPropertyChangedEvent) FromCaller() bool

func (*ContactPropertyChangedEvent) SetCreatedOn added in v0.6.2

func (e *ContactPropertyChangedEvent) SetCreatedOn(time time.Time)

func (*ContactPropertyChangedEvent) SetFromCaller added in v0.6.2

func (e *ContactPropertyChangedEvent) SetFromCaller(fromCaller bool)

func (*ContactPropertyChangedEvent) SetStepUUID added in v0.7.0

func (e *ContactPropertyChangedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*ContactPropertyChangedEvent) StepUUID added in v0.7.0

func (e *ContactPropertyChangedEvent) StepUUID() flows.StepUUID

func (*ContactPropertyChangedEvent) Type added in v0.5.0

Type returns the type of this event

func (*ContactPropertyChangedEvent) Validate added in v0.6.0

Validate validates our event is valid and has all the assets it needs

type ContactURNAddedEvent added in v0.5.0

type ContactURNAddedEvent struct {
	URN urns.URN `json:"urn" validate:"urn"`
	// contains filtered or unexported fields
}

ContactURNAddedEvent events will be created with the URN that should be added to the current contact.

{
  "type": "contact_urn_added",
  "created_on": "2006-01-02T15:04:05Z",
  "urn": "tel:+12345678900"
}

@event contact_urn_added

func NewURNAddedEvent added in v0.5.0

func NewURNAddedEvent(urn urns.URN) *ContactURNAddedEvent

NewURNAddedEvent returns a new add URN event

func (*ContactURNAddedEvent) AllowedOrigin added in v0.6.0

func (e *ContactURNAddedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*ContactURNAddedEvent) Apply added in v0.5.0

func (e *ContactURNAddedEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*ContactURNAddedEvent) CreatedOn added in v0.6.2

func (e *ContactURNAddedEvent) CreatedOn() time.Time

func (*ContactURNAddedEvent) FromCaller added in v0.6.2

func (e *ContactURNAddedEvent) FromCaller() bool

func (*ContactURNAddedEvent) SetCreatedOn added in v0.6.2

func (e *ContactURNAddedEvent) SetCreatedOn(time time.Time)

func (*ContactURNAddedEvent) SetFromCaller added in v0.6.2

func (e *ContactURNAddedEvent) SetFromCaller(fromCaller bool)

func (*ContactURNAddedEvent) SetStepUUID added in v0.7.0

func (e *ContactURNAddedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*ContactURNAddedEvent) StepUUID added in v0.7.0

func (e *ContactURNAddedEvent) StepUUID() flows.StepUUID

func (*ContactURNAddedEvent) Type added in v0.5.0

func (e *ContactURNAddedEvent) Type() string

Type returns the type of this event

func (*ContactURNAddedEvent) Validate added in v0.6.0

func (e *ContactURNAddedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type EmailCreatedEvent added in v0.5.0

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

EmailCreatedEvent events are created for each recipient which should receive an email.

{
  "type": "email_created",
  "created_on": "2006-01-02T15:04:05Z",
  "addresses": ["foo@bar.com"],
  "subject": "Your activation token",
  "body": "Your activation token is AAFFKKEE"
}

@event email_created

func NewEmailCreatedEvent added in v0.5.0

func NewEmailCreatedEvent(addresses []string, subject string, body string) *EmailCreatedEvent

NewEmailCreatedEvent returns a new email event with the passed in subject, body and emails

func (*EmailCreatedEvent) AllowedOrigin added in v0.6.0

func (e *EmailCreatedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*EmailCreatedEvent) Apply added in v0.5.0

func (e *EmailCreatedEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*EmailCreatedEvent) CreatedOn added in v0.6.2

func (e *EmailCreatedEvent) CreatedOn() time.Time

func (*EmailCreatedEvent) FromCaller added in v0.6.2

func (e *EmailCreatedEvent) FromCaller() bool

func (*EmailCreatedEvent) SetCreatedOn added in v0.6.2

func (e *EmailCreatedEvent) SetCreatedOn(time time.Time)

func (*EmailCreatedEvent) SetFromCaller added in v0.6.2

func (e *EmailCreatedEvent) SetFromCaller(fromCaller bool)

func (*EmailCreatedEvent) SetStepUUID added in v0.7.0

func (e *EmailCreatedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*EmailCreatedEvent) StepUUID added in v0.7.0

func (e *EmailCreatedEvent) StepUUID() flows.StepUUID

func (*EmailCreatedEvent) Type added in v0.5.0

func (e *EmailCreatedEvent) Type() string

Type returns the type of this event

func (*EmailCreatedEvent) Validate added in v0.6.0

func (e *EmailCreatedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type EnvironmentChangedEvent added in v0.5.0

type EnvironmentChangedEvent struct {
	Environment json.RawMessage `json:"environment"`
	// contains filtered or unexported fields
}

EnvironmentChangedEvent events are created to set the environment on a session

{
  "type": "environment_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "environment": {
    "date_format": "YYYY-MM-DD",
    "time_format": "hh:mm",
    "timezone": "Africa/Kigali",
    "languages": ["eng", "fra"]
  }
}

@event environment_changed

func (*EnvironmentChangedEvent) AllowedOrigin added in v0.6.0

func (e *EnvironmentChangedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*EnvironmentChangedEvent) Apply added in v0.5.0

Apply applies this event to the given run

func (*EnvironmentChangedEvent) CreatedOn added in v0.6.2

func (e *EnvironmentChangedEvent) CreatedOn() time.Time

func (*EnvironmentChangedEvent) FromCaller added in v0.6.2

func (e *EnvironmentChangedEvent) FromCaller() bool

func (*EnvironmentChangedEvent) SetCreatedOn added in v0.6.2

func (e *EnvironmentChangedEvent) SetCreatedOn(time time.Time)

func (*EnvironmentChangedEvent) SetFromCaller added in v0.6.2

func (e *EnvironmentChangedEvent) SetFromCaller(fromCaller bool)

func (*EnvironmentChangedEvent) SetStepUUID added in v0.7.0

func (e *EnvironmentChangedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*EnvironmentChangedEvent) StepUUID added in v0.7.0

func (e *EnvironmentChangedEvent) StepUUID() flows.StepUUID

func (*EnvironmentChangedEvent) Type added in v0.5.0

func (e *EnvironmentChangedEvent) Type() string

Type returns the type of this event

func (*EnvironmentChangedEvent) Validate added in v0.6.0

func (e *EnvironmentChangedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type ErrorEvent

type ErrorEvent struct {
	Text  string `json:"text" validate:"required"`
	Fatal bool   `json:"fatal"`
	// contains filtered or unexported fields
}

ErrorEvent events will be created whenever an error is encountered during flow execution. This can vary from template evaluation errors to invalid actions.

{
  "type": "error",
  "created_on": "2006-01-02T15:04:05Z",
  "text": "invalid date format: '12th of October'"
}

@event error

func NewErrorEvent

func NewErrorEvent(err error) *ErrorEvent

NewErrorEvent returns a new error event for the passed in error

func NewFatalErrorEvent added in v0.4.0

func NewFatalErrorEvent(err error) *ErrorEvent

NewFatalErrorEvent returns a new fatal error event for the passed in error

func (*ErrorEvent) AllowedOrigin added in v0.6.0

func (e *ErrorEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*ErrorEvent) Apply added in v0.4.0

func (e *ErrorEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*ErrorEvent) CreatedOn added in v0.6.2

func (e *ErrorEvent) CreatedOn() time.Time

func (*ErrorEvent) FromCaller added in v0.6.2

func (e *ErrorEvent) FromCaller() bool

func (*ErrorEvent) SetCreatedOn added in v0.6.2

func (e *ErrorEvent) SetCreatedOn(time time.Time)

func (*ErrorEvent) SetFromCaller added in v0.6.2

func (e *ErrorEvent) SetFromCaller(fromCaller bool)

func (*ErrorEvent) SetStepUUID added in v0.7.0

func (e *ErrorEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*ErrorEvent) StepUUID added in v0.7.0

func (e *ErrorEvent) StepUUID() flows.StepUUID

func (*ErrorEvent) Type

func (e *ErrorEvent) Type() string

Type returns the type of this event

func (*ErrorEvent) Validate added in v0.6.0

func (e *ErrorEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type FlowTriggeredEvent added in v0.4.0

type FlowTriggeredEvent struct {
	Flow          *flows.FlowReference `json:"flow" validate:"required"`
	ParentRunUUID flows.RunUUID        `json:"parent_run_uuid" validate:"omitempty,uuid4"`
	// contains filtered or unexported fields
}

FlowTriggeredEvent events are created when an action wants to start a subflow

{
  "type": "flow_triggered",
  "created_on": "2006-01-02T15:04:05Z",
  "flow": {"uuid": "0e06f977-cbb7-475f-9d0b-a0c4aaec7f6a", "name": "Registration"},
  "parent_run_uuid": "95eb96df-461b-4668-b168-727f8ceb13dd"
}

@event flow_triggered

func NewFlowTriggeredEvent added in v0.4.0

func NewFlowTriggeredEvent(flow *flows.FlowReference, parentRunUUID flows.RunUUID) *FlowTriggeredEvent

NewFlowTriggeredEvent returns a new flow triggered event for the passed in flow and parent run

func (*FlowTriggeredEvent) AllowedOrigin added in v0.6.0

func (e *FlowTriggeredEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*FlowTriggeredEvent) Apply added in v0.4.0

func (e *FlowTriggeredEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*FlowTriggeredEvent) CreatedOn added in v0.6.2

func (e *FlowTriggeredEvent) CreatedOn() time.Time

func (*FlowTriggeredEvent) FromCaller added in v0.6.2

func (e *FlowTriggeredEvent) FromCaller() bool

func (*FlowTriggeredEvent) SetCreatedOn added in v0.6.2

func (e *FlowTriggeredEvent) SetCreatedOn(time time.Time)

func (*FlowTriggeredEvent) SetFromCaller added in v0.6.2

func (e *FlowTriggeredEvent) SetFromCaller(fromCaller bool)

func (*FlowTriggeredEvent) SetStepUUID added in v0.7.0

func (e *FlowTriggeredEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*FlowTriggeredEvent) StepUUID added in v0.7.0

func (e *FlowTriggeredEvent) StepUUID() flows.StepUUID

func (*FlowTriggeredEvent) Type added in v0.4.0

func (e *FlowTriggeredEvent) Type() string

Type returns the type of this event

func (*FlowTriggeredEvent) Validate added in v0.6.0

func (e *FlowTriggeredEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs. We assume engine generated events are valid.

type InputLabelsAddedEvent added in v0.5.0

type InputLabelsAddedEvent struct {
	InputUUID flows.InputUUID         `json:"input_uuid" validate:"required,uuid4"`
	Labels    []*flows.LabelReference `json:"labels" validate:"required,min=1,dive"`
	// contains filtered or unexported fields
}

InputLabelsAddedEvent events will be created with the labels that were applied to the given input.

{
  "type": "input_labels_added",
  "created_on": "2006-01-02T15:04:05Z",
  "input_uuid": "4aef4050-1895-4c80-999a-70368317a4f5",
  "labels": [{"uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d", "name": "Spam"}]
}

@event input_labels_added

func NewInputLabelsAddedEvent added in v0.5.0

func NewInputLabelsAddedEvent(inputUUID flows.InputUUID, labels []*flows.LabelReference) *InputLabelsAddedEvent

NewInputLabelsAddedEvent returns a new add to group event

func (*InputLabelsAddedEvent) AllowedOrigin added in v0.6.0

func (e *InputLabelsAddedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*InputLabelsAddedEvent) Apply added in v0.5.0

func (e *InputLabelsAddedEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*InputLabelsAddedEvent) CreatedOn added in v0.6.2

func (e *InputLabelsAddedEvent) CreatedOn() time.Time

func (*InputLabelsAddedEvent) FromCaller added in v0.6.2

func (e *InputLabelsAddedEvent) FromCaller() bool

func (*InputLabelsAddedEvent) SetCreatedOn added in v0.6.2

func (e *InputLabelsAddedEvent) SetCreatedOn(time time.Time)

func (*InputLabelsAddedEvent) SetFromCaller added in v0.6.2

func (e *InputLabelsAddedEvent) SetFromCaller(fromCaller bool)

func (*InputLabelsAddedEvent) SetStepUUID added in v0.7.0

func (e *InputLabelsAddedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*InputLabelsAddedEvent) StepUUID added in v0.7.0

func (e *InputLabelsAddedEvent) StepUUID() flows.StepUUID

func (*InputLabelsAddedEvent) Type added in v0.5.0

func (e *InputLabelsAddedEvent) Type() string

Type returns the type of this event

func (*InputLabelsAddedEvent) Validate added in v0.6.0

func (e *InputLabelsAddedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type MsgCreatedEvent added in v0.6.0

type MsgCreatedEvent struct {
	Msg flows.MsgOut `json:"msg" validate:"required,dive"`
	// contains filtered or unexported fields
}

MsgCreatedEvent events are used for replies to the session contact.

{
  "type": "msg_created",
  "created_on": "2006-01-02T15:04:05Z",
  "msg": {
    "uuid": "2d611e17-fb22-457f-b802-b8f7ec5cda5b",
    "channel": {"uuid": "61602f3e-f603-4c70-8a8f-c477505bf4bf", "name": "Twilio"},
    "urn": "tel:+12065551212",
    "text": "hi there",
    "attachments": ["https://s3.amazon.com/mybucket/attachment.jpg"]
  }
}

@event msg_created

func NewMsgCreatedEvent added in v0.5.0

func NewMsgCreatedEvent(msg *flows.MsgOut) *MsgCreatedEvent

NewMsgCreatedEvent creates a new outgoing msg event to a single contact

func (*MsgCreatedEvent) AllowedOrigin added in v0.6.0

func (e *MsgCreatedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*MsgCreatedEvent) Apply added in v0.6.0

func (e *MsgCreatedEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*MsgCreatedEvent) CreatedOn added in v0.6.2

func (e *MsgCreatedEvent) CreatedOn() time.Time

func (*MsgCreatedEvent) FromCaller added in v0.6.2

func (e *MsgCreatedEvent) FromCaller() bool

func (*MsgCreatedEvent) SetCreatedOn added in v0.6.2

func (e *MsgCreatedEvent) SetCreatedOn(time time.Time)

func (*MsgCreatedEvent) SetFromCaller added in v0.6.2

func (e *MsgCreatedEvent) SetFromCaller(fromCaller bool)

func (*MsgCreatedEvent) SetStepUUID added in v0.7.0

func (e *MsgCreatedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*MsgCreatedEvent) StepUUID added in v0.7.0

func (e *MsgCreatedEvent) StepUUID() flows.StepUUID

func (*MsgCreatedEvent) Type added in v0.6.0

func (e *MsgCreatedEvent) Type() string

Type returns the type of this event

func (*MsgCreatedEvent) Validate added in v0.6.0

func (e *MsgCreatedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs. We assume engine generated events are valid.

type MsgReceivedEvent

type MsgReceivedEvent struct {
	Msg flows.MsgIn `json:"msg" validate:"required,dive"`
	// contains filtered or unexported fields
}

MsgReceivedEvent events are used for starting flows or resuming flows which are waiting for a message. They represent an incoming message for a contact.

{
  "type": "msg_received",
  "created_on": "2006-01-02T15:04:05Z",
  "msg": {
    "uuid": "2d611e17-fb22-457f-b802-b8f7ec5cda5b",
    "channel": {"uuid": "61602f3e-f603-4c70-8a8f-c477505bf4bf", "name": "Twilio"},
    "urn": "tel:+12065551212",
    "text": "hi there",
    "attachments": ["https://s3.amazon.com/mybucket/attachment.jpg"]
  }
}

@event msg_received

func NewMsgReceivedEvent

func NewMsgReceivedEvent(msg *flows.MsgIn) *MsgReceivedEvent

NewMsgReceivedEvent creates a new incoming msg event for the passed in channel, URN and text

func (*MsgReceivedEvent) AllowedOrigin added in v0.6.0

func (e *MsgReceivedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*MsgReceivedEvent) Apply added in v0.4.0

func (e *MsgReceivedEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*MsgReceivedEvent) CreatedOn added in v0.6.2

func (e *MsgReceivedEvent) CreatedOn() time.Time

func (*MsgReceivedEvent) FromCaller added in v0.6.2

func (e *MsgReceivedEvent) FromCaller() bool

func (*MsgReceivedEvent) SetCreatedOn added in v0.6.2

func (e *MsgReceivedEvent) SetCreatedOn(time time.Time)

func (*MsgReceivedEvent) SetFromCaller added in v0.6.2

func (e *MsgReceivedEvent) SetFromCaller(fromCaller bool)

func (*MsgReceivedEvent) SetStepUUID added in v0.7.0

func (e *MsgReceivedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*MsgReceivedEvent) StepUUID added in v0.7.0

func (e *MsgReceivedEvent) StepUUID() flows.StepUUID

func (*MsgReceivedEvent) Type

func (e *MsgReceivedEvent) Type() string

Type returns the type of this event

func (*MsgReceivedEvent) Validate added in v0.6.0

func (e *MsgReceivedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type MsgWaitEvent

type MsgWaitEvent struct {
	TimeoutOn *time.Time `json:"timeout_on,omitempty"`
	// contains filtered or unexported fields
}

MsgWaitEvent events are created when a flow pauses waiting for a response from a contact. If a timeout is set, then the caller should resume the flow after the number of seconds in the timeout to resume it.

{
  "type": "msg_wait",
  "created_on": "2006-01-02T15:04:05Z",
  "timeout": 300
}

@event msg_wait

func NewMsgWait

func NewMsgWait(timeoutOn *time.Time) *MsgWaitEvent

NewMsgWait returns a new msg wait with the passed in timeout

func (*MsgWaitEvent) AllowedOrigin added in v0.6.0

func (e *MsgWaitEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*MsgWaitEvent) Apply added in v0.4.0

func (e *MsgWaitEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*MsgWaitEvent) CreatedOn added in v0.6.2

func (e *MsgWaitEvent) CreatedOn() time.Time

func (*MsgWaitEvent) FromCaller added in v0.6.2

func (e *MsgWaitEvent) FromCaller() bool

func (*MsgWaitEvent) SetCreatedOn added in v0.6.2

func (e *MsgWaitEvent) SetCreatedOn(time time.Time)

func (*MsgWaitEvent) SetFromCaller added in v0.6.2

func (e *MsgWaitEvent) SetFromCaller(fromCaller bool)

func (*MsgWaitEvent) SetStepUUID added in v0.7.0

func (e *MsgWaitEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*MsgWaitEvent) StepUUID added in v0.7.0

func (e *MsgWaitEvent) StepUUID() flows.StepUUID

func (*MsgWaitEvent) Type

func (e *MsgWaitEvent) Type() string

Type returns the type of this event

func (*MsgWaitEvent) Validate added in v0.6.0

func (e *MsgWaitEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs. We assume engine generated events are valid.

type NothingWaitEvent added in v0.4.0

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

NothingWaitEvent events are created when a flow requests to hand back control to the caller but isn't waiting for anything from the caller.

{
  "type": "nothing_wait",
  "created_on": "2006-01-02T15:04:05.234532Z"
}

@event nothing_wait

func NewNothingWait added in v0.4.0

func NewNothingWait() *NothingWaitEvent

NewNothingWait returns a new nothing wait

func (*NothingWaitEvent) AllowedOrigin added in v0.6.0

func (e *NothingWaitEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*NothingWaitEvent) Apply added in v0.4.0

func (e *NothingWaitEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*NothingWaitEvent) CreatedOn added in v0.6.2

func (e *NothingWaitEvent) CreatedOn() time.Time

func (*NothingWaitEvent) FromCaller added in v0.6.2

func (e *NothingWaitEvent) FromCaller() bool

func (*NothingWaitEvent) SetCreatedOn added in v0.6.2

func (e *NothingWaitEvent) SetCreatedOn(time time.Time)

func (*NothingWaitEvent) SetFromCaller added in v0.6.2

func (e *NothingWaitEvent) SetFromCaller(fromCaller bool)

func (*NothingWaitEvent) SetStepUUID added in v0.7.0

func (e *NothingWaitEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*NothingWaitEvent) StepUUID added in v0.7.0

func (e *NothingWaitEvent) StepUUID() flows.StepUUID

func (*NothingWaitEvent) Type added in v0.4.0

func (e *NothingWaitEvent) Type() string

Type returns the type of this event

func (*NothingWaitEvent) Validate added in v0.6.0

func (e *NothingWaitEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs. We assume engine generated events are valid.

type RunExpiredEvent added in v0.4.0

type RunExpiredEvent struct {
	RunUUID flows.RunUUID `json:"run_uuid"    validate:"required,uuid4"`
	// contains filtered or unexported fields
}

RunExpiredEvent events are sent by the caller to notify the engine that a run has expired

{
  "type": "run_expired",
  "created_on": "2006-01-02T15:04:05Z",
  "run_uuid": "0e06f977-cbb7-475f-9d0b-a0c4aaec7f6a"
}

@event run_expired

func (*RunExpiredEvent) AllowedOrigin added in v0.6.0

func (e *RunExpiredEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*RunExpiredEvent) Apply added in v0.4.0

func (e *RunExpiredEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*RunExpiredEvent) CreatedOn added in v0.6.2

func (e *RunExpiredEvent) CreatedOn() time.Time

func (*RunExpiredEvent) FromCaller added in v0.6.2

func (e *RunExpiredEvent) FromCaller() bool

func (*RunExpiredEvent) SetCreatedOn added in v0.6.2

func (e *RunExpiredEvent) SetCreatedOn(time time.Time)

func (*RunExpiredEvent) SetFromCaller added in v0.6.2

func (e *RunExpiredEvent) SetFromCaller(fromCaller bool)

func (*RunExpiredEvent) SetStepUUID added in v0.7.0

func (e *RunExpiredEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*RunExpiredEvent) StepUUID added in v0.7.0

func (e *RunExpiredEvent) StepUUID() flows.StepUUID

func (*RunExpiredEvent) Type added in v0.4.0

func (e *RunExpiredEvent) Type() string

Type returns the type of this event

func (*RunExpiredEvent) Validate added in v0.6.0

func (e *RunExpiredEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type RunResultChangedEvent added in v0.5.0

type RunResultChangedEvent struct {
	Name              string         `json:"name" validate:"required"`
	Value             string         `json:"value"`
	Category          string         `json:"category"`
	CategoryLocalized string         `json:"category_localized,omitempty"`
	NodeUUID          flows.NodeUUID `json:"node_uuid" validate:"required,uuid4"`
	Operand           string         `json:"operand,omitempty"`
	// contains filtered or unexported fields
}

RunResultChangedEvent events are created when a result is saved. They contain not only the name, value and category of the result, but also the UUID of the node where the result was generated.

{
  "type": "run_result_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "name": "Gender",
  "value": "m",
  "category": "Male",
  "category_localized": "Homme",
  "node_uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d",
  "input": "M"
}

@event run_result_changed

func NewRunResultChangedEvent added in v0.5.0

func NewRunResultChangedEvent(name string, value string, categoryName string, categoryLocalized string, node flows.NodeUUID, operand string) *RunResultChangedEvent

NewRunResultChangedEvent returns a new save result event for the passed in values

func (*RunResultChangedEvent) AllowedOrigin added in v0.6.0

func (e *RunResultChangedEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*RunResultChangedEvent) Apply added in v0.5.0

func (e *RunResultChangedEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*RunResultChangedEvent) CreatedOn added in v0.6.2

func (e *RunResultChangedEvent) CreatedOn() time.Time

func (*RunResultChangedEvent) FromCaller added in v0.6.2

func (e *RunResultChangedEvent) FromCaller() bool

func (*RunResultChangedEvent) SetCreatedOn added in v0.6.2

func (e *RunResultChangedEvent) SetCreatedOn(time time.Time)

func (*RunResultChangedEvent) SetFromCaller added in v0.6.2

func (e *RunResultChangedEvent) SetFromCaller(fromCaller bool)

func (*RunResultChangedEvent) SetStepUUID added in v0.7.0

func (e *RunResultChangedEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*RunResultChangedEvent) StepUUID added in v0.7.0

func (e *RunResultChangedEvent) StepUUID() flows.StepUUID

func (*RunResultChangedEvent) Type added in v0.5.0

func (e *RunResultChangedEvent) Type() string

Type returns the type of this event

func (*RunResultChangedEvent) Validate added in v0.6.0

func (e *RunResultChangedEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs

type SessionTriggeredEvent added in v0.4.0

type SessionTriggeredEvent struct {
	Flow          *flows.FlowReference      `json:"flow" validate:"required"`
	URNs          []urns.URN                `json:"urns,omitempty" validate:"dive,urn"`
	Contacts      []*flows.ContactReference `json:"contacts,omitempty" validate:"dive"`
	Groups        []*flows.GroupReference   `json:"groups,omitempty" validate:"dive"`
	CreateContact bool                      `json:"create_contact,omitempty"`
	Run           json.RawMessage           `json:"run"`
	// contains filtered or unexported fields
}

SessionTriggeredEvent events are created when an action wants to start a subflow

{
  "type": "session_triggered",
  "created_on": "2006-01-02T15:04:05Z",
  "flow": {"uuid": "0e06f977-cbb7-475f-9d0b-a0c4aaec7f6a", "name": "Registration"},
  "groups": [
    {"uuid": "8f8e2cae-3c8d-4dce-9c4b-19514437e427", "name": "New contacts"}
  ],
  "run": {
    "uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d",
    "flow": {"uuid": "93c554a1-b90d-4892-b029-a2a87dec9b87", "name": "Other Flow"},
    "contact": {
      "uuid": "c59b0033-e748-4240-9d4c-e85eb6800151",
      "name": "Bob",
      "fields": {"state": {"value": "Azuay", "created_on": "2000-01-01T00:00:00.000000000-00:00"}}
    },
    "results": {
      "age": {
        "result_name": "Age",
        "value": "33",
        "node": "cd2be8c4-59bc-453c-8777-dec9a80043b8",
        "created_on": "2000-01-01T00:00:00.000000000-00:00"
      }
    }
  }
}

@event session_triggered

func NewSessionTriggeredEvent added in v0.4.0

func NewSessionTriggeredEvent(flow *flows.FlowReference, urns []urns.URN, contacts []*flows.ContactReference, groups []*flows.GroupReference, createContact bool, runSnapshot json.RawMessage) *SessionTriggeredEvent

NewSessionTriggeredEvent returns a new session triggered event

func (*SessionTriggeredEvent) AllowedOrigin added in v0.6.0

func (e *SessionTriggeredEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*SessionTriggeredEvent) Apply added in v0.4.0

func (e *SessionTriggeredEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*SessionTriggeredEvent) CreatedOn added in v0.6.2

func (e *SessionTriggeredEvent) CreatedOn() time.Time

func (*SessionTriggeredEvent) FromCaller added in v0.6.2

func (e *SessionTriggeredEvent) FromCaller() bool

func (*SessionTriggeredEvent) SetCreatedOn added in v0.6.2

func (e *SessionTriggeredEvent) SetCreatedOn(time time.Time)

func (*SessionTriggeredEvent) SetFromCaller added in v0.6.2

func (e *SessionTriggeredEvent) SetFromCaller(fromCaller bool)

func (*SessionTriggeredEvent) SetStepUUID added in v0.7.0

func (e *SessionTriggeredEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*SessionTriggeredEvent) StepUUID added in v0.7.0

func (e *SessionTriggeredEvent) StepUUID() flows.StepUUID

func (*SessionTriggeredEvent) Type added in v0.4.0

func (e *SessionTriggeredEvent) Type() string

Type returns the type of this event

func (*SessionTriggeredEvent) Validate added in v0.6.0

func (e *SessionTriggeredEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs. We assume engine generated events are valid.

type WebhookCalledEvent

type WebhookCalledEvent struct {
	URL        string              `json:"url"         validate:"required"`
	Status     flows.WebhookStatus `json:"status"      validate:"required"`
	StatusCode int                 `json:"status_code"`
	Request    string              `json:"request"     validate:"required"`
	Response   string              `json:"response"`
	// contains filtered or unexported fields
}

WebhookCalledEvent events are created when a webhook is called. The event contains the status and status code of the response, as well as a full dump of the request and response.

{
  "type": "webhook_called",
  "created_on": "2006-01-02T15:04:05Z",
  "url": "https://api.ipify.org?format=json",
  "status": "success",
  "status_code": 200,
  "request": "GET https://api.ipify.org?format=json",
  "response": "HTTP/1.1 200 OK {\"ip\":\"190.154.48.130\"}"
}

@event webhook_called

func NewWebhookCalledEvent added in v0.4.0

func NewWebhookCalledEvent(url string, status flows.WebhookStatus, statusCode int, request string, response string) *WebhookCalledEvent

NewWebhookCalledEvent returns a new webhook called event

func (*WebhookCalledEvent) AllowedOrigin added in v0.6.0

func (e *WebhookCalledEvent) AllowedOrigin() flows.EventOrigin

AllowedOrigin determines where this event type can originate

func (*WebhookCalledEvent) Apply added in v0.4.0

func (e *WebhookCalledEvent) Apply(run flows.FlowRun) error

Apply applies this event to the given run

func (*WebhookCalledEvent) CreatedOn added in v0.6.2

func (e *WebhookCalledEvent) CreatedOn() time.Time

func (*WebhookCalledEvent) FromCaller added in v0.6.2

func (e *WebhookCalledEvent) FromCaller() bool

func (*WebhookCalledEvent) SetCreatedOn added in v0.6.2

func (e *WebhookCalledEvent) SetCreatedOn(time time.Time)

func (*WebhookCalledEvent) SetFromCaller added in v0.6.2

func (e *WebhookCalledEvent) SetFromCaller(fromCaller bool)

func (*WebhookCalledEvent) SetStepUUID added in v0.7.0

func (e *WebhookCalledEvent) SetStepUUID(stepUUID flows.StepUUID)

func (*WebhookCalledEvent) StepUUID added in v0.7.0

func (e *WebhookCalledEvent) StepUUID() flows.StepUUID

func (*WebhookCalledEvent) Type

func (e *WebhookCalledEvent) Type() string

Type returns the type of this event

func (*WebhookCalledEvent) Validate added in v0.6.0

func (e *WebhookCalledEvent) Validate(assets flows.SessionAssets) error

Validate validates our event is valid and has all the assets it needs. We assume engine generated events are valid.

Jump to

Keyboard shortcuts

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