View on GitHub

relay-go

Build workflows for your Relays

sdk

import "command-line-arguments"

Index

Constants

const (
    // An error has occurred while running your workflow.  If you have DEBUG level
    // logging turned on, take a look at the logs to track down the error.  In
    // most cases, this occurrs when the wrong type of URN is sent in the payload
    // to the server.
    ERROR = "error"

    // Your workflow has been triggered
    START = "start"

    // Your workflow has stopped, which might be due to a normal completion after you call
    // terminate() or from an abnormal completion error.
    STOP = "stop"

    // An interaction lifecycle event has occurred.  This could indicate that an interaction
    // has started, resumed, been suspended, ended, or failed.
    INTERACTION_LIFECYCLE = "interaction_lifecycle"

    // A button has been pressed on your device during a running workflow.  This event occurs on a single, double or triple
    // tap of the action button or a tap of the assistant button.  Note this is separate from a button
    // trigger.
    BUTTON = "button"

    // An unnamed timer has fired.
    TIMER = "timer"

    // You have spoken into the device by holding down the action button. Typically seen
    // when the listen() funcitonis happening on a device.
    SPEECH = "speech"

    // A device has acknowledged an alert that was sent out to a group of devices.
    NOTIFICATION = "notification"

    // An incident has been resolved.
    INCIDENT = "incident"

    // When a text-to-speech is being streamed to a Relay device, this event will mark
    // the beginning and end of that stream delivery.
    PROMPT = "prompt"

    // The beginning of text-to-speech on the device.
    PROMPT_START = "prompt_start"

    // The end of text-to-speech on the device.
    PROMPT_STOP = "prompt_stop"

    // The device we called is ringing. We are waiting for them to answer.
    // This event can occur on the caller.
    CALL_RINGING = "call_ringing"

    // A call attempt that was ringing, progressing, or incoming is now fully
    // connected. This event can occur on both the caller and the callee.
    CALL_CONNECTED = "call_connected"

    // A call that was once connected has become disconnected. This event can
    // occur on both the caller and the callee.
    CALL_DISCONNECTED = "call_disconnected"

    // A call failed to get connected. This event can occur on both the caller
    // and the callee.
    CALL_FAILED = "call_failed"

    // The device is receiving an inbound call request. This event can occur
    // on the callee.
    CALL_RECEIVED = "call_received"

    // There is a request to make an outbound call. This event can occur on
    // the caller after using the "Call X" voice command on the Assistant.
    CALL_START_REQUEST = "call_start_request"

    // A named timer has fired.
    TIMER_FIRED = "timer_fired"
)
const (
    PHRASE_TRIGGER    = "phrase"
    BUTTON_TRIGGER    = "button"
    HTTP_TRIGGER      = "http"
    OTHER_TRIGGER     = "other"
    NFC_TRIGGER       = "nfc"
    CALENDAR_TRIGGER  = "calendar"
    GEOFENCE_TRIGGER  = "geofence"
    TELEPHONY_TRIGGER = "telephony"
)
const (
    EVENT    = "event"
    RESPONSE = "response"
)
const (
    ENGLISH    = `en-US`
    GERMAN     = `de-DE`
    SPANISH    = `es-ES`
    FRENCH     = `fr-FR`
    ITALIAN    = `it-IT`
    RUSSIAN    = `ru-RU`
    SWEDISH    = `sv-SE`
    TURKISH    = `tr-TR`
    HINDI      = `hi-IN`
    ICELANDIC  = `is-IS`
    JAPANESE   = `ja-JP`
    KOREAN     = `ko-KR`
    POLISH     = `pl-PK`
    PORTUGUESE = `pt-BR`
    NORWEGIAN  = `nb-NO`
    DUTCH      = `nl-NL`
    CHINESE    = `zh`
    ARABIC     = `ar`
    VIETNAMESE = `vi-VN`
    INDONESIAN = `id-ID`
    FILIPINO   = `fil-PH`
    DANISH     = `da-DK`
    CZECH      = `cs-CZ`
    GUJURATI   = `gu-IN`
    HUNGARIAN  = `hu-HU`
    TAMIL      = `ta-IN`
    UKRANIAN   = `uk-UA`
    SLOVAK     = `sk-SK`
    ROMANIAN   = `ro-RO`
    PUNJABI    = `pa-IN`
    MALAY      = `ms-MY`
    BENGALI    = `bn-IN`
    GREEK      = `el-GR`
    KANNADA    = `kn-IN`
    FINNISH    = `fi-FI`
)
const (
    TIMEOUT_TIMER_TYPE  = "timeout"
    INTERVAL_TIMER_TYPE = "interval"
)
const (
    MS_TIMEOUT_TYPE   = "ms"
    SECS_TIMEOUT_TYPE = "secs"
    MINS_TIMEOUT_TYPE = "mins"
    HRS_TIMEOUT_TYPE  = "hrs"
)
const (
    DEVICE_INFO_QUERY_NAME             = "name"
    DEVICE_INFO_QUERY_ID               = "id"
    DEVICE_INFO_QUERY_ADDRESS          = "address"
    DEVICE_INFO_QUERY_LATLONG          = "latlong"
    DEVICE_INFO_QUERY_INDOOR_LOCATION  = "indoor_location"
    DEVICE_INFO_QUERY_BATTERY          = "battery"
    DEVICE_INFO_QUERY_TYPE             = "type"
    DEVICE_INFO_QUERY_USERNAME         = "username"
    DEVICE_INFO_QUERY_LOCATION_ENABLED = "location_enabled"
)
const (
    NORMAL   = `normal`
    HIGH     = `high`
    CRITICAL = `critical`
)
const (
    DEFAULT = `default`
    SOS     = `sos`
)
const (
    LED_RAINBOW = "rainbow"
    LED_ROTATE  = "rotate"
    LED_FLASH   = "flash"
    LED_BREATHE = "breathe"
    LED_STATIC  = "static"
    LED_OFF     = "off"
)
const (
    SET_DEVICE_INFO_LABEL            = "label"
    SET_DEVICE_INFO_LOCATION_ENABLED = "location_enabled"
)
const (
    DEVICE_MODE_PANIC = "panic"
    DEVICE_MODE_ALARM = "alarm"
    DEVICE_MODE_NONE  = "none"
)

Variables

Used to specify that the URN is for a device.

var DEVICE string = "device"

Pattern used when creating an interaction URN.

var DEVICE_PATTERN string = "?device="

Used to specify that the URN is for a group.

var GROUP string = "group"

Used to specify that the URN is for an ID.

var ID string = "id"

Used to specify that the URN is for an interaction.

var INTERACTION string = "interaction"

Beginning of an interaction URN that uses the ID of a device.

var INTERACTION_URI_ID string = "urn:relay-resource:id:interaction"

Beginning of an interaction URN that uses the name of a device.

var INTERACTION_URI_NAME string = "urn:relay-resource:name:interaction"

Used to specify that the URN is for a name.

var NAME string = "name"

The root used for creating a URN.

var ROOT string = "relay-resource"

The scheme used for creating a URN.

var SCHEME string = "urn"
var auth_hostname string = "auth.relaygo.com"
var eventRegex = regexp.MustCompile(`^wf_api_(.+)_event$`)
var responseRegex = regexp.MustCompile(`^wf_api_(.+)_response$`)

Used only for TriggerWorkflow and FetchDevice

var serverHostname string = "all-main-pro-ibot.relaysvr.com"

boolean variable used to keep track of whether or not streaming is complete on the device. Mainly used for the functions SayAndWait and PlayAndWait, which require streaming to complete on the device before continuing through the workflow.

