Actionable Notifications via Alexa Media Player

Great work! I was wondering if the notification could also be a “real announcement”
with a prior beep before alexa speaks. It always frightens me when she suddenly
starts to talk :scream:.

As I understand the way “Alexa Actions” work it’s not possible
(please correct me If I am wrong) so I thought of a work around with the
SSML audio tag.

Here my Steps:

The Announcement beep mp3 files are available here:
https://developer.amazon.com/alexa/console/avs/previews/resources
look for “Alexa sound library for AVS (v1.2)”.

The mp3 file has to be “Alexa-friendly”, which i thought it would be as i downloaded
the “Alexa” sound library from Amazon. But turns out it was not so you have
to convert it following these steps: https://developer.amazon.com/en-US/docs/alexa/custom-skills/speech-synthesis-markup-language-ssml-reference.html#h3_converting_mp3

I host the mp3 file according to this (S3 Storage is working for me):
https://developer.amazon.com/en-US/docs/alexa/custom-skills/speech-synthesis-markup-language-ssml-reference.html#hosting-the-audio-files-for-your-skill

Final Step: I put the SSML audio tag in front of my text:

    action:
      - service: script.activate_alexa_actionable_notification
        data_template:
          text: "<audio src='https://YOUR URL TO MP3 FILE'/> The front door has been unlocked for 5 mins, would you like me to lock it?"
          event_id: 'actionable_notification_lock_left_unlocked'
          alexa_device: 'media_player.living_room_echo'

Now alexa beep before speak. But sometimes she doesn’t and I thought of some problem when she is loading the file and try to give some extra time with a break:

 data_template:
   text: "<break time='1s'/> <audio src='https://YOUR URL TO MP3 FILE'/> The front door has been unlocked for 5 mins, would you like me to lock it?"

And now she always beep beep before speak.

5 Likes