events

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: AGPL-3.0 Imports: 12 Imported by: 16

Documentation

Index

Constants

View Source
const TypeAirtimeTransferred string = "airtime_transferred"

TypeAirtimeTransferred is the type of our airtime transferred event

View Source
const TypeBroadcastCreated string = "broadcast_created"

TypeBroadcastCreated is a constant for outgoing message events

View Source
const TypeClassifierCalled string = "classifier_called"

TypeClassifierCalled is our type for the classification event

View Source
const TypeContactFieldChanged string = "contact_field_changed"

TypeContactFieldChanged is the type of our save to contact event

View Source
const TypeContactGroupsChanged string = "contact_groups_changed"

TypeContactGroupsChanged is the type of our groups changed event

View Source
const TypeContactLanguageChanged string = "contact_language_changed"

TypeContactLanguageChanged is the type of our contact language changed event

View Source
const TypeContactNameChanged string = "contact_name_changed"

TypeContactNameChanged is the type of our contact name changed event

View Source
const TypeContactRefreshed string = "contact_refreshed"

TypeContactRefreshed is the type of our contact refreshed event

View Source
const TypeContactTimezoneChanged string = "contact_timezone_changed"

TypeContactTimezoneChanged is the type of our contact timezone changed event

View Source
const TypeContactURNsChanged string = "contact_urns_changed"

TypeContactURNsChanged is the type of our URNs changed event

View Source
const TypeEmailCreated string = "email_created"

TypeEmailCreated is our type for the email event

View Source
const TypeEmailSent string = "email_sent"

TypeEmailSent is our type for the email event

View Source
const TypeEnvironmentRefreshed string = "environment_refreshed"

TypeEnvironmentRefreshed 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 TypeFailure string = "failure"

TypeFailure is the type of our error events

View Source
const TypeFlowEntered string = "flow_entered"

TypeFlowEntered is the type of our flow entered event

View Source
const TypeIVRCreated string = "ivr_created"

TypeIVRCreated is a constant for IVR created events

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 TypeResthookCalled string = "resthook_called"

TypeResthookCalled is the type for our resthook events

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 TypeWaitTimedOut string = "wait_timed_out"

TypeWaitTimedOut is the type of our wait timed out events

View Source
const TypeWebhookCalled string = "webhook_called"

TypeWebhookCalled is the type for our webhook events

Variables

This section is empty.

Functions

func ReadEvent added in v0.11.0

func ReadEvent(data json.RawMessage) (flows.Event, error)

ReadEvent reads a single event from the given JSON

Types

type AirtimeTransferredEvent added in v0.48.0

type AirtimeTransferredEvent struct {
	Sender        urns.URN         `json:"sender"`
	Recipient     urns.URN         `json:"recipient"`
	Currency      string           `json:"currency"`
	DesiredAmount decimal.Decimal  `json:"desired_amount"`
	ActualAmount  decimal.Decimal  `json:"actual_amount"`
	HTTPLogs      []*flows.HTTPLog `json:"http_logs"`
	// contains filtered or unexported fields
}

AirtimeTransferredEvent events are created when airtime has been transferred to the contact.

{
  "type": "airtime_transferred",
  "created_on": "2006-01-02T15:04:05Z",
  "sender": "tel:4748",
  "recipient": "tel:+1242563637",
  "currency": "RWF",
  "desired_amount": 120,
  "actual_amount": 100,
  "http_logs": [
    {
      "url": "https://airtime-api.dtone.com/cgi-bin/shop/topup",
      "status": "success",
      "request": "POST /topup HTTP/1.1\r\n\r\naction=ping",
      "response": "HTTP/1.1 200 OK\r\n\r\ninfo_txt=pong\r\n",
      "created_on": "2006-01-02T15:04:05Z",
      "elapsed_ms": 123
    }
  ]
}

@event airtime_transferred

func NewAirtimeTransferred added in v0.48.0

func NewAirtimeTransferred(t *flows.AirtimeTransfer, httpLogs []*flows.HTTPLog) *AirtimeTransferredEvent

NewAirtimeTransferred creates a new airtime transferred event

func (*AirtimeTransferredEvent) CreatedOn added in v0.48.0

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

CreatedOn returns the created on time of this event

func (*AirtimeTransferredEvent) SetStepUUID added in v0.48.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*AirtimeTransferredEvent) StepUUID added in v0.48.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*AirtimeTransferredEvent) Type added in v0.48.0

func (e *AirtimeTransferredEvent) Type() string

Type returns the type of this event

type BroadcastCreatedEvent added in v0.5.0

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

BroadcastCreatedEvent events are created when an action wants to send a message to other contacts.

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

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

NewBroadcastCreated creates a new outgoing msg event for the given recipients

func (*BroadcastCreatedEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*BroadcastCreatedEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*BroadcastCreatedEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*BroadcastCreatedEvent) Type added in v0.5.0

func (e *BroadcastCreatedEvent) Type() string

Type returns the type of this event

type BroadcastTranslation added in v0.6.1

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

BroadcastTranslation is the broadcast content in a particular language

type ClassifierCalledEvent added in v0.51.0

type ClassifierCalledEvent struct {
	Classifier *assets.ClassifierReference `json:"classifier" validate:"required"`
	HTTPLogs   []*flows.HTTPLog            `json:"http_logs"`
	// contains filtered or unexported fields
}

ClassifierCalledEvent events are created when a NLU classifier is called.

{
  "type": "classifier_called",
  "created_on": "2006-01-02T15:04:05Z",
  "classifier": {"uuid": "1c06c884-39dd-4ce4-ad9f-9a01cbe6c000", "name": "Booking"},
  "http_logs": [
    {
      "url": "https://api.wit.ai/message?v=20170307&q=hello",
      "status": "success",
      "request": "GET /message?v=20170307&q=hello HTTP/1.1",
      "response": "HTTP/1.1 200 OK\r\n\r\n{\"intents\":[]}",
      "created_on": "2006-01-02T15:04:05Z",
      "elapsed_ms": 123
    }
  ]
}

@event classifier_called

func NewClassifierCalled added in v0.51.0

func NewClassifierCalled(classifier *assets.ClassifierReference, httpLogs []*flows.HTTPLog) *ClassifierCalledEvent

NewClassifierCalled returns a classifier called event

func (*ClassifierCalledEvent) CreatedOn added in v0.51.0

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

CreatedOn returns the created on time of this event

func (*ClassifierCalledEvent) SetStepUUID added in v0.51.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ClassifierCalledEvent) StepUUID added in v0.51.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ClassifierCalledEvent) Type added in v0.51.0

func (e *ClassifierCalledEvent) Type() string

Type returns the type of this event

type ContactFieldChangedEvent added in v0.5.0

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

ContactFieldChangedEvent events are created when a custom field value of the contact has been changed. A null values indicates that the field value has been cleared.

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

@event contact_field_changed

func NewContactFieldChanged added in v0.48.0

func NewContactFieldChanged(field *flows.Field, value *flows.Value) *ContactFieldChangedEvent

NewContactFieldChanged returns a new save to contact event

func (*ContactFieldChangedEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*ContactFieldChangedEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ContactFieldChangedEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ContactFieldChangedEvent) Type added in v0.5.0

func (e *ContactFieldChangedEvent) Type() string

Type returns the type of this event

type ContactGroupsChangedEvent added in v0.18.0

type ContactGroupsChangedEvent struct {
	GroupsAdded   []*assets.GroupReference `json:"groups_added,omitempty" validate:"omitempty,dive"`
	GroupsRemoved []*assets.GroupReference `json:"groups_removed,omitempty" validate:"omitempty,dive"`
	// contains filtered or unexported fields
}

ContactGroupsChangedEvent events are created when a contact is added or removed to/from one or more groups.

{
  "type": "contact_groups_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "groups_added": [{"uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d", "name": "Reporters"}],
  "groups_removed": [{"uuid": "1e1ce1e1-9288-4504-869e-022d1003c72a", "name": "Customers"}]
}

@event contact_groups_changed

func NewContactGroupsChanged added in v0.48.0

func NewContactGroupsChanged(added []*flows.Group, removed []*flows.Group) *ContactGroupsChangedEvent

NewContactGroupsChanged returns a new contact_groups_changed event

func (*ContactGroupsChangedEvent) CreatedOn added in v0.48.0

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

CreatedOn returns the created on time of this event

func (*ContactGroupsChangedEvent) SetStepUUID added in v0.48.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ContactGroupsChangedEvent) StepUUID added in v0.48.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ContactGroupsChangedEvent) Type added in v0.18.0

func (e *ContactGroupsChangedEvent) Type() string

