relay-dotnet
Public Types | Public Member Functions | Static Public Member Functions | Properties | List of all members
RelayDotNet.Relay Class Reference

The Relay class is responsible for defining the main functionalities that are used within workflows, such as functions for communicating with the device, sending out notifications to groups, handling workflow events, and performing physical actions on the device such as manipulating LEDs and creating vibrations. More...

Public Types

enum class  WebSocketConnector { Fleck , SystemHttpListener , SystemKestral }
 

Public Member Functions

 Relay (WebSocketConnector webSocketConnector, string ip, int port, bool secure)
 
async Task< bool > AddWorkflow (string path, Type relayWorkflowType)
 
async Task< bool > RemoveWorkflow (string path)
 
async Task< bool > OnOpen (IRelayWebSocketConnection webSocketConnection)
 
async void OnClose (IRelayWebSocketConnection webSocketConnection)
 
async void OnMessage (IRelayWebSocketConnection webSocketConnection, string message)
 
void Start ()
 
void Dispose ()
 
async void Terminate (IRelayWorkflow relayWorkflow)
 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. More...
 
async void StartInteraction (IRelayWorkflow relayWorkflow, string target, string name, Dictionary< string, object > options=null)
 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. More...
 
async void EndInteraction (IRelayWorkflow relayWorkflow, string target)
 Ends an interaction with the user. Triggers an INTERACTION_ENDED event to signify that the user is done interacting with the device. More...
 
async Task< string > Say (IRelayWorkflow relayWorkflow, string target, string text)
 Utilizes text to speech capabilities to make the device 'speak' to the user. More...
 
async Task< string > Say (IRelayWorkflow relayWorkflow, string target, string text, Language language)
 Utilizes text to speech capabilities to make the device 'speak' to the user. More...
 
async Task< string > SayAndWait (IRelayWorkflow relayWorkflow, string target, string text)
 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. More...
 
async Task< string > SayAndWait (IRelayWorkflow relayWorkflow, string target, string text, Language language)
 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. More...
 
async Task< string > Play (IRelayWorkflow relayWorkflow, string target, string filename)
 Plays a custom audio file that was uploaded by the user. More...
 
async Task< string > PlayAndWait (IRelayWorkflow relayWorkflow, string target, string filename)
 Plays a custom audio file that was uploaded by the user. Waits until the audio file has finished playing before continuing through the workflow. More...
 
async Task< Dictionary< string, object > > StopPlayback (IRelayWorkflow relayWorkflow, string target)
 
async Task< Dictionary< string, object > > StopPlayback (IRelayWorkflow relayWorkflow, string target, string id)
 
async Task< Dictionary< string, object > > StopPlayback (IRelayWorkflow relayWorkflow, string target, string[] ids)
 
async Task< Dictionary< string, object > > Vibrate (IRelayWorkflow relayWorkflow, string target, int[] pattern)
 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. More...
 
async Task< Dictionary< string, object > > StartTimer (IRelayWorkflow relayWorkflow, int timeout)
 Starts an unnamed timer, meaning this will be the only timer on your device. The timer will fire when it reaches the limit of the 'timeout' parameter. More...
 
async Task< Dictionary< string, object > > StopTimer (IRelayWorkflow relayWorkflow)
 Stops an unnamed timer. More...
 
async Task< Dictionary< string, object > > SetTimer (IRelayWorkflow relayWorkflow, string name, string timerType, int timeout, string timeoutType)
 Serves as a named timer that can be either interval or timeout. Allows you to specify the unit of time. More...
 
async Task< Dictionary< string, object > > ClearTimer (IRelayWorkflow relayWorkflow, string name)
 Clears the specified timer. More...
 
async Task< Dictionary< string, object > > CreateIncident (IRelayWorkflow relayWorkflow, string originator, string iType)
 Creates an incident that will alert the Relay Dash. More...
 
async Task< Dictionary< string, object > > ResolveIncident (IRelayWorkflow relayWorkflow, string incidentId, string reason)
 Resolves an incident that was created. More...
 
async Task< Dictionary< string, object > > SetLed (IRelayWorkflow relayWorkflow, string target, LedEffect ledEffect, LedInfo ledInfo)
 Used for performing actions on the LEDs, such as creating a rainbow, flashing, rotating, etc. More...
 
async Task< Dictionary< string, object > > SwitchLedOn (IRelayWorkflow relayWorkflow, string target, LedIndex ledIndex, string color)
 Switches on an LED at a particular index to a specified color. More...
 
async Task< Dictionary< string, object > > SwitchAllLedOn (IRelayWorkflow relayWorkflow, string target, string color)
 Switches all of the LEDs on a device on to a specified color. More...
 
async Task< Dictionary< string, object > > SwitchAllLedOff (IRelayWorkflow relayWorkflow, string target)
 Switches all of the LEDs on a device off. More...
 
async Task< Dictionary< string, object > > Rainbow (IRelayWorkflow relayWorkflow, string target, int rotations=-1)
 Switches all of the LEDs on to a configured rainbow pattern and rotates them a specified number of times. More...
 
async Task< Dictionary< string, object > > Rotate (IRelayWorkflow relayWorkflow, string target, string color="FFFFFF")
 Switches all of the LEDs on a device to a certain color and rotates them a specified number of times. More...
 
async Task< Dictionary< string, object > > Flash (IRelayWorkflow relayWorkflow, string target, string color="0000FF")
 Switches all of the LEDs on a device to a certain color and flashes them a specified number of times. More...
 
