Custom Audio

Using the Relay CLI you can upload your own audio files to playback inside a workflow. To start with, select a supported audio file (today we support .wav files with 16kHz sample rate, 16 bits per sample and shorter than 30 seconds).

$ relay login
$ relay audio:create -f emergency_tone.wav -n emergency
Uploaded 'emergency' with ID 'hKDjDJc4sTDMIVx9C2WQmXC'
  - Use this file in your workflows as 'relay-static://emergency'
  - This file can be deleted using the following command:
    relay audio:delete -i hKDjDJc4sTDMIVx9C2WQmXC

We can then list the audio files we've uploaded on this account with the audio:list command.

$ relay audio:list
=== Uploaded Audio Files
Id                      Short name  Audio format
hKDjDJc4sTDMIVx9C2WQmXC emergency   wave

To play this audio file from inside a workflow, we can use the play() or playAndWait() command (the playAndWait() waits until the file finishes playing).

relay.on(Event.START, async () => {
    await relay.say('This is an emergency!')
    await relay.playAndWait('relay-static://emergency')
    await relay.terminate()
  })