Type returns the type of this event

type ContactLanguageChangedEvent added in v0.10.0

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

ContactLanguageChangedEvent events are created when the language of the contact has been changed.

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

@event contact_language_changed

func NewContactLanguageChanged added in v0.48.0

func NewContactLanguageChanged(language envs.Language) *ContactLanguageChangedEvent

NewContactLanguageChanged returns a new contact language changed event

func (*ContactLanguageChangedEvent) CreatedOn added in v0.10.0

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

CreatedOn returns the created on time of this event

func (*ContactLanguageChangedEvent) SetStepUUID added in v0.10.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ContactLanguageChangedEvent) StepUUID added in v0.10.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ContactLanguageChangedEvent) Type added in v0.10.0

func (e *ContactLanguageChangedEvent) Type() string

Type returns the type of this event

type ContactNameChangedEvent added in v0.10.0

type ContactNameChangedEvent struct {
	Name string `json:"name"`
	// contains filtered or unexported fields
}

ContactNameChangedEvent events are created when the name of the contact has been changed.

{
  "type": "contact_name_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "name": "Bob Smith"
}

@event contact_name_changed

func NewContactNameChanged added in v0.48.0

func NewContactNameChanged(name string) *ContactNameChangedEvent

NewContactNameChanged returns a new contact name changed event

func (*ContactNameChangedEvent) CreatedOn added in v0.10.0

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

CreatedOn returns the created on time of this event

func (*ContactNameChangedEvent) SetStepUUID added in v0.10.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ContactNameChangedEvent) StepUUID added in v0.10.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ContactNameChangedEvent) Type added in v0.10.0

func (e *ContactNameChangedEvent) Type() string

Type returns the type of this event

type ContactRefreshedEvent added in v0.24.0

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

ContactRefreshedEvent events are generated when the resume has a contact with differences to the current session contact.

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

@event contact_refreshed

func NewContactRefreshed added in v0.48.0

func NewContactRefreshed(contact *flows.Contact) *ContactRefreshedEvent

NewContactRefreshed creates a new contact changed event

func (*ContactRefreshedEvent) CreatedOn added in v0.48.0

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

CreatedOn returns the created on time of this event

func (*ContactRefreshedEvent) SetStepUUID added in v0.48.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ContactRefreshedEvent) StepUUID added in v0.48.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ContactRefreshedEvent) Type added in v0.48.0

func (e *ContactRefreshedEvent) Type() string

Type returns the type of this event

type ContactTimezoneChangedEvent added in v0.10.0

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

ContactTimezoneChangedEvent events are created when the timezone of the contact has been changed.

{
  "type": "contact_timezone_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "timezone": "Africa/Kigali"
}

@event contact_timezone_changed

func NewContactTimezoneChanged added in v0.48.0

func NewContactTimezoneChanged(timezone *time.Location) *ContactTimezoneChangedEvent

NewContactTimezoneChanged returns a new contact timezone changed event

func (*ContactTimezoneChangedEvent) CreatedOn added in v0.10.0

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

CreatedOn returns the created on time of this event

func (*ContactTimezoneChangedEvent) SetStepUUID added in v0.10.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ContactTimezoneChangedEvent) StepUUID added in v0.10.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ContactTimezoneChangedEvent) Type added in v0.10.0

func (e *ContactTimezoneChangedEvent) Type() string

Type returns the type of this event

type ContactURNsChangedEvent added in v0.23.0

type ContactURNsChangedEvent struct {
	URNs []urns.URN `json:"urns" validate:"dive,urn"`
	// contains filtered or unexported fields
}

ContactURNsChangedEvent events are created when a contact's URNs have changed.

{
  "type": "contact_urns_changed",
  "created_on": "2006-01-02T15:04:05Z",
  "urns": [
    "tel:+12345678900",
    "twitter:bob"
  ]
}

@event contact_urns_changed

func NewContactURNsChanged added in v0.48.0

func NewContactURNsChanged(urns []urns.URN) *ContactURNsChangedEvent

NewContactURNsChanged returns a new add URN event

func (*ContactURNsChangedEvent) CreatedOn added in v0.48.0

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

CreatedOn returns the created on time of this event

func (*ContactURNsChangedEvent) SetStepUUID added in v0.48.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ContactURNsChangedEvent) StepUUID added in v0.48.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ContactURNsChangedEvent) Type added in v0.48.0

func (e *ContactURNsChangedEvent) Type() string

Type returns the type of this event

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 is no longer used but old sessions might include these

func (*EmailCreatedEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*EmailCreatedEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*EmailCreatedEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*EmailCreatedEvent) Type added in v0.5.0

func (e *EmailCreatedEvent) Type() string

Type returns the type of this event

type EmailSentEvent added in v0.61.0

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

EmailSentEvent events are created when an action has sent an email.

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

@event email_sent

func NewEmailSent added in v0.61.0

func NewEmailSent(to []string, subject string, body string) *EmailSentEvent

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

func (*EmailSentEvent) CreatedOn added in v0.61.0

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

CreatedOn returns the created on time of this event

func (*EmailSentEvent) SetStepUUID added in v0.61.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*EmailSentEvent) StepUUID added in v0.61.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*EmailSentEvent) Type added in v0.61.0

func (e *EmailSentEvent) Type() string

Type returns the type of this event

type EnvironmentRefreshedEvent added in v0.24.0

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

EnvironmentRefreshedEvent events are sent by the caller to tell the engine to update the session environment.

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

@event environment_refreshed

func NewEnvironmentRefreshed added in v0.48.0

func NewEnvironmentRefreshed(env envs.Environment) *EnvironmentRefreshedEvent

NewEnvironmentRefreshed creates a new environment changed event

func (*EnvironmentRefreshedEvent) CreatedOn added in v0.48.0

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

CreatedOn returns the created on time of this event

func (*EnvironmentRefreshedEvent) SetStepUUID added in v0.48.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*EnvironmentRefreshedEvent) StepUUID added in v0.48.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*EnvironmentRefreshedEvent) Type added in v0.48.0

func (e *EnvironmentRefreshedEvent) Type() string

Type returns the type of this event

type ErrorEvent

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

ErrorEvent events are created when an error occurs during flow execution.

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

@event error

func NewError added in v0.48.0

func NewError(err error) *ErrorEvent

NewError returns a new error event for the passed in error

func NewErrorf added in v0.48.0

func NewErrorf(format string, a ...interface{}) *ErrorEvent

NewErrorf returns a new error event for the passed in format string and args

func (*ErrorEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*ErrorEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ErrorEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ErrorEvent) Type

func (e *ErrorEvent) Type() string

Type returns the type of this event

type FailureEvent added in v0.47.1

type FailureEvent struct {
	Text string `json:"text" validate:"required"`
	// contains filtered or unexported fields
}

FailureEvent events are created when an error occurs during flow execution which prevents continuation of the session.

{
  "type": "failure",
  "created_on": "2006-01-02T15:04:05Z",
  "text": "unable to read flow"
}

@event failure

func NewFailure added in v0.48.0

func NewFailure(err error) *FailureEvent

NewFailure returns a new failure event for the passed in error

func (*FailureEvent) CreatedOn added in v0.48.0

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

CreatedOn returns the created on time of this event

func (*FailureEvent) SetStepUUID added in v0.48.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*FailureEvent) StepUUID added in v0.48.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*FailureEvent) Type added in v0.48.0

func (e *FailureEvent) Type() string

Type returns the type of this event

type FlowEnteredEvent

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

FlowEnteredEvent events are created when an action has entered a sub-flow.

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

@event flow_entered

func NewFlowEntered added in v0.48.0

func NewFlowEntered(flow *assets.FlowReference, parentRunUUID flows.RunUUID, terminal bool) *FlowEnteredEvent

NewFlowEntered returns a new flow entered event for the passed in flow and parent run

func (*FlowEnteredEvent) CreatedOn added in v0.48.0

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

CreatedOn returns the created on time of this event

func (*FlowEnteredEvent) SetStepUUID added in v0.48.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*FlowEnteredEvent) StepUUID added in v0.48.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*FlowEnteredEvent) Type

func (e *FlowEnteredEvent) Type() string

Type returns the type of this event

type IVRCreatedEvent added in v0.25.0

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

IVRCreatedEvent events are created when an action wants to send an IVR response to the current contact.

{
  "type": "ivr_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": ["audio:https://s3.amazon.com/mybucket/attachment.m4a"]
  }
}

@event ivr_created

func NewIVRCreated added in v0.48.0

func NewIVRCreated(msg *flows.MsgOut) *IVRCreatedEvent

NewIVRCreated creates a new IVR created event

func (*IVRCreatedEvent) CreatedOn added in v0.48.0

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

CreatedOn returns the created on time of this event

func (*IVRCreatedEvent) SetStepUUID added in v0.48.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*IVRCreatedEvent) StepUUID added in v0.48.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*IVRCreatedEvent) Type added in v0.48.0

func (e *IVRCreatedEvent) Type() string

Type returns the type of this event

type InputLabelsAddedEvent added in v0.5.0

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

InputLabelsAddedEvent events are created when an action wants to add labels to the current 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 NewInputLabelsAdded added in v0.48.0

func NewInputLabelsAdded(inputUUID flows.InputUUID, labels []*flows.Label) *InputLabelsAddedEvent

NewInputLabelsAdded returns a new labels added event

func (*InputLabelsAddedEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*InputLabelsAddedEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*InputLabelsAddedEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*InputLabelsAddedEvent) Type added in v0.5.0

func (e *InputLabelsAddedEvent) Type() string

Type returns the type of this event

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 created when an action wants to send a reply to the current 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": ["image/jpeg:https://s3.amazon.com/mybucket/attachment.jpg"]
  }
}

@event msg_created

func NewMsgCreated added in v0.48.0

func NewMsgCreated(msg *flows.MsgOut) *MsgCreatedEvent

NewMsgCreated creates a new outgoing msg event to a single contact

func (*MsgCreatedEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*MsgCreatedEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*MsgCreatedEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*MsgCreatedEvent) Type added in v0.6.0

func (e *MsgCreatedEvent) Type() string

Type returns the type of this event

type MsgReceivedEvent

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

MsgReceivedEvent events are sent by the caller to tell the engine that a message was received from the contact and that it should try to resume the session.

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

func NewMsgReceived(msg *flows.MsgIn) *MsgReceivedEvent

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

func (*MsgReceivedEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*MsgReceivedEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*MsgReceivedEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*MsgReceivedEvent) Type

func (e *MsgReceivedEvent) Type() string

Type returns the type of this event

type MsgWaitEvent

type MsgWaitEvent struct {
	TimeoutSeconds *int       `json:"timeout_seconds,omitempty"`
	Hint           flows.Hint `json:"hint,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": "2019-01-02T15:04:05Z",
  "timeout_seconds": 300,
  "hint": {
     "type": "image"
  }
}

@event msg_wait

func NewMsgWait

func NewMsgWait(timeoutSeconds *int, hint flows.Hint) *MsgWaitEvent

NewMsgWait returns a new msg wait with the passed in timeout

func (*MsgWaitEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*MsgWaitEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*MsgWaitEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*MsgWaitEvent) Type

func (e *MsgWaitEvent) Type() string

Type returns the type of this event

func (*MsgWaitEvent) UnmarshalJSON added in v0.32.1

func (e *MsgWaitEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals this event from the given JSON

type ResthookCalledEvent added in v0.10.20

type ResthookCalledEvent struct {
	Resthook string          `json:"resthook"`
	Payload  json.RawMessage `json:"payload"`
	// contains filtered or unexported fields
}

ResthookCalledEvent events are created when a resthook is called. The event contains the payload that will be sent to any subscribers of that resthook. Note that this event is created regardless of whether there any subscriberes for that resthook.

{
  "type": "resthook_called",
  "created_on": "2006-01-02T15:04:05Z",
  "resthook": "success",
  "payload": {
    "contact:":{
      "name":"Bob"
    }
  }
}

@event resthook_called

func NewResthookCalled added in v0.48.0

func NewResthookCalled(resthook string, payload json.RawMessage) *ResthookCalledEvent

NewResthookCalled returns a new webhook called event

func (*ResthookCalledEvent) CreatedOn added in v0.10.20

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

CreatedOn returns the created on time of this event

func (*ResthookCalledEvent) SetStepUUID added in v0.10.20

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*ResthookCalledEvent) StepUUID added in v0.10.20

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

StepUUID returns the UUID of the step in the path where this event occured

func (*ResthookCalledEvent) Type added in v0.10.20

func (e *ResthookCalledEvent) Type() string

Type returns the type of this event

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 tell 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 NewRunExpired added in v0.48.0

func NewRunExpired(run flows.FlowRun) *RunExpiredEvent

NewRunExpired creates a new run expired event

func (*RunExpiredEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*RunExpiredEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*RunExpiredEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*RunExpiredEvent) Type added in v0.4.0

func (e *RunExpiredEvent) Type() string

Type returns the type of this event

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"`
	Input             string          `json:"input,omitempty"`
	Extra             json.RawMessage `json:"extra,omitempty"`
	// contains filtered or unexported fields
}

