Class Workflow

  • All Implemented Interfaces:
    java.lang.Cloneable

    public abstract class Workflow
    extends java.lang.Object
    implements java.lang.Cloneable
    A representation of a Relay workflow instance that can receive events from the Relay server, and is where you implement your workflow logic. Override these empty event callbacks with the logic you want to perform upon each event type. The Relay object provides the context for invoking actions. The Event objects passed in to you here provides information about the event and what triggered it. For more information on each of these methods and their events, see the classes under the "types" directory in the src folder.
    • Constructor Detail

      • Workflow

        public Workflow()
    • Method Detail

      • onStart

        public void onStart​(Relay relay,
                            StartEvent startEvent)
        Your workflow is starting.
        Parameters:
        relay - a relay device context.
        startEvent - your workflow has been triggered. Contains information on the type of trigger that started the workflow.
      • onStop

        public void onStop​(Relay relay,
                           StopEvent stopEvent)
        Your workflow is stopping.
        Parameters:
        relay - a relay device context.
        stopEvent - information on why your workflow has stopped.
      • onInteractionLifecycle

        public void onInteractionLifecycle​(Relay relay,
                                           InteractionLifecycleEvent lifecycleEvent)
        An interaction is starting, resuming, or ending.
        Parameters:
        relay - a relay device context.
        lifecycleEvent - an interaction has started, ended, resumed, been suspended or failed.
      • onPrompt

        public void onPrompt​(Relay relay,
                             PromptEvent promptEvent)
        Text-to-speech stream has started or stopped on the device.
        Parameters:
        relay - a relay device context.
        promptEvent - marks the beginning and end of text-to-speech delivery.
      • onTimer

        public void onTimer​(Relay relay,
                            TimerEvent timerEvent)
        An unnamed timer has fired.
        Parameters:
        relay - a relay device context.
        timerEvent - an unnamed timer has fired.
      • onTimerFired

        public void onTimerFired​(Relay relay,
                                 TimerFiredEvent timerFiredEvent)
        A named timer has fired.
        Parameters:
        relay - a relay device context.
        timerFiredEvent - a named timer has fired.
      • onButton

        public void onButton​(Relay relay,
                             ButtonEvent buttonEvent)
        The talk or assistant button has been pressed.
        Parameters:
        relay - a relay device context.
        buttonEvent - a button has been pressed during a running workflow.
      • onNotification

        public void onNotification​(Relay relay,
                                   NotificationEvent notificationEvent)
        A broadcast or alert has been sent.
        Parameters:
        relay - a relay device context.
        notificationEvent - a device has acknowledged an alert.
      • onSms

        public void onSms​(Relay relay,
                          SmsEvent smsEvent)
        A callback for the SmsEvent (TBD).
        Parameters:
        relay - a relay device context.
        smsEvent - an SMS event.
      • onSpeech

        public void onSpeech​(Relay relay,
                             SpeechEvent speechEvent)
        You have spoken into the device, typically when listen() is happening.
        Parameters:
        relay - a relay device context.
        speechEvent - you have spoken into the device.
      • onIncident

        public void onIncident​(Relay relay,
                               IncidentEvent incidentEvent)
        An incident has been created.
        Parameters:
        relay - a relay device context.
        incidentEvent - an incident has been resolved.
      • onCallStartRequest

        public void onCallStartRequest​(Relay relay,
                                       CallStartEvent callStartEvent)
        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.
        Parameters:
        relay - a Relay device context.
        callStartEvent - information about the outbound call request
      • onCallReceived

        public void onCallReceived​(Relay relay,
                                   CallReceivedEvent callReceivedEvent)
        The device is receiving an inbound call request. This event can occur on the callee.
        Parameters:
        relay - a Relay device context.
        callReceivedEvent - information about the inbound call request
      • onCallRinging

        public void onCallRinging​(Relay relay,
                                  CallRingingEvent callRingingEvent)
        The device we called is ringing. We are waiting for them to answer. This event can occur on the caller.
        Parameters:
        relay - a Relay device context.
        callRingingEvent - information about the ringing party.
      • onCallProgressing

        public void onCallProgressing​(Relay relay,
                                      CallProgressingEvent callProgressingEvent)
        The device we called is making progress on getting connected. This may be interspersed with onCallRinging(Relay, CallRingingEvent). This event can occur on the caller.
        Parameters:
        relay - a Relay device context.
        callProgressingEvent - information about the called party.
      • onCallConnected

        public void onCallConnected​(Relay relay,
                                    CallConnectedEvent callConnectedEvent)
        A call attempt that was ringing, progressing, or incoming is now fully connected. This event can occur on both the caller and the callee.
        Parameters:
        relay - a Relay device context.
        callConnectedEvent - information about the other party.
      • onCallDisconnected

        public void onCallDisconnected​(Relay relay,
                                       CallDisconnectedEvent callDisconnectedEvent)
        A call that was once connected has become disconnected. This event can occur on both the caller and the callee.
        Parameters:
        relay - a Relay device context.
        callDisconnectedEvent - information about the other party.
      • onCallFailed

        public void onCallFailed​(Relay relay,
                                 CallFailedEvent callFailedEvent)
        A call failed to get connected. This event can occur on both the caller and the callee.
        Parameters:
        relay - a Relay device context.
        callFailedEvent - information about the call attempt.
      • onPlayInboxMessage

        public void onPlayInboxMessage​(Relay relay,
                                       PlayInboxMessagesEvent playInboxMessagesEvent)
        Audio is streaming in regarding a missed message.
        Parameters:
        relay - a Relay device context.
        playInboxMessagesEvent - information about the missed message.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException