Documentation
¶
Index ¶
- Constants
- func EventFromEnvelope(envelope *utils.TypedEnvelope) (flows.Event, error)
- func ReadEvents(envelopes []*utils.TypedEnvelope) ([]flows.Event, error)
- type BaseEvent
- type BroadcastCreatedEvent
- type ContactChangedEvent
- type ContactChannelChangedEvent
- type ContactFieldChangedEvent
- type ContactGroupsAddedEvent
- type ContactGroupsRemovedEvent
- type ContactPropertyChangedEvent
- type ContactURNAddedEvent
- type EmailCreatedEvent
- type EnvironmentChangedEvent
- type ErrorEvent
- type FlowTriggeredEvent
- type InputLabelsAddedEvent
- type MsgReceivedEvent
- type MsgWaitEvent
- type NothingWaitEvent
- type RunExpiredEvent
- type RunResultChangedEvent
- type SessionTriggeredEvent
- type WebhookCalledEvent
Constants ¶
const TypeBroadcastCreated string = "broadcast_created"
TypeBroadcastCreated is a constant for outgoing message events
const TypeContactChanged string = "contact_changed"
TypeContactChanged is the type of our set contact event
const TypeContactChannelChanged string = "contact_channel_changed"
TypeContactChannelChanged is the type of our set preferred channel event
const TypeContactFieldChanged string = "contact_field_changed"
TypeContactFieldChanged is the type of our save to contact event
const TypeContactGroupsAdded string = "contact_groups_added"
TypeContactGroupsAdded is the type of our add to group action
const TypeContactGroupsRemoved string = "contact_groups_removed"
TypeContactGroupsRemoved is the type fo our remove from group action
const TypeContactPropertyChanged string = "contact_property_changed"
TypeContactPropertyChanged is the type of our update contact event
const TypeContactURNAdded string = "contact_urn_added"
TypeContactURNAdded is the type of our add URN event
const TypeEmailCreated string = "email_created"
TypeEmailCreated is our type for the email event
const TypeEnvironmentChanged string = "environment_changed"
TypeEnvironmentChanged is the type of our environment changed event
const TypeError string = "error"
TypeError is the type of our error events
const TypeFlowTriggered string = "flow_triggered"
TypeFlowTriggered is the type of our flow triggered event
const TypeInputLabelsAdded string = "input_labels_added"
TypeInputLabelsAdded is the type of our add label action
const TypeMsgReceived string = "msg_received"
TypeMsgReceived is a constant for incoming messages
const TypeMsgWait string = "msg_wait"
TypeMsgWait is the type of our msg wait event
const TypeNothingWait string = "nothing_wait"
TypeNothingWait is the type of our nothing wait event
const TypeRunExpired string = "run_expired"
TypeRunExpired is the type of our flow expired event
const TypeRunResultChanged string = "run_result_changed"
TypeRunResultChanged is the type of our run result event
const TypeSessionTriggered string = "session_triggered"
TypeSessionTriggered is the type of our session triggered event
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 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) FromCaller ¶ added in v0.4.0
func (*BaseEvent) SetCreatedOn ¶
func (*BaseEvent) SetFromCaller ¶ added in v0.4.0
type BroadcastCreatedEvent ¶ added in v0.5.0
type BroadcastCreatedEvent struct { BaseEvent Text string `json:"text"` Attachments []string `json:"attachments,omitempty"` QuickReplies []string `json:"quick_replies,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"` }
BroadcastCreatedEvent events are created for outgoing messages.
```
{ "type": "broadcast_created", "created_on": "2006-01-02T15:04:05Z", "text": "hi, what's up", "attachments": [], "quick_replies": ["Doing Fine", "Got 99 problems"], "urns": ["tel:+12065551212"], "contacts": [{"uuid": "0e06f977-cbb7-475f-9d0b-a0c4aaec7f6a", "name": "Bob"}] }
```
@event broadcast_created
func NewBroadcastCreatedEvent ¶ added in v0.5.0
func NewBroadcastCreatedEvent(text string, attachments []string, quickReples []string, urns []urns.URN, contacts []*flows.ContactReference, groups []*flows.GroupReference) *BroadcastCreatedEvent
NewBroadcastCreatedEvent creates a new outgoing msg event for the given recipients
func NewMsgCreatedEvent ¶ added in v0.5.0
func NewMsgCreatedEvent(text string, attachments []string, quickReples []string, contact *flows.ContactReference) *BroadcastCreatedEvent
NewMsgCreatedEvent creates a new outgoing msg event to a single contact
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) Type ¶ added in v0.5.0
func (e *BroadcastCreatedEvent) Type() string
Type returns the type of this event
type ContactChangedEvent ¶ added in v0.5.0
type ContactChangedEvent struct { BaseEvent Contact json.RawMessage `json:"contact"` }
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) Apply ¶ added in v0.5.0
func (e *ContactChangedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*ContactChangedEvent) Type ¶ added in v0.5.0
func (e *ContactChangedEvent) Type() string
Type returns the type of this event
type ContactChannelChangedEvent ¶ added in v0.5.0
type ContactChannelChangedEvent struct { BaseEvent Channel *flows.ChannelReference `json:"channel" validate:"required"` }
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) Apply ¶ added in v0.5.0
func (e *ContactChannelChangedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*ContactChannelChangedEvent) Type ¶ added in v0.5.0
func (e *ContactChannelChangedEvent) Type() string
Type returns the type of this event
type ContactFieldChangedEvent ¶ added in v0.5.0
type ContactFieldChangedEvent struct { BaseEvent Field *flows.FieldReference `json:"field" validate:"required"` Value string `json:"value" validate:"required"` }
ContactFieldChangedEvent events are created when a contact field is updated.
```
{ "type": "contact_field_changed", "created_on": "2006-01-02T15:04:05Z", "field": {"key": "gender", "label": "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) Apply ¶ added in v0.5.0
func (e *ContactFieldChangedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*ContactFieldChangedEvent) Type ¶ added in v0.5.0
func (e *ContactFieldChangedEvent) Type() string
Type returns the type of this event
type ContactGroupsAddedEvent ¶ added in v0.5.0
type ContactGroupsAddedEvent struct { BaseEvent Groups []*flows.GroupReference `json:"groups" validate:"required,min=1,dive"` }
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) Apply ¶ added in v0.5.0
func (e *ContactGroupsAddedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*ContactGroupsAddedEvent) Type ¶ added in v0.5.0
func (e *ContactGroupsAddedEvent) Type() string
Type returns the type of this event
type ContactGroupsRemovedEvent ¶ added in v0.5.0
type ContactGroupsRemovedEvent struct { Groups []*flows.GroupReference `json:"groups" validate:"required,min=1,dive"` BaseEvent }
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) Apply ¶ added in v0.5.0
func (e *ContactGroupsRemovedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*ContactGroupsRemovedEvent) Type ¶ added in v0.5.0
func (e *ContactGroupsRemovedEvent) Type() string
Type returns the type of this event
type ContactPropertyChangedEvent ¶ added in v0.5.0
type ContactPropertyChangedEvent struct { BaseEvent Property string `json:"property" validate:"required,eq=name|eq=language"` Value string `json:"value"` }
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) Apply ¶ added in v0.5.0
func (e *ContactPropertyChangedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*ContactPropertyChangedEvent) Type ¶ added in v0.5.0
func (e *ContactPropertyChangedEvent) Type() string
Type returns the type of this event
type ContactURNAddedEvent ¶ added in v0.5.0
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) Apply ¶ added in v0.5.0
func (e *ContactURNAddedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*ContactURNAddedEvent) Type ¶ added in v0.5.0
func (e *ContactURNAddedEvent) Type() string
Type returns the type of this event
type EmailCreatedEvent ¶ added in v0.5.0
type EmailCreatedEvent struct { BaseEvent Addresses []string `json:"addresses" validate:"required,min=1"` Subject string `json:"subject" validate:"required"` Body string `json:"body"` }
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) Apply ¶ added in v0.5.0
func (e *EmailCreatedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*EmailCreatedEvent) Type ¶ added in v0.5.0
func (a *EmailCreatedEvent) Type() string
Type returns the type of this event
type EnvironmentChangedEvent ¶ added in v0.5.0
type EnvironmentChangedEvent struct { BaseEvent Environment json.RawMessage `json:"environment"` }
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) Apply ¶ added in v0.5.0
func (e *EnvironmentChangedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*EnvironmentChangedEvent) Type ¶ added in v0.5.0
func (e *EnvironmentChangedEvent) Type() string
Type returns the type of this event
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
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 InputLabelsAddedEvent ¶ added in v0.5.0
type InputLabelsAddedEvent struct { BaseEvent InputUUID flows.InputUUID `json:"input_uuid" validate:"required,uuid4"` Labels []*flows.LabelReference `json:"labels" validate:"required,min=1,dive"` }
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) Apply ¶ added in v0.5.0
func (e *InputLabelsAddedEvent) Apply(run flows.FlowRun) error
Apply applies this event to the given run
func (*InputLabelsAddedEvent) Type ¶ added in v0.5.0
func (e *InputLabelsAddedEvent) Type() string
Type returns the type of this event
type MsgReceivedEvent ¶
type MsgReceivedEvent struct { BaseEvent Msg json.RawMessage `json:"msg" validate:"required"` }
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", "channel": {"uuid": "61602f3e-f603-4c70-8a8f-c477505bf4bf", "name": "Twilio"}, "created_on": "2006-01-02T15:04:04.454789Z", "urn": "tel:+12065551212", "text": "hi there", "attachments": ["https://s3.amazon.com/mybucket/attachment.jpg"] } }
```
@event msg_received
func NewMsgReceivedEvent ¶
func NewMsgReceivedEvent(msg *inputs.MsgInput) *MsgReceivedEvent
NewMsgReceivedEvent creates a new incoming msg event for the passed in channel, URN and text
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 ¶
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 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 RunResultChangedEvent ¶ added in v0.5.0
type RunResultChangedEvent struct { BaseEvent 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"` Input string `json:"input,omitempty"` }
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, input string) *RunResultChangedEvent
NewRunResultChangedEvent returns a new save result event for the passed in values
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) 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 { 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 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
Source Files
¶
- base.go
- broadcast_created.go
- contact_changed.go
- contact_channel_changed.go
- contact_field_changed.go
- contact_groups_added.go
- contact_groups_removed.go
- contact_property_changed.go
- contact_urn_added.go
- email_created.go
- envelope.go
- environment_changed.go
- error.go
- flow_triggered.go
- input_labels_added.go
- msg_received.go
- msg_wait.go
- nothing_wait.go
- run_expired.go
- run_result_changed.go
- session_triggered.go
- webhook_called.go