var streamingComplete bool
var upgrader = websocket.Upgrader{
    ReadBufferSize:  1024,
    WriteBufferSize: 1024,
}
var version string = "relay-sdk-go/2.0.0-pre"
var workflowMap map[string]func(api RelayApi) = make(map[string]func(api RelayApi))

func AddWorkflow

func AddWorkflow(workflowName string, fn func(api RelayApi))

func DeviceId

func DeviceId(id string) string

Creates a URN from a device ID. Returns the constructed URN as a string.

func DeviceName

func DeviceName(name string) string

Creates a URN from a device name. Returns the constructed URN as a string.

func FetchDevice

func FetchDevice(accessToken string, refreshToken string, clientId string, subscriberId string, userId string) map[string]string

A convenience method for getting all the details of a device. This will return quite a bit of data regarding device configuration and state. The result, if the query was successful, should have a large JSON dictionary.

func GroupId

func GroupId(id string) string

Creates a URN from a group ID. Returns the constructed URN as a string.

func GroupMember

func GroupMember(group string, device string) string

Creates a URN for a group member. Returns the constructed URN as a string.

func GroupName

func GroupName(name string) string

Creates a URN from a group name. Returns the constructed URN as a string.

func InitializeRelaySdk

func InitializeRelaySdk(port string)

this should return an interface that has a workflow() function that they can pass their workflow implementations to

func InteractionName

func InteractionName(name string) string

Creates a URN from an interaction name. Returns the constructed URN as a string.

func IsInteractionUri

func IsInteractionUri(uri string) bool

Checks if the URN is for an interaction. Returns true if the URN is for an interaction, false otherwise.

func IsRelayUri

func IsRelayUri(uri string) bool

Checks if the URN is a Relay URN. Returns true if the URN is a Relay URN, false otherwise.

func ParseDeviceId

func ParseDeviceId(uri string) string

Parses out a device ID from a device or interaction URN. Returns the ID of the device as a string.

func ParseDeviceName

func ParseDeviceName(uri string) string

Parses out a device name from a device or interaction URN. Returns the name of the device as a string.

func ParseGroupId

func ParseGroupId(uri string) string

Parses out a group ID from a group URN. Returns the ID of a group as a string.

func ParseGroupName

func ParseGroupName(uri string) string

Parses out a group name from a group URN. Returns the name of the group as a string.

func TriggerWorkflow

func TriggerWorkflow(accessToken string, refreshToken string, clientId string, workflowId string, subscriberId string, userId string, targets []string, actionArgs map[string]string) map[string]string

A convenience method for sending an HTTP trigger to the Relay server. This generally would be used in a third-party system to start a Relay workflow via an HTTP trigger and optionally pass data to it with action_args. If the access_token has expired and the request gets a 401 response, a new access_token will be automatically generated via the refresh_token, and the request will be resubmitted with the new access_token. Otherwise the refresh token won’t be used. This method will return a tuple of (requests.Response, access_token) where you can inspect the http response, and get the updated access_token if it was updated (otherwise the original access_token will be returned).

func construct

func construct(resourceType string, idtype string, idOrName string) string

func handleWs

func handleWs(w http.ResponseWriter, r *http.Request)

func makeId

func makeId() string

func makeTargetMap

func makeTargetMap(sourceUri string) map[string][]string

func parseMessage

func parseMessage(msg []byte) (map[string]interface{}, Event, string)

func startWorkflow

func startWorkflow(wfInst *workflowInstance, workflowName string)

func updateAccessToken

func updateAccessToken(refreshToken string, clientId string) string

type AnswerResponse

type AnswerResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
}

type ButtonEvent

type ButtonEvent struct {
    _type     string `json:"_type"`
    SourceUri string `json:"source_uri"`
    Button    string `json:"button"` // "action", "channel"
    Taps      string `json:"taps"`   // "single", "double", "triple", "long"
}

type Call

Call represents an active request

type Call struct {
    Req          interface{}
    Res          interface{}
    EventWrapper EventWrapper
    Done         chan bool
    Error        error
}

type CallConnectedEvent

type CallConnectedEvent struct {
    _type            string `json:"_type"`
    CallId           string `json:"call_id"`
    Direction        string `json:"direction"`
    DeviceId         string `json:"device_id"`
    DeviceName       string `json:"device_name"`
    Uri              string `json:"uri"`
    OnNet            string `json:"onnet"`
    StartTimeEpoch   string `json:"start_time_epoch"`
    ConnectTimeEpoch string `json:"connect_time_epoch"`
}

type CallDisconnectedEvent

type CallDisconnectedEvent struct {
    _type            string `json:"_type"`
    CallId           string `json:"call_id"`
    Direction        string `json:"direction"`
    DeviceId         string `json:"device_id"`
    DeviceName       string `json:"device_name"`
    Uri              string `json:"uri"`
    OnNet            string `json:"onnet"`
    Reason           string `json:"reason"`
    StartTimeEpoch   int64  `json:"start_time_epoch"`
    ConnectTimeEpoch int64  `json:"connect_time_epoch"`
    EndTimeEpoch     int64  `json:"end_time_epoch"`
}

type CallFailedEvent

type CallFailedEvent struct {
    _type            string `json:"_type"`
    CallId           string `json:"call_id"`
    Direction        string `json:"direction"`
    DeviceId         string `json:"device_id"`
    DeviceName       string `json:"device_name"`
    Uri              string `json:"uri"`
    OnNet            string `json:"onnnet"`
    Reason           string `json:"reason"`
    StartTimeEpoch   string `json:"start_time_epoch"`
    ConnectTimeEpoch string `json:"connect_time_epoch"`
    EndTimeEpoch     string `json:"end_time_epoch"`
}

type CallProgressingEvent

type CallProgressingEvent struct {
    _type          string `json:"_type"`
    CallId         string `json:"call_id"`
    Direction      string `json:"direction"`
    DeviceId       string `json:"device_id"`
    DeviceName     string `json:"device_name"`
    Uri            string `json:"uri"`
    OnNet          string `json:"onnet"`
    StartTimeEpoch string `json:"start_time_epoch"`
}

type CallReceivedEvent

type CallReceivedEvent struct {
    _type          string `json:"_type"`
    CallId         string `json:"call_id"`
    Direction      string `json:"direction"`
    DeviceId       string `json:"device_id"`
    DeviceName     string `json:"device_name"`
    Uri            string `json:"uri"`
    OnNet          string `json:"onnet"`
    StartTimeEpoch string `json:"start_time_epoch"`
}

type CallRingingEvent

type CallRingingEvent struct {
    _type          string `json:"_type"`
    CallId         string `json:"call_id"`
    Direction      string `json:"direction"`
    DeviceId       string `json:"device_id"`
    DeviceName     string `json:"device_name"`
    Uri            string `json:"uri"`
    OnNet          string `json:"onnet"`
    StartTimeEpoch string `json:"start_time_epoch"`
}

type CallStartEvent

type CallStartEvent struct {
    _type string `json:"_type"`
    Uri   string `json:"uri"`
}

type ClearTimerResponse

type ClearTimerResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type CreateIncidentResponse

type CreateIncidentResponse struct {
    _id        string `json:"_id"`
    _type      string `json:"_type"`
    IncidentId string `json:"incident_id"`
}

type DeviceInfoQuery

Information dealing with the device name, id, type, locatin, battery, and username.

type DeviceInfoQuery string

type DeviceMode

type DeviceMode string

type DevicePowerOffResponse

type DevicePowerOffResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type EndInteractionResponse

type EndInteractionResponse struct {
    _type     string `json:"_type"`
    _id       string `json:"_id"`
    SourceUri string `json:"source_uri"`
}

