Amazon Echo has some method to send messages directly without request. In alexa.amazon.com site, you can get access to several functions.
To emulate the actions with SmartThings its necessary to get the cookie from the alexa site to send the commands
To share the cookie is a security problem , with the cookie it’s possible to control your echo and smart devices connected to system. it´s possible to know your name, email, address, wifi network, etc.
I don’t like to use a third party servers to get the cookie and update it
To avoid the use of external server, this development needs to get the cookie manually to use it, only you will known the cookie and this information will be send only to your amazon server (.com, .uk, .mx, etc)
I think the cookie last 15 days, then you need to update the cookie again.
Tip: Try to open a incognito window to login in alexa.amazon.com, once you get your cookie just close the window, if you log out from the site , your cookie will expire, then just close the window and you can open other session in your regular browser if you need it.
To get the cookie you need to go to alexa.amazon.com, if you are in other country the site will redirect you to your country site.
Instructions to get the cookie https://www.gehrig.info/alexa/Alexa.html , we need the Domain : https://alexa.amazon.com or the domain you get in the site, it depends of your country, the CSRF and the cookie
If you have problems to find the beginning and end of the cookie, try to use the site https://incarnate.github.io/curl-to-php , it will parse the curl command into pieces. just be careful to remove the Cookie: . from the beginning if you use the site.
In my Chrome Browser I use the option “Copy as Curl(bash)” and paste that info en the parser site.
If your browser does not have the option “Copy as Curl(bash)” be careful your cookie data do not have ^^ characters, try to use another copy as curl option
You need add the info obtained from alexa site in the iniSettings() secction of the Echo Connect App Code, it have some example data , but you must replace it with your real info
state.cookie = “x-amzn-dat-gui-client-v=1.24.2024…I6H6epBktwjMhQjRRVM+c9uvwoX6”
state.csrf = “-2168072530”
state.domain = “https://alexa.amazon.com”
I still need to add more functions, but need your feedback to improve the code.
Added some speak commands in speak function , now you can ask Weather,Traffic,FlashBriefing,GoodMorning,SingASong,TellStory in speak command
Restore volume is not possible due a undefined length of phrase, but you can force a restore volume if you set a delay
Example speak(“weather”) or speak(“tellStory”,50) or speak(“tellStory”,50, 20)
Fix Volume value, each Update Status the volume is updated even if no media is playng
Fix Status, Added “IDLE” and “Standby” status
Speak Parametrs Added, you can use speak with volume change and custom delay, volume and delay are optional speak(Message required, Volume optional, Delay optional)
speak(“The door is open”) TTS
speak(“The door is open”, 50) TTS If New Volumen != Current Volume it changes and after some time the volume is restored, the delay is message/19
speak(“The door is open”, 50, 4) TTS If New Volumen != Current Volume it changes and after custom delay the volume is restored
V1.2.0 Added createReminder("2018-12-25T00:01,“Christmas Time”)
V1.1.0 Added TuneIn stations, Search and play
tell me if works with others alexa third party devices.