events

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2017 License: AGPL-3.0 Imports: 7 Imported by: 16

Documentation

Index

Constants

View Source
const TypeAddLabel string = "add_label"

TypeAddLabel is the type of our add label action

View Source
const TypeAddToGroup string = "add_to_group"

TypeAddToGroup is the type of our add to group action

View Source
const TypeAddURN string = "add_urn"

TypeAddURN is the type of our add URN 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 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 TypePreferredChannel string = "set_preferred_channel"

TypePreferredChannel is the type of our set preferred channel event

View Source
const TypeRemoveFromGroup string = "remove_from_group"

TypeRemoveFromGroup is the type fo our remove from group action

View Source
const TypeRunExpired string = "run_expired"

TypeRunExpired is the type of our flow expired event

View Source
const TypeSaveContactField string = "save_contact_field"

TypeSaveContactField is the type of our save to contact event

View Source
const TypeSaveFlowResult string = "save_flow_result"

TypeSaveFlowResult is the type of our save result event

View Source
const TypeSendEmail string = "send_email"

TypeSendEmail is our type for the email event

View Source
const TypeSendMsg string = "send_msg"

TypeSendMsg is a constant for incoming messages

View Source
const TypeSessionTriggered string = "session_triggered"

TypeSessionTriggered is the type of our session triggered event

View Source
const TypeSetContact string = "set_contact"

TypeSetContact is the type of our set contact event

View Source
const TypeSetEnvironment string = "set_environment"

TypeSetEnvironment is the type of our set environment event

View Source
const TypeSetExtra string = "set_extra"

TypeSetExtra is the type of our set extra event

View Source
const TypeUpdateContact string = "update_contact"

TypeUpdateContact is the type of our update contact 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)

func ReadEvents added in v0.4.0

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

Types

type AddLabelEvent added in v0.4.0

type AddLabelEvent struct {
	BaseEvent
	InputUUID flows.InputUUID         `json:"input_uuid" validate:"required,uuid4"`
	Labels    []*flows.LabelReference `json:"labels" validate:"required,min=1,dive"`
}

AddLabelEvent events will be created with the labels that should be applied to the given input.

```

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

```

@event add_label

func NewAddLabelEvent added in v0.4.0

func NewAddLabelEvent(inputUUID flows.InputUUID, labels []*flows.LabelReference) *AddLabelEvent

NewAddLabelEvent returns a new add to group event

func (*AddLabelEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*AddLabelEvent) Type added in v0.4.0

func (e *AddLabelEvent) Type() string

Type returns the type of this event

type AddToGroupEvent

type AddToGroupEvent struct {
	BaseEvent
	Groups []*flows.GroupReference `json:"groups" validate:"required,min=1,dive"`
}

AddToGroupEvent events will be created with the groups a contact should be added to.

```

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

```

@event add_to_group

func NewAddToGroupEvent added in v0.4.0

func NewAddToGroupEvent(groups []*flows.GroupReference) *AddToGroupEvent

NewAddToGroupEvent returns a new add to group event

func (*AddToGroupEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*AddToGroupEvent) Type

func (e *AddToGroupEvent) Type() string

Type returns the type of this event

type AddURNEvent added in v0.4.0

type AddURNEvent struct {
	BaseEvent
	URN urns.URN `json:"urn" validate:"urn"`
}

AddURNEvent events will be created with the URN tht should be added to the current contact.

```

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

```

@event add_urn

func NewAddURNEvent added in v0.4.0

func NewAddURNEvent(urn urns.URN) *AddURNEvent

NewAddURNEvent returns a new add URN event

func (*AddURNEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*AddURNEvent) Type added in v0.4.0

func (e *AddURNEvent) Type() string

Type returns the type of this event

type BaseEvent

type BaseEvent struct {
	CreatedOn_  time.Time `json:"created_on"    validate:"required"`
	FromCaller_ bool      `json:"-"`
}

func NewBaseEvent added in v0.4.0

func NewBaseEvent() BaseEvent

func (*BaseEvent) CreatedOn

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

func (*BaseEvent) FromCaller added in v0.4.0

func (e *BaseEvent) FromCaller() bool

func (*BaseEvent) SetCreatedOn

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

func (*BaseEvent) SetFromCaller added in v0.4.0

func (e *BaseEvent) SetFromCaller(fromCaller bool)

type ErrorEvent

type ErrorEvent struct {
	BaseEvent
	Text  string `json:"text" validate:"required"`
	Fatal bool   `json:"fatal"`
}

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

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) Type

func (e *ErrorEvent) Type() string

Type returns the type of this event

type FlowTriggeredEvent added in v0.4.0

type FlowTriggeredEvent struct {
	BaseEvent
	Flow          *flows.FlowReference `json:"flow" validate:"required"`
	ParentRunUUID flows.RunUUID        `json:"parent_run_uuid" validate:"omitempty,uuid4"`
}

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) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*FlowTriggeredEvent) Type added in v0.4.0

func (e *FlowTriggeredEvent) Type() string

Type returns the type of this event

type MsgReceivedEvent

type MsgReceivedEvent struct {
	BaseEvent
	MsgUUID     flows.InputUUID         `json:"msg_uuid" validate:"required,uuid4"`
	Channel     *flows.ChannelReference `json:"channel,omitempty"`
	URN         urns.URN                `json:"urn" validate:"urn"`
	Contact     *flows.ContactReference `json:"contact"`
	Text        string                  `json:"text"`
	Attachments []flows.Attachment      `json:"attachments,omitempty"`
}

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

```

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

```

@event msg_received

func NewMsgReceivedEvent

func NewMsgReceivedEvent(uuid flows.InputUUID, channel *flows.ChannelReference, contact *flows.ContactReference, urn urns.URN, text string, attachments []flows.Attachment) *MsgReceivedEvent

NewMsgReceivedEvent creates a new incoming msg event for the passed in channel, contact and string

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) Type

func (e *MsgReceivedEvent) Type() string

Type returns the type of this event

type MsgWaitEvent

type MsgWaitEvent struct {
	BaseEvent
	TimeoutOn *time.Time `json:"timeout_on,omitempty"`
}

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) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*MsgWaitEvent) Type

func (e *MsgWaitEvent) Type() string

Type returns the type of this event

type NothingWaitEvent added in v0.4.0

type NothingWaitEvent struct {
	BaseEvent
}

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) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*NothingWaitEvent) Type added in v0.4.0

func (e *NothingWaitEvent) Type() string

Type returns the type of this event

type PreferredChannelEvent added in v0.4.0

type PreferredChannelEvent struct {
	BaseEvent
	Channel *flows.ChannelReference `json:"channel" validate:"required"`
}

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

```

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

```

@event set_preferred_channel

func NewPreferredChannel added in v0.4.0

func NewPreferredChannel(channel *flows.ChannelReference) *PreferredChannelEvent

NewPreferredChannel returns a new preferred channel event

func (*PreferredChannelEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*PreferredChannelEvent) Type added in v0.4.0

func (e *PreferredChannelEvent) Type() string

Type returns the type of this event

type RemoveFromGroupEvent

type RemoveFromGroupEvent struct {
	Groups []*flows.GroupReference `json:"groups" validate:"required,min=1,dive"`
	BaseEvent
}

RemoveFromGroupEvent events are created when a contact is removed from one or more groups.

```

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

```

@event remove_from_group

func NewRemoveFromGroupEvent added in v0.4.0

func NewRemoveFromGroupEvent(groups []*flows.GroupReference) *RemoveFromGroupEvent

NewRemoveFromGroupEvent returns a new remove from group event

func (*RemoveFromGroupEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*RemoveFromGroupEvent) Type

func (e *RemoveFromGroupEvent) Type() string

Type returns the type of this event

type RunExpiredEvent added in v0.4.0

type RunExpiredEvent struct {
	BaseEvent
	RunUUID flows.RunUUID `json:"run_uuid"    validate:"required,uuid4"`
}

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) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*RunExpiredEvent) Type added in v0.4.0

func (e *RunExpiredEvent) Type() string

Type returns the type of this event

type SaveContactFieldEvent

type SaveContactFieldEvent struct {
	BaseEvent
	Field *flows.FieldReference `json:"field" validate:"required"`
	Value string                `json:"value" validate:"required"`
}

SaveContactFieldEvent events are created when a contact field is updated.

```

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

```

@event save_contact_field

func NewSaveToContactEvent added in v0.4.0

func NewSaveToContactEvent(field *flows.FieldReference, value string) *SaveContactFieldEvent

NewSaveToContactEvent returns a new save to contact event

func (*SaveContactFieldEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*SaveContactFieldEvent) Type

func (e *SaveContactFieldEvent) Type() string

Type returns the type of this event

type SaveFlowResultEvent

type SaveFlowResultEvent struct {
	BaseEvent
	NodeUUID          flows.NodeUUID `json:"node_uuid"        validate:"required"`
	ResultName        string         `json:"result_name"      validate:"required"`
	Value             string         `json:"value"`
	Category          string         `json:"category"`
	CategoryLocalized string         `json:"category_localized,omitempty"`
}

SaveFlowResultEvent 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 saved.

```

{
  "type": "save_flow_result",
  "created_on": "2006-01-02T15:04:05Z",
  "node_uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d",
  "result_name": "Gender",
  "value": "m",
  "category": "Make"
}

```

@event save_flow_result

func NewSaveFlowResult

func NewSaveFlowResult(node flows.NodeUUID, name string, value string, categoryName string, categoryLocalized string) *SaveFlowResultEvent

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

func (*SaveFlowResultEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*SaveFlowResultEvent) Type

func (e *SaveFlowResultEvent) Type() string

Type returns the type of this event

type SendEmailEvent

type SendEmailEvent struct {
	BaseEvent
	Addresses []string `json:"addresses" validate:"required,min=1"`
	Subject   string   `json:"subject" validate:"required"`
	Body      string   `json:"body"`
}

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

```

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

```

@event send_email

func NewSendEmailEvent

func NewSendEmailEvent(addresses []string, subject string, body string) *SendEmailEvent

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

func (*SendEmailEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*SendEmailEvent) Type

func (a *SendEmailEvent) Type() string

Type returns the type of this event

type SendMsgEvent

type SendMsgEvent struct {
	BaseEvent
	Text        string                    `json:"text"`
	Attachments []string                  `json:"attachments,omitempty"`
	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"`
}

SendMsgEvent events are created for outgoing messages.

```

{
  "type": "send_msg",
  "created_on": "2006-01-02T15:04:05Z",
  "text": "hi, what's up",
  "attachments": [],
  "urns": ["tel:+12065551212"],
  "contacts": [{"uuid": "0e06f977-cbb7-475f-9d0b-a0c4aaec7f6a", "name": "Bob"}]
}

```

@event send_msg

func NewSendMsgEvent added in v0.4.0

func NewSendMsgEvent(text string, attachments []string, urns []urns.URN, contacts []*flows.ContactReference, groups []*flows.GroupReference) *SendMsgEvent

NewSendMsgEvent creates a new outgoing msg event for the given recipients

func NewSendMsgToContactEvent added in v0.4.0

func NewSendMsgToContactEvent(text string, attachments []string, contact *flows.ContactReference) *SendMsgEvent

NewSendMsgToContactEvent creates a new outgoing msg event to a single contact

func (*SendMsgEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*SendMsgEvent) Type

func (e *SendMsgEvent) Type() string

Type returns the type of this event

type SessionTriggeredEvent added in v0.4.0

type SessionTriggeredEvent struct {
	BaseEvent
	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"`
}

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",
    "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) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*SessionTriggeredEvent) Type added in v0.4.0

func (e *SessionTriggeredEvent) Type() string

Type returns the type of this event

type SetContactEvent added in v0.4.0

type SetContactEvent struct {
	BaseEvent
	Contact json.RawMessage `json:"contact"`
}

SetContactEvent events are created to set a contact on a session

```

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

```

@event set_contact

func (*SetContactEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*SetContactEvent) Type added in v0.4.0

func (e *SetContactEvent) Type() string

Type returns the type of this event

type SetEnvironmentEvent added in v0.4.0

type SetEnvironmentEvent struct {
	BaseEvent
	DateFormat utils.DateFormat   `json:"date_format"`
	TimeFormat utils.TimeFormat   `json:"time_format"`
	Timezone   string             `json:"timezone"`
	Languages  utils.LanguageList `json:"languages"`
}

SetEnvironmentEvent events are created to set the environment on a session

```

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

```

@event set_environment

func (*SetEnvironmentEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*SetEnvironmentEvent) Type added in v0.4.0

func (e *SetEnvironmentEvent) Type() string

Type returns the type of this event

type SetExtraEvent added in v0.4.0

type SetExtraEvent struct {
	BaseEvent
	Extra json.RawMessage `json:"extra"`
}

SetExtraEvent events are created to set extra context on a run

```

{
  "type": "set_extra",
  "created_on": "2006-01-02T15:04:05Z",
  "extra": {
    "name": "Bart",
    "address": {
      "street": "742 Evergreen Terrace",
      "city": "Springfield"
    }
  }
}

```

@event set_extra

func (*SetExtraEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*SetExtraEvent) Type added in v0.4.0

func (e *SetExtraEvent) Type() string

Type returns the type of this event

type UpdateContactEvent

type UpdateContactEvent struct {
	BaseEvent
	FieldName string `json:"field_name" validate:"required,eq=name|eq=language"`
	Value     string `json:"value"`
}

UpdateContactEvent events are created when a contact's built in field is updated.

```

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

```

@event update_contact

func NewUpdateContact

func NewUpdateContact(name string, value string) *UpdateContactEvent

NewUpdateContact returns a new save to contact event

func (*UpdateContactEvent) Apply added in v0.4.0

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

Apply applies this event to the given run

func (*UpdateContactEvent) Type

func (e *UpdateContactEvent) Type() string

Type returns the type of this event

type WebhookCalledEvent

type WebhookCalledEvent struct {
	BaseEvent
	URL        string                      `json:"url"         validate:"required"`
	Status     utils.RequestResponseStatus `json:"status"      validate:"required"`
	StatusCode int                         `json:"status_code" validate:"required"`
	Request    string                      `json:"request"     validate:"required"`
	Response   string                      `json:"response"`
}

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 utils.RequestResponseStatus, statusCode int, request string, response string) *WebhookCalledEvent

NewWebhookCalledEvent returns a new webhook called event

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) 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