type Event

type Event string

type EventWrapper

type EventWrapper struct {
    ParsedMsg map[string]interface{}
    Msg       []byte
    EventName Event
}

type GetDeviceInfoResponse

type GetDeviceInfoResponse struct {
    _type           string    `json:"_type"`
    _id             string    `json:"_id"`
    Name            string    `json:"name"`
    Id              string    `json:"id"`
    Address         string    `json:"address"`
    LatLong         []float64 `json:"latlong"`
    IndoorLocation  string    `json:"indoor_location"`
    Battery         uint64    `json:"battery"`
    Type            string    `json:"type"`
    Username        string    `json:"username"`
    LocationEnabled bool      `json:"location_enabled"`
}

type GetVarResponse

type GetVarResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
    Value string `json:"value"`
}

type GroupQueryResponse

type GroupQueryResponse struct {
    _id        string   `json:"_id"`
    _type      string   `json:"_type"`
    MemberUris []string `json:"member_uris"`
    IsMember   bool     `json:"is_member"`
}

type HangupCallResponse

type HangupCallResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
}

type InboxCountResponse

type InboxCountResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
    Count string `json:"count"`
}

type IncidentEvent

type IncidentEvent struct {
    _type      string `json:"_type"`
    Type       string `json:"type"`
    IncidentId string `json:"incident_id"`
    Reason     string `json:"reason"`
}

type InteractionLifecycleEvent

type InteractionLifecycleEvent struct {
    _type         string `json:"_type"`
    SourceUri     string `json:"source_uri"`
    LifecycleType string `json:"type"` // started, resumed
}

type Language

The supported languages that can be used for speech, listening, or translation on the device.

type Language string

type LedColors

type LedColors struct {
    Ring  string `json:"ring,omitempty"`
    Led1  string `json:"1,omitempty"`
    Led2  string `json:"2,omitempty"`
    Led3  string `json:"3,omitempty"`
    Led4  string `json:"4,omitempty"`
    Led5  string `json:"5,omitempty"`
    Led6  string `json:"6,omitempty"`
    Led7  string `json:"7,omitempty"`
    Led8  string `json:"8,omitempty"`
    Led9  string `json:"9,omitempty"`
    Led10 string `json:"10,omitempty"`
    Led11 string `json:"11,omitempty"`
    Led12 string `json:"12,omitempty"`
    Led13 string `json:"13,omitempty"`
    Led14 string `json:"14,omitempty"`
    Led15 string `json:"15,omitempty"`
    Led16 string `json:"16,omitempty"`
}

func setLedColors

func setLedColors(index string, color string) LedColors

type LedEffect

type LedEffect string

type LedInfo

type LedInfo struct {
    Rotations      int64     `json:"rotations,omitempty"`
    Count          int64     `json:"count,omitempty"`
    Duration       uint64    `json:"duration,omitempty"`
    RepeatDelay    uint64    `json:"repeat_delay,omitempty"`
    PatternRepeats uint64    `json:"pattern_repeats,omitempty"`
    Colors         LedColors `json:"colors,omitempty"`
}

type ListenResponse

type ListenResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
}

type LogAnalyticsEventResponse

type LogAnalyticsEventResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
}

type MessageType

Whether the message back from the server is an event or response

type MessageType string

type NotificationEvent

type NotificationEvent struct {
    _type             string `json:"_type"`
    Name              string `json:"name"`
    Event             string `json:"event"`
    SourceUri         string `json:"source_uri"`
    NotificationState string `json:"notification_state"`
}

type NotificationOptions

type NotificationOptions struct {
    Priority NotificationPriority
    Title    string
    Body     string
    Sound    NotificationSound
}

type NotificationPriority

type NotificationPriority string

type NotificationSound

type NotificationSound string

type PlaceCallResponse

type PlaceCallResponse struct {
    _id     string `json:"_id"`
    _type   string `json:"_type"`
    call_id string `json:"call_id"`
}

type PlayInboxMessagesEvent

type PlayInboxMessagesEvent struct {
    _type  string `json:"_type"`
    Action string `json:"action"`
}

type PlayInboxMessagesResponse

type PlayInboxMessagesResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
}

type PlayResponse

type PlayResponse struct {
    _type         string `json:"_type"`
    _id           string `json:"_id"`
    CorrelationId string `json:"id"`
}

type ProgressEvent

type ProgressEvent struct {
    _type string `json:"_type"`
}

type PromptEvent

type PromptEvent struct {
    _type      string `json:"_type"`
    SourceUri  string `json:"source_uri"`
    PromptType string `json:"type"` // started, stopped, resumed
}

type RelayApi