async Task< Dictionary< string, object > > Breathe (IRelayWorkflow relayWorkflow, string target, string color="0000FF")
 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. More...
 
async Task< Dictionary< string, object > > SetVar (IRelayWorkflow relayWorkflow, string name, string value)
 Sets a variable with the corresponding name and value. Scope of the variable is from start to end of a workflow. More...
 
async Task< Dictionary< string, object > > UnsetVar (IRelayWorkflow relayWorkflow, string name)
 Unsets the value of a variable. More...
 
async Task< string > GetVar (IRelayWorkflow relayWorkflow, string name, string defaultValue=null)
 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. More...
 
async Task< int > GetNumberVar (IRelayWorkflow relayWorkflow, string name, int defaultValue=-1)
 Retrieves a variable that is an integer type. More...
 
async Task< Dictionary< string, object > > Listen (IRelayWorkflow relayWorkflow, string target)
 Listens for the user to speak into the device. Utilizes speech to text functionality to interact with the user. More...
 
async Task< Dictionary< string, object > > Listen (IRelayWorkflow relayWorkflow, string target, string[] phrases)
 Listens for the user to speak into the device. Utilizes speech to text functionality to interact with the user. More...
 
async Task< Dictionary< string, object > > Listen (IRelayWorkflow relayWorkflow, string target, Language language)
 Listens for the user to speak into the device. Utilizes speech to text functionality to interact with the user. More...
 
async Task< Dictionary< string, object > > Listen (IRelayWorkflow relayWorkflow, string target, string[] phrases, Language altLanguage, bool transcribe=true, int timeout=60)
 Listens for the user to speak into the device. Utilizes speech to text functionality to interact with the user. More...
 
async Task< string > Translate (IRelayWorkflow relayWorkflow, string text, Language from, Language to)
 
async Task< Dictionary< string, object > > PlayUnreadInboxMessages (IRelayWorkflow relayWorkflow, string target)
 
async Task< int > GetUnreadInboxSize (IRelayWorkflow relayWorkflow, string target)
 
async Task< Dictionary< string, object > > CancelNotification (IRelayWorkflow relayWorkflow, string originator, string name, string targets)
 Cancels a notification of any type that was sent to a group of devices. More...
 
async Task< Dictionary< string, object > > Broadcast (IRelayWorkflow relayWorkflow, string targets, string originator, string name, string text)
 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. More...
 
async Task< Dictionary< string, object > > Broadcast (IRelayWorkflow relayWorkflow, string targets, string originator, string name, string text, NotificationPushOptions notificationPushOptions)
 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. More...
 
async Task< Dictionary< string, object > > CancelBroadcast (IRelayWorkflow relayWorkflow, string originator, string name, string targets)
 Cancels the broadcast that was sent to a group of devices. More...
 
async Task< Dictionary< string, object > > Alert (IRelayWorkflow relayWorkflow, string targets, string originator, string name, string text)
 Sends out an alert to the specified group of devices and the Relay Dash. More...
 
async Task< Dictionary< string, object > > Alert (IRelayWorkflow relayWorkflow, string targets, string originator, string name, string text, NotificationPushOptions notificationPushOptions)
 Sends out an alert to the specified group of devices and the Relay Dash. More...
 
async Task< Dictionary< string, object > > CancelAlert (IRelayWorkflow relayWorkflow, string originator, string name, string targets)
 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. More...
 
async Task< string[]> GetGroupMembers (IRelayWorkflow relayWorkflow, string groupName)
 Returns the members of a particular group. More...
 
async Task< string > GetDeviceName (IRelayWorkflow relayWorkflow, string target)
 Returns the name of a targeted device. More...
 
async Task< string > GetDeviceLocation (IRelayWorkflow relayWorkflow, string target, bool refresh)
 Returns the location of a targeted device. More...
 
async Task< string > GetDeviceId (IRelayWorkflow relayWorkflow, string target)
 Returns the ID of a targeted device. More...
 
async Task< string > GetDeviceAddress (IRelayWorkflow relayWorkflow, string target, bool refresh)
 Returns the address of a targeted device. More...
 
async Task< float[]> GetDeviceCoordinates (IRelayWorkflow relayWorkflow, string target, bool refresh)
 Retrieves the coordinates of the device's location. More...
 
async Task< float[]> GetDeviceLatLong (IRelayWorkflow relayWorkflow, string target, bool refresh)
 Returns the latitude and longitude coordinates of a targeted device. More...
 
async Task< float[]> GetDeviceIndoorLocation (IRelayWorkflow relayWorkflow, string target, bool refresh)
 Returns the indoor location of a targeted device. More...
 
async Task< int > GetDeviceBattery (IRelayWorkflow relayWorkflow, string target, bool refresh)
 Returns the battery level of a targeted device. More...
 
async Task< DeviceTypeGetDeviceType (IRelayWorkflow relayWorkflow, string target, bool refresh)
 Returns the device type of a targeted device, i.e. gen 2, gen 3, etc. More...
 
async Task< string > GetUserProfile (IRelayWorkflow relayWorkflow, string target)
 Returns the user profile of a targeted device. More...
 
async Task< Dictionary< string, object > > EnableLocation (IRelayWorkflow relayWorkflow, string target)
 Enables the location services on a device. More...
 
async Task< Dictionary< string, object > > DisableLocation (IRelayWorkflow relayWorkflow, string target)
 Disables the location services on a device. More...
 
async Task< bool > GetDeviceLocationEnabled (IRelayWorkflow relayWorkflow, string target, bool refresh)
 Returns true if the device's location services are enabled, false otherwise. More...
 
async Task< string[]> SetUserProfile (IRelayWorkflow relayWorkflow, string target, string username, bool force=false)
 Sets the profile of a user by updating the username. More...
 
async Task< Dictionary< string, object > > LogUserMessage (IRelayWorkflow relayWorkflow, string message, string target, string category)
 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. More...
 
async Task< Dictionary< string, object > > LogMessage (IRelayWorkflow relayWorkflow, string message, string category)
 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. More...
 
async Task< Dictionary< string, object > > SetDeviceName (IRelayWorkflow relayWorkflow, string target, string name)
 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. More...
 
async Task< Dictionary< string, object > > SetChannel (IRelayWorkflow relayWorkflow, string target, string channel, string[] targets, bool suppressTts=false, bool disableHomeChannel=false)
 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. More...
 
async Task< Dictionary< string, object > > EnableHomeChannel (IRelayWorkflow relayWorkflow, string sourceUri, string target)
 Sets the home channel state on the device to true. More...
 
async Task< Dictionary< string, object > > EnableHomeChannel (IRelayWorkflow relayWorkflow, string sourceUri, string[] targets)
 
async Task< Dictionary< string, object > > DisableHomeChannel (IRelayWorkflow relayWorkflow, string sourceUri, string target)
 Sets the home channel state on the device to false. More...
 
async Task< Dictionary< string, object > > DisableHomeChannel (IRelayWorkflow relayWorkflow, string sourceUri, string[] targets)
 
async Task< Dictionary< string, object > > AnswerCall (IRelayWorkflow relayWorkflow, string sourceUri, string callId)
 Answers an incoming call on your device. More...
 
async Task< Dictionary< string, object > > PlaceCall (IRelayWorkflow relayWorkflow, string sourceUri, string calleeUri)
 Places a call to another device. More...
 
async Task< Dictionary< string, object > > HangupCall (IRelayWorkflow relayWorkflow, string sourceUri, string callId)
 Ends a call on a device. More...
 

Static Public Member Functions

static Dictionary< string, object > TargetsFromSourceUri (string sourceUri)
 Creates a target object from a source URN. More...
 
static string GetSourceUriFromStartEvent (IDictionary< string, object > startEvent)
 Parses out and retrieves the source URN from a Start Event More...
 
static async Task< Dictionary< string, object > > TriggerWorkflow (string accessToken, string refreshToken, string clientId, string workflowId, string subscriberId, string userId, string[] targets, Dictionary< string, string > actionArgs)
 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.
More...
 
static async Task< Dictionary< string, object > > FetchDevice (string accessToken, string refreshToken, string clientId, string subscriberId, string userId)
 A convenience method for getting all the details of a device. More...
 

Properties

IRelayWebSocketConnector RelayWebSocketConnector [get]
 

Detailed Description

The Relay class is responsible for defining the main functionalities that are used within workflows, such as functions for communicating with the device, sending out notifications to groups, handling workflow events, and performing physical actions on the device such as manipulating LEDs and creating vibrations.

Member Enumeration Documentation

◆ WebSocketConnector

Enumerator
Fleck 
SystemHttpListener 
SystemKestral 

Constructor & Destructor Documentation

◆ Relay()

RelayDotNet.Relay.Relay ( WebSocketConnector  webSocketConnector,
string  ip,
int  port,
bool  secure 
)
inline

Member Function Documentation

◆ AddWorkflow()

async Task<bool> RelayDotNet.Relay.AddWorkflow ( string  path,
Type  relayWorkflowType 
)
inline

◆ Alert() [1/2]

async Task<Dictionary<string, object> > RelayDotNet.Relay.Alert ( IRelayWorkflow  relayWorkflow,
string  targets,
string  originator,
string  name,
string  text 
)
inline

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

Parameters
relayWorkflowthe workflow.
originatorthe URN of the device that triggered the alert.
namea name for your alert.
textthe text that you would like to be spoken to the group as your alert.
targetsthe group URN that you would like to send your alert to.
Returns
the event response.

◆ Alert() [2/2]

async Task<Dictionary<string, object> > RelayDotNet.Relay.Alert ( IRelayWorkflow  relayWorkflow,
string  targets,
string  originator,
string  name,
string  text,
NotificationPushOptions  notificationPushOptions 
)
inline

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

Parameters
relayWorkflowthe workflow.
originatorthe URN of the device that triggered the alert.
namea name for your alert.
textthe text that you would like to be spoken to the group as your alert.
targetsthe group URN that you would like to send your alert to.
notificationPushOptionspush options for if the alert is sent to the Relay app on a virtual device. Defaults to {}.
Returns
the event response.

◆ AnswerCall()

async Task<Dictionary<string, object> > RelayDotNet.Relay.AnswerCall ( IRelayWorkflow  relayWorkflow,
string  sourceUri,
string  callId 
)
inline

Answers an incoming call on your device.

Parameters
relayWorkflowthe workflow.
sourceUrithe device URN which will answer the call.
callIdthe ID of the call to answer.
Returns

◆ Breathe()

async Task<Dictionary<string, object> > RelayDotNet.Relay.Breathe ( IRelayWorkflow  relayWorkflow,
string  target,
string  color = "0000FF" 
)
inline

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.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
colorthe hex color code you would like to turn the LEDs to. Defaults to '0000FF'.
Returns
the event response.

◆ Broadcast() [1/2]

async Task<Dictionary<string, object> > RelayDotNet.Relay.Broadcast ( IRelayWorkflow  relayWorkflow,
string  targets,
string  originator,
string  name,
string  text 
)
inline

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.

Parameters
relayWorkflowthe workflow.
originatorthe device URN that triggered the broadcast.
namea name for your broadcast.
textthe text that you would like to be broadcasted to your group.
targetsthe group URN that you would like to broadcast your message to.
Returns
the event response.

◆ Broadcast() [2/2]

async Task<Dictionary<string, object> > RelayDotNet.Relay.Broadcast ( IRelayWorkflow  relayWorkflow,
string  targets,
string  originator,
string  name,
string  text,
NotificationPushOptions  notificationPushOptions 
)
inline

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.

Parameters
relayWorkflowthe workflow.
originatorthe device URN that triggered the broadcast.
namea name for your broadcast.
textthe text that you would like to be broadcasted to your group.
targetsthe group URN that you would like to broadcast your message to.
notificationPushOptionspush options for if the notification is sent to the Relay app on a virtual device. Defaults to {}.
Returns
the event response.

◆ CancelAlert()

async Task<Dictionary<string, object> > RelayDotNet.Relay.CancelAlert ( IRelayWorkflow  relayWorkflow,
string  originator,
string  name,
string  targets 
)
inline

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.

Parameters
relayWorkflowthe workflow.
originatorthe URN of the device that acknowledged or is cancelling the alert.
namethe name of the alert.
targetsthe group URN that received the alert.
Returns
the event response.

◆ CancelBroadcast()

async Task<Dictionary<string, object> > RelayDotNet.Relay.CancelBroadcast ( IRelayWorkflow  relayWorkflow,
string  originator,
string  name,
string  targets 
)
inline

Cancels the broadcast that was sent to a group of devices.

Parameters
relayWorkflowthe workflow.
originatorthe device URN that is cancelling the broadcast.
namethe name of the broadcast you would like to cancel.
targetsthe group URN that received the broadcast.
Returns
the event response.

◆ CancelNotification()

async Task<Dictionary<string, object> > RelayDotNet.Relay.CancelNotification ( IRelayWorkflow  relayWorkflow,
string  originator,
string  name,
string  targets 
)
inline

Cancels a notification of any type that was sent to a group of devices.

Parameters
relayWorkflowthe workflow.
originatorthe device or interacion URN that sent out the message.
namethe name of the notification to cancel.
targetsthe group URN that received the notification.
Returns
the event response.

◆ ClearTimer()

async Task<Dictionary<string, object> > RelayDotNet.Relay.ClearTimer ( IRelayWorkflow  relayWorkflow,
string  name 
)
inline

Clears the specified timer.

Parameters
relayWorkflowthe workflow.
namethe name of the timer that you would like to clear.
Returns
the event response.

◆ CreateIncident()

async Task<Dictionary<string, object> > RelayDotNet.Relay.CreateIncident ( IRelayWorkflow  relayWorkflow,
string  originator,
string  iType 
)
inline

Creates an incident that will alert the Relay Dash.

Parameters
relayWorkflowthe workflow.
originatorthe device URN that triggered the incident.
iTypethe type of incident that occurred.
Returns
the event response.

◆ DisableHomeChannel() [1/2]

async Task<Dictionary<string, object> > RelayDotNet.Relay.DisableHomeChannel ( IRelayWorkflow  relayWorkflow,
string  sourceUri,
string  target 
)
inline

Sets the home channel state on the device to false.

Parameters
relayWorkflowthe workflow.
sourceUrithe URN of the device that called the function.
targetthe device URN whose home channel you would like to set.
Returns
the event response.

◆ DisableHomeChannel() [2/2]

async Task<Dictionary<string, object> > RelayDotNet.Relay.DisableHomeChannel ( IRelayWorkflow  relayWorkflow,
string  sourceUri,
string[]  targets 
)
inline

◆ DisableLocation()

async Task<Dictionary<string, object> > RelayDotNet.Relay.DisableLocation ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

Disables the location services on a device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
Returns
the event response.

◆ Dispose()

void RelayDotNet.Relay.Dispose ( )
inline

◆ EnableHomeChannel() [1/2]

async Task<Dictionary<string, object> > RelayDotNet.Relay.EnableHomeChannel ( IRelayWorkflow  relayWorkflow,
string  sourceUri,
string  target 
)
inline

Sets the home channel state on the device to true.

Parameters
relayWorkflowthe workflow.
sourceUrithe URN of the device that called the function.
targetthe device URN whose home channel you would like to set.
Returns
the event response.

◆ EnableHomeChannel() [2/2]

async Task<Dictionary<string, object> > RelayDotNet.Relay.EnableHomeChannel ( IRelayWorkflow  relayWorkflow,
string  sourceUri,
string[]  targets 
)
inline

◆ EnableLocation()

async Task<Dictionary<string, object> > RelayDotNet.Relay.EnableLocation ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

Enables the location services on a device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
Returns
the event response.

◆ EndInteraction()

async void RelayDotNet.Relay.EndInteraction ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

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

Parameters
relayWorkflowthe workflow.
targetthe interaction that you would like to end.
Returns
the event response.

◆ FetchDevice()