RunResultChangedEvent events are created when a run 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 NewRunResultChanged added in v0.48.0

func NewRunResultChanged(result *flows.Result) *RunResultChangedEvent

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

func (*RunResultChangedEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*RunResultChangedEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*RunResultChangedEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*RunResultChangedEvent) Type added in v0.5.0

func (e *RunResultChangedEvent) Type() string

Type returns the type of this event

type SessionTriggeredEvent added in v0.4.0

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

SessionTriggeredEvent events are created when an action wants to start other people in a flow.

{
  "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_summary": {
    "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": {
        "name": "Age",
        "value": "33",
        "node_uuid": "cd2be8c4-59bc-453c-8777-dec9a80043b8",
        "created_on": "2000-01-01T00:00:00.000000000-00:00"
      }
    }
  }
}

@event session_triggered

func NewSessionTriggered added in v0.50.0

func NewSessionTriggered(flow *assets.FlowReference, groups []*assets.GroupReference, contacts []*flows.ContactReference, contactQuery string, createContact bool, urns []urns.URN, runSummary json.RawMessage) *SessionTriggeredEvent

NewSessionTriggered returns a new session triggered event

func (*SessionTriggeredEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*SessionTriggeredEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*SessionTriggeredEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*SessionTriggeredEvent) Type added in v0.4.0

func (e *SessionTriggeredEvent) Type() string

Type returns the type of this event

type WaitTimedOutEvent added in v0.9.10

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

WaitTimedOutEvent events are sent by the caller when a wait has timed out - i.e. they are sent instead of the item that the wait was waiting for.

{
  "type": "wait_timed_out",
  "created_on": "2006-01-02T15:04:05Z"
}

@event wait_timed_out

func NewWaitTimedOut added in v0.48.0

func NewWaitTimedOut() *WaitTimedOutEvent

NewWaitTimedOut creates a new wait timed out event

func (*WaitTimedOutEvent) CreatedOn added in v0.9.10

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

CreatedOn returns the created on time of this event

func (*WaitTimedOutEvent) SetStepUUID added in v0.9.10

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*WaitTimedOutEvent) StepUUID added in v0.9.10

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

StepUUID returns the UUID of the step in the path where this event occured

func (*WaitTimedOutEvent) Type added in v0.9.10

func (e *WaitTimedOutEvent) Type() string

Type returns the type of this event

type WebhookCalledEvent

type WebhookCalledEvent struct {
	URL         string           `json:"url" validate:"required"`
	Status      flows.CallStatus `json:"status" validate:"required"`
	Request     string           `json:"request" validate:"required"`
	Response    string           `json:"response"`
	ElapsedMS   int              `json:"elapsed_ms"`
	Resthook    string           `json:"resthook,omitempty"`
	StatusCode  int              `json:"status_code,omitempty"`
	BodyIgnored bool             `json:"body_ignored,omitempty"`
	// contains filtered or unexported fields
}

WebhookCalledEvent events are created when a webhook is called. The event contains the URL and the status 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": "http://localhost:49998/?cmd=success",
  "status": "success",
  "status_code": 200,
  "elapsed_ms": 123,
  "request": "GET /?format=json HTTP/1.1",
  "response": "HTTP/1.1 200 OK\r\n\r\n{\"ip\":\"190.154.48.130\"}"
}

@event webhook_called

func NewWebhookCalled added in v0.48.0

func NewWebhookCalled(webhook *flows.WebhookCall) *WebhookCalledEvent

NewWebhookCalled returns a new webhook called event

func (*WebhookCalledEvent) CreatedOn added in v0.6.2

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

CreatedOn returns the created on time of this event

func (*WebhookCalledEvent) SetStepUUID added in v0.7.0

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

SetStepUUID sets the UUID of the step in the path where this event occured

func (*WebhookCalledEvent) StepUUID added in v0.7.0

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

StepUUID returns the UUID of the step in the path where this event occured

func (*WebhookCalledEvent) Type

func (e *WebhookCalledEvent) Type() string

Type returns the type of this event

Jump to

Keyboard shortcuts

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