type RelayApi interface {
    // assigning callbacks
    OnStart(fn func(startEvent StartEvent))
    OnInteractionLifecycle(fn func(interactionLifecycleEvent InteractionLifecycleEvent))
    OnPrompt(fn func(promptEvent PromptEvent)) // seperate into start and stop?
    OnTimerFired(fn func(timerFiredEvent TimerFiredEvent))
    OnButton(fn func(buttonEvent ButtonEvent))
    OnTimer(fn func(timerEvent TimerEvent))
    OnSpeech(fn func(speechEvent SpeechEvent))
    OnStop(fn func(stopEvent StopEvent))
    OnNotification(fn func(notificationEvent NotificationEvent))
    OnProgress(fn func(progressEvent ProgressEvent))
    OnPlayInboxMessages(fn func(playInboxMessagesEvent PlayInboxMessagesEvent))
    OnCallConnected(fn func(callConnectedEvent CallConnectedEvent))
    OnCallDisconnected(fn func(callDisconnectedEvent CallDisconnectedEvent))
    OnCallFailed(fn func(callFailedEvent CallFailedEvent))
    OnCallReceived(fn func(callReceivedEvent CallReceivedEvent))
    OnCallRinging(fn func(callRingingEvent CallRingingEvent))
    OnCallStartRequest(fn func(callStartEvent CallStartEvent))
    OnCallProgressing(fn func(callProgressingEvent CallProgressingEvent))
    OnSms(fn func(smsEvent SmsEvent))
    OnIncident(fn func(incidentEvent IncidentEvent))
    OnResume(fn func(resumeEvent ResumeEvent))

    // api
    GetSourceUri(startEvent StartEvent) string
    StartInteraction(sourceUri string, name string) StartInteractionResponse
    EndInteraction(sourceUri string) EndInteractionResponse
    SetTimer(timerType TimerType, name string, timeout uint64, timeoutType TimeoutType) SetTimerResponse
    ClearTimer(name string) ClearTimerResponse
    StartTimer(timeout int) StartTimerResponse // need to test timers
    CreateIncident(originator string, itype string) CreateIncidentResponse
    ResolveIncident(incidentId string, reason string) ResolveIncidentResponse
    Say(sourceUri string, text string, lang Language) SayResponse
    Alert(target string, originator string, name string, text string, pushOptions NotificationOptions) SendNotificationResponse
    CancelAlert(target string, name string) SendNotificationResponse
    SayAndWait(sourceUri string, text string, lang Language) SayResponse
    Listen(sourceUri string, phrases []string, transcribe bool, alt_lang Language, timeout int) string
    Translate(sourceUri string, text string, from Language, to Language) string
    LogMessage(message string, category string) LogAnalyticsEventResponse
    LogUserMessage(message string, sourceUri string, category string) LogAnalyticsEventResponse
    SetVar(name string, value string) SetVarResponse
    UnsetVar(name string) UnsetVarResponse
    GetVar(name string, defaultValue string) string
    GetNumberVar(name string, defaultValue int) int
    Play(sourceUri string, filename string) string
    PlayAndWait(sourceUri string, filename string) string
    StopPlayback(sourceUri string, ids []string) StopPlaybackResponse
    GetUnreadInboxSize(sourceUri string) int
    PlayUnreadInboxMessages(sourceUri string) PlayInboxMessagesResponse
    SwitchLedOn(sourceUri string, ledIndex int, color string) SetLedResponse
    SwitchAllLedOn(sourceUri string, color string) SetLedResponse
    SwitchAllLedOff(sourceUri string) SetLedResponse
    Rainbow(sourceUri string, rotations int64) SetLedResponse
    Rotate(sourceUri string, color string, rotations int64) SetLedResponse
    Flash(sourceUri string, color string, count int64) SetLedResponse
    Breathe(sourceUri string, color string, count int64) SetLedResponse
    Vibrate(sourceUri string, pattern []int64) VibrateResponse
    Broadcast(target string, originator string, name string, text string, pushOptions NotificationOptions) SendNotificationResponse
    CancelBroadcast(target string, name string) SendNotificationResponse
    GetDeviceName(sourceUri string, refresh bool) string
    GetDeviceId(sourceUri string, refresh bool) string
    GetDeviceAddress(sourceUri string, refresh bool) string
    GetDeviceLocation(sourceUri string, refresh bool) string
    GetDeviceLatLong(sourceUri string, refresh bool) []float64
    IsGroupMember(groupNameUri string, potentialMemberUri string) bool
    GetGroupMembers(groupUri string) []string
    GetDeviceCoordinates(sourceUri string, refresh bool) []float64
    GetDeviceIndoorLocation(sourceUri string, refresh bool) string
    GetDeviceBattery(sourceUri string, refresh bool) uint64
    GetDeviceType(sourceUri string, refresh bool) string
    GetUserProfile(sourceUri string, refresh bool) string
    GetDeviceLocationEnabled(sourceUri string, refresh bool) bool
    SetDeviceName(sourceUri string, name string) SetDeviceInfoResponse
    EnableHomeChannel(sourceUri string) SetHomeChannelStateResponse
    DisableHomeChannel(sourceUri string) SetHomeChannelStateResponse
    // SetDeviceChannel(sourceUri string, channel string) SetDeviceInfoResponse
    EnableLocation(sourceUri string) SetDeviceInfoResponse
    DisableLocation(sourceUri string) SetDeviceInfoResponse
    SetUserProfile(sourceUri string, username string, force bool) SetUserProfileResponse
    SetChannel(sourceUri string, channelName string, suppressTTS bool, disableHomeChannel bool) SetChannelResponse
    // SetDeviceMode(sourceUri string, mode DeviceMode) SetDeviceModeResponse
    // RestartDevice(sourceUri string) DevicePowerOffResponse
    // PowerDownDevice(sourceUri string) DevicePowerOffResponse
    PlaceCall(targetUri string, uri string) PlaceCallResponse
    AnswerCall(sourceUri string, callId string) AnswerResponse
    HangupCall(targetUri string, callId string) HangupCallResponse
    Terminate()
}

type ResolveIncidentResponse

type ResolveIncidentResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
}

type ResumeEvent

type ResumeEvent struct {
    _type string `json:"_type"`
}

type SayResponse

type SayResponse struct {
    _type         string `json:"_type"`
    _id           string `json:"_id"`
    CorrelationId string `json:"id"`
}

type SendNotificationResponse

type SendNotificationResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
}

type SetChannelResponse

type SetChannelResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type SetDeviceInfoResponse

type SetDeviceInfoResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type SetDeviceInfoType

type SetDeviceInfoType string

type SetDeviceModeResponse

type SetDeviceModeResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type SetHomeChannelStateResponse

type SetHomeChannelStateResponse struct {
    _type string `json:"_type"`
    Id    string `json:"_id"`
}

type SetLedResponse

type SetLedResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type SetTimerResponse

type SetTimerResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type SetUserProfileResponse

type SetUserProfileResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type SetVarResponse

type SetVarResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
    Name  string `json:"name"`
    IType string `json:"type"`
    Value string `json:"value"`
}

type SmsEvent

type SmsEvent struct {
    Id    string `json:"id"`
    Event string `json:"event"`
}

type SpeechEvent

type SpeechEvent struct {
    _id       string `json:"_id"`
    _type     string `json:"_type"`
    SourceUri string `json:"source_uri"`
    ReuqestId string `json:"request_id"`
    Text      string `json:"text"`
    Audio     string `json:"audio"`
    Lang      string `json:"lang"`
}

type StartEvent

type StartEvent struct {
    _type   string `json:"_type"`
    Trigger Trigger
}

type StartInteractionResponse

type StartInteractionResponse struct {
    _type     string `json:"_type"`
    _id       string `json:"_id"`
    SourceUri string `json:"source_uri"`
}

type StartTimerResponse

type StartTimerResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
}

type StopEvent

type StopEvent struct {
    _type  string `json:"_type"`
    Reason string `json:"reason"`
}

type StopPlaybackResponse

type StopPlaybackResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type StopTimerResponse

type StopTimerResponse struct {
    _id   string `json"_id"`
    _type string `json:"_type"`
}

type TimeoutType

The timeout type for a timer. Can be either milliseconds, seconds, minutes or hours.

type TimeoutType string

type TimerEvent

type TimerEvent struct {
    _type string `json:"_type"`
}

type TimerFiredEvent

type TimerFiredEvent struct {
    _type string `json:"_type"`
    Name  string `json:"name"`
}

type TimerType

Type of timer on the device. Can be timeout or interval timer type.

type TimerType string

type TranslateResponse

type TranslateResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
    Text  string `json:"text"`
}

type Trigger

type Trigger struct {
    Type TriggerType
    Args TriggerArgs
}

type TriggerArgs

type TriggerArgs struct {
    Phrase    string `json:"phrase"`
    SourceUri string `json:"source_uri"`
}

type TriggerType

The different types of triggers that can start a workflow.

type TriggerType string

type UnsetVarResponse

type UnsetVarResponse struct {
    _id   string `json:"_id"`
    _type string `json:"_type"`
}

type VibrateResponse

type VibrateResponse struct {
    _type string `json:"_type"`
    _id   string `json:"_id"`
}

type answerRequest

type answerRequest struct {
    Id     string              `json:"_id"`
    Target map[string][]string `json:"_target"`
    Type   string              `json:"_type"`
    CallId string              `json:"call_id"`
}

type clearTimerRequest

type clearTimerRequest struct {
    Type string `json:"_type"`
    Id   string `json:"_id"`
    Name string `json:"name"`
}

type createIncidentRequest

type createIncidentRequest struct {
    Id            string `json:"_id"`
    Type          string `json:"_type"`
    IncidentType  string `json:"type"`
    OriginatorUri string `json:"originator_uri"`
}

type devicePowerOffRequest

type devicePowerOffRequest struct {
    Type    string              `json:"_type"`
    Id      string              `json:"_id"`
    Target  map[string][]string `json:"_target"`
    Restart bool                `json:"restart"`
}

type endInteractionRequest

type endInteractionRequest struct {
    Type    string              `json:"_type"`
    Id      string              `json:"_id"`
    Targets map[string][]string `json:"_target"`
}

type getDeviceInfoRequest

type getDeviceInfoRequest struct {
    Type    string              `json:"_type"`
    Id      string              `json:"_id"`
    Target  map[string][]string `json:"_target"`
    Query   DeviceInfoQuery     `json:"query"`
    Refresh bool                `json:"refresh"`
}