static async Task<Dictionary<string, object> > RelayDotNet.Relay.FetchDevice ( string  accessToken,
string  refreshToken,
string  clientId,
string  subscriberId,
string  userId 
)
inlinestatic

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.

Parameters
accessTokenthe current access token. Can be a placeholder value and this method will generate a new one and return it. If the original value of the access token passed in here has expired, this method will also generate a new one and return it.
refreshTokenthe permanent refresh token that can be used to obtain a new access_token. The caller should treat the refresh token as very sensitive data, and secure it appropriately.
clientIdthe auth_sdk_id as returned from "relay env".
subscriberIdthe subcriber UUID as returned from "relay whoami".
userIdthe IMEI of the target device, such as 990007560023456.
Returns
a dictionary containing the response and access token.

◆ Flash()

async Task<Dictionary<string, object> > RelayDotNet.Relay.Flash ( IRelayWorkflow  relayWorkflow,
string  target,
string  color = "0000FF" 
)
inline

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

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
colorthe hex color code you would like to turn the LEDs to. Defaults to '0000FF'.
Returns
the event response.

◆ GetDeviceAddress()

async Task<string> RelayDotNet.Relay.GetDeviceAddress ( IRelayWorkflow  relayWorkflow,
string  target,
bool  refresh 
)
inline

Returns the address of a targeted device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
refreshwhether you would like to refresh before retrieving the address. Defaults to false.
Returns
the address of the device.

◆ GetDeviceBattery()

async Task<int> RelayDotNet.Relay.GetDeviceBattery ( IRelayWorkflow  relayWorkflow,
string  target,
bool  refresh 
)
inline

Returns the battery level of a targeted device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
refreshwhether you would like to refresh before retrieving the battery. Defaults to false.
Returns
the battery level on the device.

◆ GetDeviceCoordinates()

async Task<float[]> RelayDotNet.Relay.GetDeviceCoordinates ( IRelayWorkflow  relayWorkflow,
string  target,
bool  refresh 
)
inline

Retrieves the coordinates of the device's location.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
refreshwhether you would like to refresh before retrieving the coordinates. Defaults to false.
Returns
the coordinates of the device's location.

◆ GetDeviceId()

async Task<string> RelayDotNet.Relay.GetDeviceId ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

Returns the ID of a targeted device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
Returns
the device ID.

◆ GetDeviceIndoorLocation()

async Task<float[]> RelayDotNet.Relay.GetDeviceIndoorLocation ( IRelayWorkflow  relayWorkflow,
string  target,
bool  refresh 
)
inline

Returns the indoor location of a targeted device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
refreshwhether you wouldlike to refresh before retrieving the location. Defaults to false.
Returns
the indoor location of the device.

◆ GetDeviceLatLong()

async Task<float[]> RelayDotNet.Relay.GetDeviceLatLong ( IRelayWorkflow  relayWorkflow,
string  target,
bool  refresh 
)
inline

Returns the latitude and longitude coordinates of a targeted device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
refreshwhether you would like to refresh before retrieving the coordinates. Defaults to false.
Returns
an array containing the latitude and longitude of the device's location.

◆ GetDeviceLocation()

async Task<string> RelayDotNet.Relay.GetDeviceLocation ( IRelayWorkflow  relayWorkflow,
string  target,
bool  refresh 
)
inline

Returns the location of a targeted device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
refreshwhether you would like to refresh before retrieving the location. Defaults to false.
Returns
the location of the device.

◆ GetDeviceLocationEnabled()

async Task<bool> RelayDotNet.Relay.GetDeviceLocationEnabled ( IRelayWorkflow  relayWorkflow,
string  target,
bool  refresh 
)
inline

Returns true if the device's location services are enabled, false otherwise.

Parameters
relayWorkflowthe workflow
targetthe device or interaction URN.
refreshwhether you would like to refresh before retrieving the query information.
Returns
true if the device's location services are enabled, false otherwise.

◆ GetDeviceName()

async Task<string> RelayDotNet.Relay.GetDeviceName ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

Returns the name of a targeted device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
Returns
the name of the device.

◆ GetDeviceType()

async Task<DeviceType> RelayDotNet.Relay.GetDeviceType ( IRelayWorkflow  relayWorkflow,
string  target,
bool  refresh 
)
inline

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

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
refreshwhether you would like to refresh before retrieving the device type.
Returns
the device type.

◆ GetGroupMembers()

async Task<string[]> RelayDotNet.Relay.GetGroupMembers ( IRelayWorkflow  relayWorkflow,
string  groupName 
)
inline

Returns the members of a particular group.

Parameters
relayWorkflowthe workflow.
groupNamethe name of the group whose members you would like to retrieve.
Returns
an array containing all of the device names in the specified group.

◆ GetNumberVar()

async Task<int> RelayDotNet.Relay.GetNumberVar ( IRelayWorkflow  relayWorkflow,
string  name,
int  defaultValue = -1 
)
inline

Retrieves a variable that is an integer type.

Parameters
relayWorkflowthe workflow.
namethe name of the variable to retrieve.
defaultValuethe default value for the variable if it does not exist.
Returns
the variable requested

◆ GetSourceUriFromStartEvent()

static string RelayDotNet.Relay.GetSourceUriFromStartEvent ( IDictionary< string, object >  startEvent)
inlinestatic

Parses out and retrieves the source URN from a Start Event

Parameters
startEventthe start event
Returns
the source URN