type getVarRequest

type getVarRequest struct {
    Id   string `json:"_id"`
    Type string `json:"_type"`
    Name string `json:"name"`
}

type groupQueryRequest

type groupQueryRequest struct {
    Id       string `json:"_id"`
    Type     string `json:"_type"`
    GroupUri string `json:"group_uri"`
    Query    string `json:"query"`
}

type hangupCallRequest

type hangupCallRequest struct {
    Id     string              `json:"_id"`
    Target map[string][]string `json:"_target"`
    Type   string              `json:"_type"`
    CallId string              `json:"call_id"`
}

type inboxCountRequest

type inboxCountRequest struct {
    Id     string              `json:"_id"`
    Target map[string][]string `json:"_target"`
    Type   string              `json:"_type"`
}

type listenRequest

type listenRequest struct {
    Id         string              `json:"_id"`
    Target     map[string][]string `json:"_target"`
    Type       string              `json:"_type"`
    ReqestId   string              `json:"request_id"`
    Phrases    []string            `json:"phrases"`
    Transcribe bool                `json:"transcribe"`
    Timeout    int                 `json:"timeout"`
    AltLang    string              `json:"alt_lang"`
}

type logAnalyticsEventRequest

type logAnalyticsEventRequest struct {
    Id          string `json:"_id"`
    Type        string `json:"_type"`
    Content     string `json:"content"`
    ContentType string `json:"content_type"`
    Category    string `json:"category"`
    DeviceUri   string `json":"device_uri,omitempty"`
}

type placeCallRequest

type placeCallRequest struct {
    Id     string              `json:"_id"`
    Type   string              `json:"_type"`
    Target map[string][]string `json:"_target"`
    Uri    string              `json:"uri"`
}

type playInboxMessagesRequest

type playInboxMessagesRequest struct {
    Id     string              `json:"_id"`
    Target map[string][]string `json:"_target"`
    Type   string              `json:"_type"`
}

type playRequest

type playRequest struct {
    Type     string              `json:"_type"`
    Id       string              `json:"_id"`
    Target   map[string][]string `json:"_target"`
    Filename string              `json:"filename"`
}

type resolveIncidentRequest

type resolveIncidentRequest struct {
    Id         string `json:"_id"`
    Type       string `json:"_type"`
    IncidentId string `json:"incident_id"`
    Reason     string `json:"reason"`
}

type sayRequest

type sayRequest struct {
    Type   string              `json:"_type"`
    Id     string              `json:"_id"`
    Target map[string][]string `json:"_target"`
    Text   string              `json:"text"`
    Lang   Language            `json:"lang"`
}

type sendNotificationRequest

type sendNotificationRequest struct {
    Type        string              `json:"_type"`
    Id          string              `json:"_id"`
    Target      map[string][]string `json:"_target"`
    Originator  string              `json:"originator"`
    IType       string              `json:"type"`
    Name        string              `json:"name"`
    Text        string              `json:"text"`
    ITarget     map[string][]string `json:"target"`
    PushOptions NotificationOptions `json:"push_opts"`
}

type setChannelRequest

type setChannelRequest struct {
    Type               string              `json:"_type"`
    Id                 string              `json:"_id"`
    Target             map[string][]string `json:"_target"`
    ChannelName        string              `json:"channel_name"`
    SuppressTTS        bool                `json:"suppress_tts"`
    DisableHomeChannel bool                `json:"disable_home_channel"`
}

type setDeviceInfoRequest

type setDeviceInfoRequest struct {
    Type   string              `json:"_type"`
    Id     string              `json:"_id"`
    Target map[string][]string `json:"_target"`
    Field  SetDeviceInfoType   `json:"field"`
    Value  string              `json:"value"`
}

type setDeviceModeRequest

type setDeviceModeRequest struct {
    Type   string              `json:"_type"`
    Id     string              `json:"_id"`
    Target map[string][]string `json:"_target"`
    Mode   DeviceMode          `json:"mode"`
}

type setHomeChannelStateRequest

type setHomeChannelStateRequest struct {
    Type    string              `json:"_type"`
    Id      string              `json:"_id"`
    Target  map[string][]string `json:"_target"`
    Enabled bool                `json:"enabled"`
}

type setLedRequest

type setLedRequest struct {
    Type   string              `json:"_type"`
    Id     string              `json:"_id"`
    Target map[string][]string `json:"_target"`
    Effect LedEffect           `json:"effect"`
    Args   LedInfo             `json:"args"`
}

type setTimerRequest

type setTimerRequest struct {
    Type        string      `json:"_type"`
    Id          string      `json:"_id"`
    TimerType   TimerType   `json:"type"`
    Name        string      `json:"name"`
    Timeout     uint64      `json:"timeout"`
    TimeoutType TimeoutType `json:"timeout_type"`
}

type setUserProfileRequest

type setUserProfileRequest struct {
    Type     string              `json:"_type"`
    Id       string              `json:"_id"`
    Target   map[string][]string `json:"_target"`
    Username string              `json:"username"`
    Force    bool                `json:"force"`
}

type setVarRequest

type setVarRequest struct {
    Id    string `json:"_id"`
    Type  string `json:"_type"`
    Name  string `json:"name"`
    Value string `json:"value"`
}

type startInteractionRequest

type startInteractionRequest struct {
    Type    string              `json:"_type"`
    Id      string              `json:"_id"`
    Targets map[string][]string `json:"_target"`
    Name    string              `json:"name"`
}

type startTimerRequest

type startTimerRequest struct {
    Id      string `json:"_id"`
    Type    string `json:"_type"`
    Timeout int    `json:"timeout"`
}

type stopPlaybackRequest

type stopPlaybackRequest struct {
    Type   string              `json:"_type"`
    Id     string              `json:"_id"`
    Target map[string][]string `json:"_target"`
    Ids    []string            `json:"ids"`
}

type stopTimerRequest

type stopTimerRequest struct {
    Id   string `json:"_id"`
    Type string `json:"_type"`
}

type terminateRequest

type terminateRequest struct {
    Type string `json:"_type"`
    Id   string `json:"_id"`
}

type translateRequest

type translateRequest struct {
    Id       string   `json:"_id"`
    Type     string   `json:"_type"`
    Text     string   `json:"text"`
    FromLang Language `json:"from_lang"`
    ToLang   Language `json:"to_lang"`
}

type unsetVarRequest

type unsetVarRequest struct {
    Id   string `json:"_id"`
    Type string `json:"_type"`
    Name string `json:"name"`
}

type vibrateRequest

type vibrateRequest struct {
    Type    string              `json:"_type"`
    Id      string              `json:"_id"`
    Target  map[string][]string `json:"_target"`
    Pattern []int64             `json:"pattern"`
}

type workflowInstance

This struct implements RelayApi below