◆ GetUnreadInboxSize()

async Task<int> RelayDotNet.Relay.GetUnreadInboxSize ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

◆ GetUserProfile()

async Task<string> RelayDotNet.Relay.GetUserProfile ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

Returns the user profile of a targeted device.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
Returns
the user profile registered to the device.

◆ GetVar()

async Task<string> RelayDotNet.Relay.GetVar ( IRelayWorkflow  relayWorkflow,
string  name,
string  defaultValue = null 
)
inline

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.

Parameters
relayWorkflowthe workflow.
namename of the variable to be retrieved.
defaultValuedefault value of the variable if it does not exist. Defaults to undefined.
Returns
the variable requested.

◆ HangupCall()

async Task<Dictionary<string, object> > RelayDotNet.Relay.HangupCall ( IRelayWorkflow  relayWorkflow,
string  sourceUri,
string  callId 
)
inline

Ends a call on a device.

Parameters
relayWorkflowthe workflow.
sourceUrithe device that is hanging up the call.
callIdthe ID of the call to hangup.
Returns
the event response.

◆ Listen() [1/4]

async Task<Dictionary<string, object> > RelayDotNet.Relay.Listen ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

Listens for the user to speak into the device. Utilizes speech to text functionality to interact with the user.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
Returns
text representation of what the user had spoken into the device.

◆ Listen() [2/4]

async Task<Dictionary<string, object> > RelayDotNet.Relay.Listen ( IRelayWorkflow  relayWorkflow,
string  target,
Language  language 
)
inline

Listens for the user to speak into the device. Utilizes speech to text functionality to interact with the user.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
languagethe language that the device is listening for. Defaults to 'en-US'.
Returns
text representation of what the user had spoken into the device.

◆ Listen() [3/4]

async Task<Dictionary<string, object> > RelayDotNet.Relay.Listen ( IRelayWorkflow  relayWorkflow,
string  target,
string[]  phrases 
)
inline

Listens for the user to speak into the device. Utilizes speech to text functionality to interact with the user.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
phrasesoptional phrases that you would like to limit the user's response to. Defualts to none.
Returns
text representation of what the user had spoken into the device.

◆ Listen() [4/4]

async Task<Dictionary<string, object> > RelayDotNet.Relay.Listen ( IRelayWorkflow  relayWorkflow,
string  target,
string[]  phrases,
Language  altLanguage,
bool  transcribe = true,
int  timeout = 60 
)
inline

Listens for the user to speak into the device. Utilizes speech to text functionality to interact with the user.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
phraseslimits the user's response to these phrases.
altLanguagethe language that the device will listen for. Defaults to 'en-US'.
transcribewhether you would like to transcribe.
timeouthow long to wait for a user's response before timing out.
Returns
text representation of what the user had spoken into the device.

◆ LogMessage()

async Task<Dictionary<string, object> > RelayDotNet.Relay.LogMessage ( IRelayWorkflow  relayWorkflow,
string  message,
string  category 
)
inline

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.

Parameters
relayWorkflowthe workflow.
messagea description for your analytical event.
categorya category for your analytical event.
Returns

◆ LogUserMessage()

async Task<Dictionary<string, object> > RelayDotNet.Relay.LogUserMessage ( IRelayWorkflow  relayWorkflow,
string  message,
string  target,
string  category 
)
inline

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.

Parameters
relayWorkflowthe workflow.
messagea description for your analytical event.
targetthe URN of a device that triggered this function. Defaults to None.
categorya category for your analytical event.
Returns

◆ OnClose()

async void RelayDotNet.Relay.OnClose ( IRelayWebSocketConnection  webSocketConnection)
inline

◆ OnMessage()

async void RelayDotNet.Relay.OnMessage ( IRelayWebSocketConnection  webSocketConnection,
string  message 
)
inline

◆ OnOpen()

async Task<bool> RelayDotNet.Relay.OnOpen ( IRelayWebSocketConnection  webSocketConnection)
inline

◆ PlaceCall()

async Task<Dictionary<string, object> > RelayDotNet.Relay.PlaceCall ( IRelayWorkflow  relayWorkflow,
string  sourceUri,
string  calleeUri 
)
inline

Places a call to another device.

Parameters
relayWorkflowthe workflow.
sourceUrithe device that is placing the call.
calleeUrithe device that you would like to call.
Returns
the event response.

◆ Play()

async Task<string> RelayDotNet.Relay.Play ( IRelayWorkflow  relayWorkflow,
string  target,
string  filename 
)
inline

Plays a custom audio file that was uploaded by the user.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
filenamethe name of the audio file.
Returns
the response ID after the audio file has been played on the device.

◆ PlayAndWait()

async Task<string> RelayDotNet.Relay.PlayAndWait ( IRelayWorkflow  relayWorkflow,
string  target,
string  filename 
)
inline

Plays a custom audio file that was uploaded by the user. Waits until the audio file has finished playing before continuing through the workflow.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
filenamethe name of the audio file.
Returns
the response ID after the audio file has been played on the device.

◆ PlayUnreadInboxMessages()

async Task<Dictionary<string, object> > RelayDotNet.Relay.PlayUnreadInboxMessages ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

◆ Rainbow()

async Task<Dictionary<string, object> > RelayDotNet.Relay.Rainbow ( IRelayWorkflow  relayWorkflow,
string  target,
int  rotations = -1 
)
inline

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

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
rotationsthe number of times you would like the rainbow to rotate. Defaults to -1, meaning the rainbow will rotate indefinitely.
Returns
the event response.