type workflowInstance struct {
    WebsocketConnection *websocket.Conn
    Mutex               sync.Mutex       // no initialization, zero value is unlocked mutex. this must not be copied, always pass workflowInstance by pointer
    Pending             map[string]*Call // map of request ids to the call struct for response pairing
    WorkflowFn          func(api RelayApi)

    EventChannel chan EventWrapper
    StopReason   string

    // stores callback functions for each event type
    OnStartHandler                func(startEvent StartEvent)
    OnInteractionLifecycleHandler func(interactionLifecycleEvent InteractionLifecycleEvent)
    OnPromptHandler               func(promptEvent PromptEvent)
    OnButtonHandler               func(buttonEvent ButtonEvent)
    OnTimerFiredHandler           func(timerFiredEvent TimerFiredEvent)
    OnTimerHandler                func(timerEvent TimerEvent)
    OnSpeechHandler               func(speechEvent SpeechEvent)
    OnStopHandler                 func(stopEvent StopEvent)
    OnNotificationHandler         func(notificationEvent NotificationEvent)
    OnProgressHandler             func(progressEvent ProgressEvent)
    OnPlayInboxMessagesHandler    func(playInboxMessagesEvent PlayInboxMessagesEvent)
    OnCallConnectedHandler        func(callConnectedEvent CallConnectedEvent)
    OnCallDisconnectedHandler     func(callDisconnected CallDisconnectedEvent)
    OnCallFailedHandler           func(callFailedEvent CallFailedEvent)
    OnCallReceivedHandler         func(callReceivedEvent CallReceivedEvent)
    OnCallRingingHandler          func(callRingingEvent CallRingingEvent)
    OnCallStartRequestHandler     func(callStartEvent CallStartEvent)
    OnCallProgressingHandler      func(callProgressingEvent CallProgressingEvent)
    OnSmsHandler                  func(smsEvent SmsEvent)
    OnIncidentHandler             func(incidentEvent IncidentEvent)
    OnResumeHandler               func(resumeEvent ResumeEvent)
}

func (*workflowInstance) Alert

func (wfInst *workflowInstance) Alert(target string, originator string, name string, text string, pushOptions NotificationOptions) SendNotificationResponse

Sends out an alert to the specified group of devices and the Relay Dash. Returns a SendNotificationResponse.

func (*workflowInstance) AnswerCall

func (wfInst *workflowInstance) AnswerCall(sourceUri string, callId string) AnswerResponse

Answers a call on your device. Returns an AnswerResponse.

func (*workflowInstance) Breathe

func (wfInst *workflowInstance) Breathe(sourceUri string, color string, count int64) SetLedResponse

Switches all of the LEDs on a device to a certain color and creates a ‘breathing’ effect, where the LEDs will slowly light up a specified number of times. Returns a SetLedResponse.

func (*workflowInstance) Broadcast

func (wfInst *workflowInstance) Broadcast(target string, originator string, name string, text string, pushOptions NotificationOptions) SendNotificationResponse

Sends out a broadcasted message to a group of devices. The message is played out on all devices, as well as sent to the Relay Dash. Returns a SendNotificationResponse.

func (*workflowInstance) CancelAlert

func (wfInst *workflowInstance) CancelAlert(target string, name string) SendNotificationResponse

Cancels an alert that was sent to a group of devices. Particularly useful if you would like to cancel the alert on all devices after one device has acknowledged the alert. Returns a SendNotificationResponse.

func (*workflowInstance) CancelBroadcast

func (wfInst *workflowInstance) CancelBroadcast(target string, name string) SendNotificationResponse

Cancels the broadcsat that was sent to a group of devices. Returns a SendNotificationResponse.

func (*workflowInstance) ClearTimer

func (wfInst *workflowInstance) ClearTimer(name string) ClearTimerResponse

Clears the specified timer. Returns a ClearTimerResponse.

func (*workflowInstance) CreateIncident

func (wfInst *workflowInstance) CreateIncident(originator string, itype string) CreateIncidentResponse

Creates an incident that will alert the Relay Dash. Returns a CreateIncidentResponse.

func (*workflowInstance) DisableHomeChannel

func (wfInst *workflowInstance) DisableHomeChannel(sourceUri string) SetHomeChannelStateResponse

Disables the home channel on the device. Returns the SetHomeChannelStateResponse.

func (*workflowInstance) DisableLocation

func (wfInst *workflowInstance) DisableLocation(sourceUri string) SetDeviceInfoResponse

Disables location services on a device. Location services will remain disabled until they are enabled on the Relay Dash or through a workflow. Returns a SendNotificationResponse.

func (*workflowInstance) EnableHomeChannel

func (wfInst *workflowInstance) EnableHomeChannel(sourceUri string) SetHomeChannelStateResponse

Enables the home channel on the device. Returns the SetHomeChannelStateResponse.

func (*workflowInstance) EnableLocation

func (wfInst *workflowInstance) EnableLocation(sourceUri string) SetDeviceInfoResponse

Enables location services on a device. Location services will remain enabled until they are disabled on the Relay Dash or through a workflow.

func (*workflowInstance) EndInteraction

func (wfInst *workflowInstance) EndInteraction(sourceUri string) EndInteractionResponse

Ends an interaction with the user. Triggers an INTERACTION_ENDED event to signify that the user is done interacting with the device. Returns an EndInteractionResponse.

func (*workflowInstance) Flash

func (wfInst *workflowInstance) Flash(sourceUri string, color string, count int64) SetLedResponse

Switches all of the LEDs on a device to a certain color and flashes them a specified number of times. Returns a SetLedResponse.

func (*workflowInstance) GetDeviceAddress

func (wfInst *workflowInstance) GetDeviceAddress(sourceUri string, refresh bool) string

Returns the address of a targeted device as a string.

func (*workflowInstance) GetDeviceBattery

func (wfInst *workflowInstance) GetDeviceBattery(sourceUri string, refresh bool) uint64

Returns the battery of a targeted device as a string.

func (*workflowInstance) GetDeviceCoordinates

func (wfInst *workflowInstance) GetDeviceCoordinates(sourceUri string, refresh bool) []float64

Retrieves the coordinates of the device’s location. Returns a float64 array containing the coordinates of the device.

func (*workflowInstance) GetDeviceId

func (wfInst *workflowInstance) GetDeviceId(sourceUri string, refresh bool) string

Returns the ID of the targeted device as a string.

func (*workflowInstance) GetDeviceIndoorLocation

func (wfInst *workflowInstance) GetDeviceIndoorLocation(sourceUri string, refresh bool) string

Returns the indoor location of a targeted device as a string.

func (*workflowInstance) GetDeviceLatLong

func (wfInst *workflowInstance) GetDeviceLatLong(sourceUri string, refresh bool) []float64

Returns the latitude and longitude coordinates of a targeted device. Returns a float64 array containing thecoordinates of the device.

func (*workflowInstance) GetDeviceLocation

func (wfInst *workflowInstance) GetDeviceLocation(sourceUri string, refresh bool) string

Returns the location of a targeted device as a string.

func (*workflowInstance) GetDeviceLocationEnabled

func (wfInst *workflowInstance) GetDeviceLocationEnabled(sourceUri string, refresh bool) bool

Returns whether the location services on a device are enabled as a boolean.

func (*workflowInstance) GetDeviceName

func (wfInst *workflowInstance) GetDeviceName(sourceUri string, refresh bool) string

Returns the name of a targeted device as a string.

func (*workflowInstance) GetDeviceType

func (wfInst *workflowInstance) GetDeviceType(sourceUri string, refresh bool) string

Returns the device type of a targeted device, i.e. gen 2, gen 3, etc. as a string.

func (*workflowInstance) GetGroupMembers

func (wfInst *workflowInstance) GetGroupMembers(groupUri string) []string

Returns the members of a particular group as a string array.

func (*workflowInstance) GetNumberVar

func (wfInst *workflowInstance) GetNumberVar(name string, defaultValue int) int

Retrieves a variable that was set either during workflow registration or through the set_var() function of type integer. The variable can be retrieved anywhere within the workflow, but is erased after the workflow terminates. Returns the requested variable’s value as an integer.

func (*workflowInstance) GetSourceUri

func (wfInst *workflowInstance) GetSourceUri(startEvent StartEvent) string

Helper method for parsing out the source URN from a start event trigger.

func (*workflowInstance) GetUnreadInboxSize

func (wfInst *workflowInstance) GetUnreadInboxSize(sourceUri string) int