◆ RemoveWorkflow()

async Task<bool> RelayDotNet.Relay.RemoveWorkflow ( string  path)
inline

◆ ResolveIncident()

async Task<Dictionary<string, object> > RelayDotNet.Relay.ResolveIncident ( IRelayWorkflow  relayWorkflow,
string  incidentId,
string  reason 
)
inline

Resolves an incident that was created.

Parameters
relayWorkflowthe workflow.
incidentIdthe ID of the incident you would like to resolve.
reasonthe reason for resolving the incident.
Returns

◆ Rotate()

async Task<Dictionary<string, object> > RelayDotNet.Relay.Rotate ( IRelayWorkflow  relayWorkflow,
string  target,
string  color = "FFFFFF" 
)
inline

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

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
colorthe hex color code you would like to turn the LEDs to. Defaults to 'FFFFFF'.
Returns
the event response.

◆ Say() [1/2]

async Task<string> RelayDotNet.Relay.Say ( IRelayWorkflow  relayWorkflow,
string  target,
string  text 
)
inline

Utilizes text to speech capabilities to make the device 'speak' to the user.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
textwhat you would like the device to say.
Returns
the response ID after the device speaks to the user.

◆ Say() [2/2]

async Task<string> RelayDotNet.Relay.Say ( IRelayWorkflow  relayWorkflow,
string  target,
string  text,
Language  language 
)
inline

Utilizes text to speech capabilities to make the device 'speak' to the user.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
textwhat you would like the device to say.
languagethe language of the text that is being spoken. Defaults to 'en-US'.
Returns
the response ID after the device speaks to the user.

◆ SayAndWait() [1/2]

async Task<string> RelayDotNet.Relay.SayAndWait ( IRelayWorkflow  relayWorkflow,
string  target,
string  text 
)
inline

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.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
textwhat you would like the device to say.
Returns
the response ID after the device speaks to the user.

◆ SayAndWait() [2/2]

async Task<string> RelayDotNet.Relay.SayAndWait ( IRelayWorkflow  relayWorkflow,
string  target,
string  text,
Language  language 
)
inline

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.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
textwhat you would like the device to say.
languagethe language of the text that is being spoken. Defaults to 'en-US'.
Returns
the resonse ID after the device speaks to the user.

◆ SetChannel()

async Task<Dictionary<string, object> > RelayDotNet.Relay.SetChannel ( IRelayWorkflow  relayWorkflow,
string  target,
string  channel,
string[]  targets,
bool  suppressTts = false,
bool  disableHomeChannel = false 
)
inline

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.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
channelthe name of the channel that you would like to set your device to.
targetsthe group URN whose channel you would like to set.
suppressTtswhether you would like to surpress the text to speech. Defaults to false.
disableHomeChannelwhether you would like to disable the home channel. Defaults to false.
Returns
the event response.

◆ SetDeviceName()

async Task<Dictionary<string, object> > RelayDotNet.Relay.SetDeviceName ( IRelayWorkflow  relayWorkflow,
string  target,
string  name 
)
inline

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.

Parameters
relayWorkflowthe workflow.
targetthe device or interaction URN.
namea new name for your device.
Returns
the event response.

◆ SetLed()

async Task<Dictionary<string, object> > RelayDotNet.Relay.SetLed ( IRelayWorkflow  relayWorkflow,
string  target,
LedEffect  ledEffect,
LedInfo  ledInfo 
)
inline

Used for performing actions on the LEDs, such as creating a rainbow, flashing, rotating, etc.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
ledEffecteffect to perform on the LEDs, can be 'rainbow', 'rotate', 'flash', 'breath', 'static', or 'off'.
ledInfoinformation regarding the actions on the LED, such as the number of rotations, the count, etc.
Returns
the event response.

◆ SetTimer()

async Task<Dictionary<string, object> > RelayDotNet.Relay.SetTimer ( IRelayWorkflow  relayWorkflow,
string  name,
string  timerType,
int  timeout,
string  timeoutType 
)
inline

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

Parameters
relayWorkflowthe workflow.
namea name for your timer.
timerTypecan be "timeout" or "interval". Defaults to "timeout"
timeoutan integer representing when you would like your timer to fire.
timeoutTypecan be "ms", "secs", "mins", or "hrs". Defaults to "secs".
Returns
the event response.

◆ SetUserProfile()

async Task<string[]> RelayDotNet.Relay.SetUserProfile ( IRelayWorkflow  relayWorkflow,
string  target,
string  username,
bool  force = false 
)
inline

Sets the profile of a user by updating the username.

Parameters
relayWorkflowthe workflow.
targetthe device URN whose profile you would like to update.
usernamethe updated username for the device.
forcewhether you would like to force this update. Defaults to false.
Returns
a string array of the device names under the user's profile.

◆ SetVar()

async Task<Dictionary<string, object> > RelayDotNet.Relay.SetVar ( IRelayWorkflow  relayWorkflow,
string  name,
string  value 
)
inline

Sets a variable with the corresponding name and value. Scope of the variable is from start to end of a workflow.

Parameters
relayWorkflowthe workflow.
namename of the variable to be created.
valuevalue that the variable will hold.
Returns
the event response.

◆ Start()

void RelayDotNet.Relay.Start ( )
inline

◆ StartInteraction()