Retrieves the number of messages in device’s inbox. Returns the number of unread messages in the device’s inbox as an integer.

func (*workflowInstance) GetUserProfile

func (wfInst *workflowInstance) GetUserProfile(sourceUri string, refresh bool) string

Returns the user profile of a targeted device as a string.

func (*workflowInstance) GetVar

func (wfInst *workflowInstance) GetVar(name string, defaultValue string) string

Retrieves a variable that was set either during workflow registration or through the set_var() function. The variable can be retrieved anywhere within the workflow, but is erased after the workflow terminates. Returns the requested variable’s value as a string.

func (*workflowInstance) HangupCall

func (wfInst *workflowInstance) HangupCall(targetUri string, callId string) HangupCallResponse

Ends a call on your device. Note that target can only have one item. Returns a HangupCallResponse.

func (*workflowInstance) IsGroupMember

func (wfInst *workflowInstance) IsGroupMember(groupNameUri string, potentialMemberUri string) bool

Checks whether a device is a member of a particular group. Returns true if the device is a member of the specified group, false otherwise.

func (*workflowInstance) Listen

func (wfInst *workflowInstance) Listen(sourceUri string, phrases []string, transcribe bool, alt_lang Language, timeout int) string

Listens for the user to speak into the device. Utilizes speech to text functionality to interact with the user. Returns the text that the device parsed from the speech as a string.

func (*workflowInstance) LogMessage

func (wfInst *workflowInstance) LogMessage(message string, category string) LogAnalyticsEventResponse

Log an analytics event from a workflow with the specified content and under a specified category. This does not log the device who triggered the workflow that called this function. Returns a LogAnalyticsEventResponse.

func (*workflowInstance) LogUserMessage

func (wfInst *workflowInstance) LogUserMessage(message string, sourceUri string, category string) LogAnalyticsEventResponse

Log an analytic event from a workflow with the specified content and under a specified category. This includes the device who triggered the workflow that called this function. Returns a LogAnalyticsEventResponse.

func (*workflowInstance) OnButton

func (wfInst *workflowInstance) OnButton(fn func(buttonEvent ButtonEvent))

A decorator for a handler method for the BUTTON event (the Talk button was pressed).

func (*workflowInstance) OnCallConnected

func (wfInst *workflowInstance) OnCallConnected(fn func(callConnectedEvent CallConnectedEvent))

A decorator for a handler method for the CALL_CONNECTED event. A call attempt that was ringing, progressing, or incoming is now fully connected. This event can occur on both the caller and the callee.

func (*workflowInstance) OnCallDisconnected

func (wfInst *workflowInstance) OnCallDisconnected(fn func(callDisconnected CallDisconnectedEvent))

A decorator for a handler method for the CALL_DISCONNECTED event. A call that was once connected has become disconnected. This event can occur on both the caller and the callee.

func (*workflowInstance) OnCallFailed

func (wfInst *workflowInstance) OnCallFailed(fn func(callFailedEvent CallFailedEvent))

A decorator for a handler method for the CALL_FAILED event. A call failed to get connected. This event can occur on both the caller and the callee.

func (*workflowInstance) OnCallProgressing

func (wfInst *workflowInstance) OnCallProgressing(fn func(callProgressingEvent CallProgressingEvent))

A decorator for a handler method for the CALL_PROGRESSING event. The device we called is making progress on getting connected. This may be interspersed with on_call_ringing. This event can occur on the caller.

func (*workflowInstance) OnCallReceived

func (wfInst *workflowInstance) OnCallReceived(fn func(callReceivedEvent CallReceivedEvent))

A decorator for a handler method for the CALL_RECEIVED event. The device is receiving an inbound call request. This event can occur on the callee.

func (*workflowInstance) OnCallRinging

func (wfInst *workflowInstance) OnCallRinging(fn func(callRingingEvent CallRingingEvent))

A decorator for a handler method for the CALL_RINGING event. The device we called is ringing. We are waiting for them to answer. This event can occur on the caller.

func (*workflowInstance) OnCallStartRequest

func (wfInst *workflowInstance) OnCallStartRequest(fn func(callStartEvent CallStartEvent))

A decorator for a handler method for the CALL_START_REQUEST event. There is a request to make an outbound call. This event can occur on the caller after using the “Call X” voice command on the Assistant.

func (*workflowInstance) OnIncident

func (wfInst *workflowInstance) OnIncident(fn func(incidentEvent IncidentEvent))

A decorator for a handler method for the INCIDENT event (an incident has been created).

func (*workflowInstance) OnInteractionLifecycle

func (wfInst *workflowInstance) OnInteractionLifecycle(fn func(interactionLifecycleEvent InteractionLifecycleEvent))

A decorator for a handler method for the INTERACTION_LIFECYCLE event (an interaction is starting, resuming, or ending).

func (*workflowInstance) OnNotification

func (wfInst *workflowInstance) OnNotification(fn func(notificationEvent NotificationEvent))

A decorator for a handler method for the NOTIFICATION event (a broadcast or alert was sent).

func (*workflowInstance) OnPlayInboxMessages

func (wfInst *workflowInstance) OnPlayInboxMessages(fn func(playInboxMessagesEvent PlayInboxMessagesEvent))

A decorator for a handler method for the PLAY_INBOX_MESSAGE event (a missed message is being played).

func (*workflowInstance) OnProgress

func (wfInst *workflowInstance) OnProgress(fn func(progressEvent ProgressEvent))

A decorator for a handler method for the PROGRESS event (a long running action is being performed across a large number of devices, may get called multiple times).

func (*workflowInstance) OnPrompt

func (wfInst *workflowInstance) OnPrompt(fn func(promptEvent PromptEvent))

A decorator for a handler method for the PROMPT event (text-to-speech is streaming in).

func (*workflowInstance) OnResume

func (wfInst *workflowInstance) OnResume(fn func(resumeEvent ResumeEvent))

A decorator for a handler method for the RESUME event (TBD).

func (*workflowInstance) OnSms

func (wfInst *workflowInstance) OnSms(fn func(smsEvent SmsEvent))

A decorator for a handler method for the SMS event (TBD).

func (*workflowInstance) OnSpeech

func (wfInst *workflowInstance) OnSpeech(fn func(speechEvent SpeechEvent))

A decorator for a handler method for the SPEECH event (the listen() function is running).

func (*workflowInstance) OnStart

func (wfInst *workflowInstance) OnStart(fn func(startEvent StartEvent))

A decorator for a handler for the START event (workflow is starting).

func (*workflowInstance) OnStop

func (wfInst *workflowInstance) OnStop(fn func(stopEvent StopEvent))

A decorator for a handler method for the STOP event (workflow is stopping).

func (*workflowInstance) OnTimer

func (wfInst *workflowInstance) OnTimer(fn func(timerEvent TimerEvent))

A decorator for a handler method for the TIMER event (the unnamed timer fired).

func (*workflowInstance) OnTimerFired

func (wfInst *workflowInstance) OnTimerFired(fn func(timerFiredEvent TimerFiredEvent))

A decorator for a handler method for the TIMER_FIRED event (a named timer fired).

func (*workflowInstance) PlaceCall

func (wfInst *workflowInstance) PlaceCall(targetUri string, uri string) PlaceCallResponse

Places a call to another device. Returns a PlaceCallResponse.

func (*workflowInstance) Play

func (wfInst *workflowInstance) Play(sourceUri string, filename string) string

Plays a custom audio file that was uploaded by the user. Returns the correlation ID retrieved from the PlayResponse as a string.

func (*workflowInstance) PlayAndWait

func (wfInst *workflowInstance) PlayAndWait(sourceUri string, filename string) string

Plays a custom audio file that was uploaded by the user. Waits until the audio file has finished playing before continuing through the workflow. Returns the correlation ID retrieved from the PlayResponse as a string.

func (*workflowInstance) PlayUnreadInboxMessages

func (wfInst *workflowInstance) PlayUnreadInboxMessages(sourceUri string) PlayInboxMessagesResponse

Play a targeted device’s inbox messages. Returns the PlayInboxMessagesResponse.

func (*workflowInstance) Rainbow

func (wfInst *workflowInstance) Rainbow(sourceUri string, rotations int64) SetLedResponse

Switches all the LEDs on to a configured rainbow pattern and rotates the rainbow a specified number of times. Returns a SetLedResponse.

func (*workflowInstance) ResolveIncident

func (wfInst *workflowInstance) ResolveIncident(incidentId string, reason string) ResolveIncidentResponse

Resolved an incident that was created. Returns a ResolveIncidentResponse.

func (*workflowInstance) Rotate

func (wfInst *workflowInstance) Rotate(sourceUri string, color string, rotations int64) SetLedResponse

Switches all of the LEDs on a device to a certain color and rotates them a specified number of times. Returns a SetLedResponse.

func (*workflowInstance) Say

func (wfInst *workflowInstance) Say(sourceUri string, text string, lang Language) SayResponse

Utilizes text to speech capabilities to make the device ‘speak’ to the user. Returns a SayResponse.

func (*workflowInstance) SayAndWait

func (wfInst *workflowInstance) SayAndWait(sourceUri string, text string, lang Language) SayResponse

Utilizes text to speech capabilities to make the device ‘speak’ to the user. Waits until the text is fully played out on the device before continuing. Returns a SayResponse.

func (*workflowInstance) SetChannel

func (wfInst *workflowInstance) SetChannel(sourceUri string, channelName string, suppressTTS bool, disableHomeChannel bool) SetChannelResponse

Sets the channel that a device is on. This can be used to change the channel of a device during a workflow, where the channel will also be updated on the Relay Dash. Returns a SetChannelResponse.

func (*workflowInstance) SetDeviceName

func (wfInst *workflowInstance) SetDeviceName(sourceUri string, name string) SetDeviceInfoResponse

Sets the name of a targeted device and updates it on the Relay Dash. The name remains updated until it is set again via a workflow or updated manually on the Relay Dash. Returns a SendNotificationResponse.

func (*workflowInstance) SetTimer

func (wfInst *workflowInstance) SetTimer(timerType TimerType, name string, timeout uint64, timeoutType TimeoutType) SetTimerResponse

Serves as a named timer that can be either interval or timeout. Allows you to specify the unit of time. Returns a SetTimerResponse.

func (*workflowInstance) SetUserProfile

func (wfInst *workflowInstance) SetUserProfile(sourceUri string, username string, force bool) SetUserProfileResponse

Sets the profile of a user by updating the username. Returns a SetUserProfileResponse.

func (*workflowInstance) SetVar

func (wfInst *workflowInstance) SetVar(name string, value string) SetVarResponse

Sets a variable with the corresponding name and value. Scope of the variable is from start to end of a workflow. Note that you can only set values of type string. Returns a SetVarResponse.

func (*workflowInstance) StartInteraction

func (wfInst *workflowInstance) StartInteraction(sourceUri string, name string) StartInteractionResponse

Starts an interaction with the user. Triggers an INTERACTION_STARTED event and allows the user to interact with the device via functions that require an interaction URN. Returns a StartInteractionResponse.

func (*workflowInstance) StartTimer

func (wfInst *workflowInstance) StartTimer(timeout int) StartTimerResponse

Starts an unnamed timer, meaning this will be the only timer on your device. The timer will fire when it reaches the value of the ‘timeout’ parameter. Returns a StartTimerResponse.

func (*workflowInstance) StopPlayback

func (wfInst *workflowInstance) StopPlayback(sourceUri string, ids []string) StopPlaybackResponse

Stops a playback request on the device. Returns the StopPlaybackResponse.

func (*workflowInstance) StopTimer

func (wfInst *workflowInstance) StopTimer() StopTimerResponse

Stops an unnamed timer. Returns a StopTimerResponse.

func (*workflowInstance) SwitchAllLedOff

func (wfInst *workflowInstance) SwitchAllLedOff(sourceUri string) SetLedResponse

Swithes all of the LEDs on a device off. Returns a SetLedResponse.

func (*workflowInstance) SwitchAllLedOn

func (wfInst *workflowInstance) SwitchAllLedOn(sourceUri string, color string) SetLedResponse

Switches all the LEDs on a device on to a specified color. Returns a SetLedResponse.

func (*workflowInstance) SwitchLedOn

func (wfInst *workflowInstance) SwitchLedOn(sourceUri string, led int, color string) SetLedResponse

Switches on an LED at a particules index to a specified color. Returns a SetLedResponse.

func (*workflowInstance) Terminate

func (wfInst *workflowInstance) Terminate()

Terminates a workflow. This method is usually called after your workflow has completed and you would like to end the workflow by calling end_interaction(), where you can then terminate the workflow.

func (*workflowInstance) Translate

func (wfInst *workflowInstance) Translate(sourceUri string, text string, from Language, to Language) string

Translates text from one language to another. Returns the translated text in the specified language as a string.

func (*workflowInstance) UnsetVar

func (wfInst *workflowInstance) UnsetVar(name string) UnsetVarResponse

Unsets the value of a variable. Returns an UnsetVarResponse.

func (*workflowInstance) Vibrate

func (wfInst *workflowInstance) Vibrate(sourceUri string, pattern []int64) VibrateResponse

Makes the device vibrate in a particular pattern. You can specify how many vibrations you would like, the duration of each vibration in milliseconds, and how long you would like the pauses between each vibration to last in milliseconds. Returns a VibrateResponse.

func (*workflowInstance) getDeviceInfo

func (wfInst *workflowInstance) getDeviceInfo(sourceUri string, query DeviceInfoQuery, refresh bool) GetDeviceInfoResponse

func (*workflowInstance) handleEvent

func (wfInst *workflowInstance) handleEvent(eventWrapper EventWrapper) error

func (*workflowInstance) handleResponse

func (wfInst *workflowInstance) handleResponse(eventWrapper EventWrapper) error

func (*workflowInstance) receiveWs

func (wfInst *workflowInstance) receiveWs()

func (*workflowInstance) sendAndReceiveRequest

func (wfInst *workflowInstance) sendAndReceiveRequest(msg interface{}, id string) *Call

func (*workflowInstance) sendAndReceiveRequestWait

func (wfInst *workflowInstance) sendAndReceiveRequestWait(msg interface{}, id string) *Call

func (*workflowInstance) sendNotification

func (wfInst *workflowInstance) sendNotification(target string, originator string, itype string, name string, text string, pushOptions NotificationOptions) SendNotificationResponse

func (*workflowInstance) sendRequest

func (wfInst *workflowInstance) sendRequest(msg interface{})

func (*workflowInstance) setDeviceInfo

func (wfInst *workflowInstance) setDeviceInfo(sourceUri string, field SetDeviceInfoType, value string) SetDeviceInfoResponse

func (*workflowInstance) setHomeChannelState

func (wfInst *workflowInstance) setHomeChannelState(sourceUri string, enabled bool) SetHomeChannelStateResponse

func (*workflowInstance) setLeds

func (wfInst *workflowInstance) setLeds(sourceUri string, effect LedEffect, args LedInfo) SetLedResponse

Generated by gomarkdoc