async void RelayDotNet.Relay.StartInteraction ( IRelayWorkflow  relayWorkflow,
string  target,
string  name,
Dictionary< string, object >  options = null 
)
inline

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.

Parameters
relayWorkflowthe workflow.
targetthe device that you would like to start an interaction with.
namea name for your interaction.
optionscan be color, home channel, or input types.
Returns
the event response.

◆ StartTimer()

async Task<Dictionary<string, object> > RelayDotNet.Relay.StartTimer ( IRelayWorkflow  relayWorkflow,
int  timeout 
)
inline

Starts an unnamed timer, meaning this will be the only timer on your device. The timer will fire when it reaches the limit of the 'timeout' parameter.

Parameters
relayWorkflowthe workflow.
timeoutthe number of seconds you would like to wait until the timer fires.
Returns
the event response.

◆ StopPlayback() [1/3]

async Task<Dictionary<string, object> > RelayDotNet.Relay.StopPlayback ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

◆ StopPlayback() [2/3]

async Task<Dictionary<string, object> > RelayDotNet.Relay.StopPlayback ( IRelayWorkflow  relayWorkflow,
string  target,
string  id 
)
inline

◆ StopPlayback() [3/3]

async Task<Dictionary<string, object> > RelayDotNet.Relay.StopPlayback ( IRelayWorkflow  relayWorkflow,
string  target,
string[]  ids 
)
inline

◆ StopTimer()

async Task<Dictionary<string, object> > RelayDotNet.Relay.StopTimer ( IRelayWorkflow  relayWorkflow)
inline

Stops an unnamed timer.

Parameters
relayWorkflowthe workflow.
Returns
the event response.

◆ SwitchAllLedOff()

async Task<Dictionary<string, object> > RelayDotNet.Relay.SwitchAllLedOff ( IRelayWorkflow  relayWorkflow,
string  target 
)
inline

Switches all of the LEDs on a device off.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
Returns
the event response.

◆ SwitchAllLedOn()

async Task<Dictionary<string, object> > RelayDotNet.Relay.SwitchAllLedOn ( IRelayWorkflow  relayWorkflow,
string  target,
string  color 
)
inline

Switches all of the LEDs on a device on to a specified color.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
colorthe hex color code you would like the LEDs to be.
Returns
the event response.

◆ SwitchLedOn()

async Task<Dictionary<string, object> > RelayDotNet.Relay.SwitchLedOn ( IRelayWorkflow  relayWorkflow,
string  target,
LedIndex  ledIndex,
string  color 
)
inline

Switches on an LED at a particular index to a specified color.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
ledIndexthe index of the LED, numbered 1-12.
colorthe hex color code that you would like to set the LED to.
Returns
the event response.

◆ TargetsFromSourceUri()

static Dictionary<string, object> RelayDotNet.Relay.TargetsFromSourceUri ( string  sourceUri)
inlinestatic

Creates a target object from a source URN.

Parameters
sourceUrisource uri that will be used to create a target.
Returns
the target that was created from a source URN.

◆ Terminate()

async void RelayDotNet.Relay.Terminate ( IRelayWorkflow  relayWorkflow)
inline

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.

Parameters
relayWorkflowthe workflow.

◆ Translate()

async Task<string> RelayDotNet.Relay.Translate ( IRelayWorkflow  relayWorkflow,
string  text,
Language  from,
Language  to 
)
inline

◆ TriggerWorkflow()

static async Task<Dictionary<string, object> > RelayDotNet.Relay.TriggerWorkflow ( string  accessToken,
string  refreshToken,
string  clientId,
string  workflowId,
string  subscriberId,
string  userId,
string[]  targets,
Dictionary< string, string >  actionArgs 
)
inlinestatic

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 refreshToken and the request will be resubmitted with the new accessToken. Otherwise the refresh token won't be used.

Parameters
accessTokenthe current access token. Can be a placeholder value and this method will generate a new one and return it.
refreshTokenthe permanent refresh token that can be used to obtain a new access token.
The caller should treat the refresh token as very sensitive data, and secure it appropriately.
clientIdthe auth_sdk_id as returned from "relay env".
workflowIdthe workflow_id as returned from "relay workflow list". Usually starts with "wf_".
subscriberIdthe subcriber UUID as returned from "relay whoami".
userIdthe IMEI of the target device, such as 990007560023456.
targetsoptional targets consisting of an array of the device IMEIs that you would like to run the triggered workflow on.
actionArgsa dict of any key/value arguments you want to pass in to the workflow that gets started by this trigger.
Returns
a dictionary containing the response information and access token.

◆ UnsetVar()

async Task<Dictionary<string, object> > RelayDotNet.Relay.UnsetVar ( IRelayWorkflow  relayWorkflow,
string  name 
)
inline

Unsets the value of a variable.

Parameters
relayWorkflowthe workflow.
namethe name of the variable whose value you would like to unset.
Returns
the event response.

◆ Vibrate()

async Task<Dictionary<string, object> > RelayDotNet.Relay.Vibrate ( IRelayWorkflow  relayWorkflow,
string  target,
int[]  pattern 
)
inline

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.

Parameters
relayWorkflowthe workflow.
targetthe interaction URN.
patternan array representing the pattern of your vibration. Defaults to none.
Returns
the event response.

Property Documentation

◆ RelayWebSocketConnector

IRelayWebSocketConnector RelayDotNet.Relay.RelayWebSocketConnector
get

The documentation for this class was generated from the following file: