Giter Site home page Giter Site logo

alexa-remote's Introduction

alexa-remote2

NPM version Downloads Test and Release

Library to remote control an Alexa (Amazon Echo) device via LAN/WLAN.

Disclaimer

All product and company names or logos are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them or any associated subsidiaries! This personal project is maintained in spare time and has no business goal. ALEXA is a trademark of AMAZON TECHNOLOGIES, INC.

Troubleshooting

Issues when getting the cookie and tokens initially

If you still use the E-Mail or SMS based 2FA flow, then this might not work. Please update the 2FA/OTP method in the amazon settings to the current process.

If you open the Proxy URL from a mobile device where also the Alexa App is installed on, it might be that it does not work because Amazon might open the Alexa App. So please use a device or PC where the Alexa App is not installed

If you see a page that tells you that "alexa.amazon.xx is deprecated" and you should use the alexa app and with a QR code on it when you enter the Proxy URL" then this means that you call the proxy URL ith a different IP/Domainname then you entered in the "proxy own IP" settings, or you adjusted the IP shown in the Adapter configuration. The "proxy own IP" setting needs to match the IP/Domainname you use to call the proxy URL!

Push Connections do not connect

Sometimes it could happen that because of too many connection tries aAmazon blocks the push connection endpoint for a specific IP and "device".

If the Push connection is never established, then you can try to use the following:

  • delete all cookies, formerRegistrationData and macDms from the settings
  • locale the location of the alexa-cookie2 library in your npm tree
  • check if there is a file like .../alexa-cookie2/lib/formerDataStore.json - if existing please delete them
  • get new cookie via proxy

Then it should work again

Example

see example folder

Thanks:

Partly based on Amazon Alexa Remote Control (PLAIN shell) and alexa-remote-control and OpenHab-Addon Thank you for that work.

Known issues/Todos

Changelog:

7.0.4 (2024-04-16)

  • (Apollon77) Adjust Activity Record query to Amazon changes
  • (NebzHB) fix missing amazonPage reference instead of amazon.de

7.0.3 (2024-01-25)

  • (Apollon77) Adjust Activity Record query to newest Amazon changes

7.0.2 (2023-11-25)

  • (Apollon77) Adjust some texts

7.0.1 (2023-11-24)

  • (Apollon77) Prevent some error/crash cases

7.0.0 (2023-11-08)

  • (Apollon77) Add new option "autoQueryActivityOnTrigger" to activate the automatic activity triggering (default is off!)
  • (Apollon77) Optimize Timing for activity queries

6.2.2 (2023-10-29)

  • (Apollon77) Optimize activity detection to process all relevant entries in all cases

6.2.1 (2023-10-27)

  • (Apollon77) Optimize activity detection to process all relevant entries and not just the last one

6.2.0 (2023-10-27)

  • (Apollon77) Adjust Activity detection to work with recent Amazon changes

6.1.2 (2023-09-12)

  • (Apollon77) Optimize reconnection handling for push connections

6.1.1 (2023-09-09)

  • (Apollon77) Fix for cookie refresh check

6.1.0 (2023-09-09)

  • (Apollon77) Introduce optional parameter "pushDispatchHost" to specify the host for the push connection
  • (Apollon77) Make sure cookie refresh timeout is valid and prevent overflow
  • (Apollon77) Fix support for push connections JP/AU regions

6.0.2 (2023-09-09)

  • (Apollon77) Added experimental support push connections in BR region

6.0.1 (2023-09-08)

  • (Apollon77) Optimize reconnection timing
  • (Apollon77) Added support for NA/JP and potentially AU regions

6.0.0 (2023-09-08)

  • IMPORTANT: Node.js 16 is now required minimum Node.js version!
  • (Apollon77) Replace WS-MQTT by the new HTTP/2 push connection

5.10.3 (2023-08-08)

  • (Apollon77) Add new parameter usePushConnectType to specify which connectType for the push connection should be used (valid values 1, 2)

5.10.1 (2022-11-30)

  • (Apollon77) Do not overwrite Device details by potentially duplicate App Device details

5.10.0 (2022-10-30)

  • (Apollon77) Adjust deleteConversation to the new API (additional parameter is required!)

5.9.0 (2022-10-30)

  • (Apollon77) Add new methods for enable/disable of alarms and use in changeNotification if Alarm or MusicAlarm

5.8.3 (2022-10-27)

  • (Apollon77) Fix retry issues for rate limited responses from amazon
  • (Apollon77) Lowercase text that sent to textcommand because other cases had issues in the past

5.8.2 (2022-08-19)

  • (Apollon77) Fix doNotDisturb sequence command when time string was used

5.8.1 (2022-08-18)

  • (Apollon77) Fix doNotDisturb sequence command

5.8.0 (2022-08-09)

  • (Apollon77) Allow sendSequenceCommand method to also send commands to multiple devices (when supported by the relevant command like doNotDisturb)

5.7.6 (2022-08-06)

  • (Apollon77) Fix Timer/Alarm creation with just providing the time and make sure next day is used when time on current day is already over

5.7.5 (2022-08-04)

  • (Apollon77) Fix rate limit retries

5.7.4 (2022-08-03)

  • (Apollon77) Update cookie library to optimize cookie handling in other regions like australia

5.7.3 (2022-07-19)

  • (Apollon77) Fix deviceStop sequence command

5.7.2 (2022-07-19)

  • (Apollon77) Fix crash case reported by Sentry

5.7.1 (2022-07-18)

  • (Apollon77) Fix doNotDisturb/doNotDisturbAll in sequenceCommands
  • (Apollon77) Other sequence command optimizations

5.7.0 (2022-07-18)

  • (Apollon77) Enhance querySmarthomeDevices to directly hand over an array of request definitions to e.g. also specify properties or such
  • (Apollon77) Enhance SequenceCommands:
    • "deviceStop" can also be called with an array of devices
    • add "deviceStopAll" to stop all devices
    • add "deviceDoNotDisturb" with allowed values as follows: boolean true/false to enable/disable or a number to set a enable-duration in seconds (up to 43.200 seconds = 12h) or use "HH:MM" as string to define an hour and minute till when it is set to not disturb
    • add "deviceDoNotDisturbAll" to set Do not disturb for all devices, allowed value is the same as deviceDoNotDisturb
    • add "fireTVTurnOn" to turn FireTV on (value ignored)
    • add "fireTVTurnOff" to turn FireTV off (value ignored)
    • add "fireTVTurnOnOff" to turn a FireTV device on (value===true) or off (value===false)
    • add "fireTVPauseVideo" to pause a video on a FireTV device
    • add "fireTVResumeVideo" to resume a video on a FireTV device
    • add "fireTVNavigateHome" to navigate home on a FireTV device
  • (Apollon77) Add getFireTVEntities() method to get available FireTV devices and their supported actions
  • (Apollon77) Flag Fire-TV devices as controllable and having music player support
  • (Apollon77) Add several new methods to query and change settings:
    • getEqualizerEnabled()
    • getEqualizerRange()
    • getEqualizerSettings()
    • setEqualizerSettings()
    • getAuxControllerState()
    • setAuxControllerPortDirection()
    • getPlayerQueue()
    • getDeviceSettings() - generic method, ideally use the methods listed next to get specific settings
    • setDeviceSettings() - generic method, ideally use the methods listed next to get specific settings
    • getConnectedSpeakerOptionSetting()
    • setConnectedSpeakerOptionSetting()
    • getAttentionSpanSetting()
    • setAttentionSpanSetting()
    • getAlexaGesturesSetting()
    • setAlexaGesturesSetting()
    • getDisplayPowerSetting()
    • setDisplayPowerSetting()
    • getAdaptiveBrightnessSetting()
    • setAdaptiveBrightnessSetting()
    • getClockTimeFormatSetting()
    • setClockTimeFormatSetting()
    • getBrightnessSetting()
    • setBrightnessSetting()
  • (Apollon77) Allow to overwrite the used default App-Name for the Amazon App Registration
  • (Apollon77) An App name included in formerRegistrationData will be used for some API requests, else the default is used
  • (Apollon77) Allow to modify the API-User-Agent Postfix to specify application name and version
  • (Apollon77) Enhance the handling for exceeded rate limit responses
  • (Apollon77/bbindreiter) Update used User-Agent for some requests

5.6.0 (2022-07-12)

  • (Apollon77) Add sequence command "wait"

5.5.0 (2022-07-11)

  • (Apollon77) Add playAudible() to play Audible books

5.4.0 (2022-07-11)

  • (Apollon77) Increase timeouts for getting smart home device data
  • (Apollon77) support/handle "MusicAlarm" like "Alarm" on notifications
  • (Apollon77) Add convertNotificationToV2() to convert a notification object from old/queried format into one that can be used to set with new/V2 API (very pragmatic for now)

5.3.0 (2022-07-09)

  • (Apollon77) Adjust Alarm methods to use the new API from Amazon. Also createNotification() and parseValue4Notification() now returns the new format for Alarms
  • (Apollon77) Enhance createNotification() to also support adding reccurence information
  • (Apollon77) Notification objects will also have a delete method now
  • (Apollon77) Notifications can be cancelled now
  • (Apollon77) Adjust logging when no callback is provided again, now logs also the body
  • (Apollon77) Add methods:
    • getUsersMe()
    • getHousehold()
    • getNotificationSounds()
    • getDeviceNotificationState()
    • setDeviceNotificationVolume()
    • setDeviceNotificationDefaultSound()
    • getDeviceNotificationDefaultSound()
    • getAscendingAlarmState()
    • setDeviceAscendingAlarmState()
    • getRoutineSkillCatalog() to request the Skill catalog that can be used in Sequence Commands
    • cancelNotification()
    • setNotification() and setNotificationV2()

5.2.0 (2022-07-06)

  • (Apollon77) Query API endpoints (including new method getEndpoints()) from Amazon on start and use this API endpoint for the calls
  • (Apollon77) Enhance getDevicePreferences() to request preferences for one device
  • (Apollon77) Add setDevicePreferences() to set the device preferences for a device
  • (Apollon77) Add getDeviceWifiDetails() to get the Wifi definitions (including SSID and MAC) for a device
  • (Apollon77) Load Device Preferences on startup and make accessible via device.preferences on the device objects
  • (Apollon77) Add methods getDevicePreferences() and setDevicePreferences() to the alexa class and to the device objects
  • (Apollon77) Add new Media Message "jump" (in sendMessage() method) with a mediaId as value (can be used to jump to another queue item)
  • (Apollon77) Add getRoutineSoundList() to query available sound IDs for a routine
  • (Apollon77) Add new command "sound" when creating/sending sequence nodes to play sounds
  • (Apollon77) Add method getWholeHomeAudioGroups() to query information about the current Audio groups
  • (Apollon77) Enhance sending "notification" sequence node to allow providing an object as value with keys title and text to specify the title for displaying the message too
  • (Apollon77) Add setEnablementForSmarthomeDevice() to enable/disable a smart home device
  • (Apollon77) Log Response with status code also when no callback is provided (but without body content)
  • (Apollon77) Slightly adjust the calculated timeout when getting many smart home device values

5.1.0 (2022-07-04)

  • (Apollon77) Detect Rate limit exceeded response and do one automatic request retry 10s later (plus a random part)
  • (Apollon77) Calculate the timeout of querySmarthomeDevices dynamically between 10s and 60s (maximum overrideable by new optional parameter) depending on the number of devices to query

5.0.1 (2022-07-03)

  • (Apollon77) fix type definition for sequenceCommand methods

5.0.0 (2022-07-02)

  • BREAKING: SequenceNode methods throws an error on invalid data instead calling callback with error as before!
  • (Apollon77) Enhance multi sequence Node methods to support building node structures with sub Parallel/SerialNodes
  • (Apollon77) Adjust logic to get the "global" ownerCustomerId and use Authentication response from session verification call
  • (Apollon77) Add getAuthenticationDetails() method to get the Authentication response from the last successful session verification call
  • (Apollon77) Add method isWsMqttConnected() to query if the WS-MQTT connection is established or not
  • (Apollon77/hive) Add method stopProxyServer() to stop the proxy server pot. opened from getting a new cookie
  • (Apollon77) Adjust setTuneIn method to work again for stationIds (s*) and topicIds (t*)
  • (Apollon77) Do an automatic request retry with a delay of 500-1000ms (random) when error 503 is returned from Amazon services
  • (Apollon77/hive) Correctly end all timers on disconnect
  • (Apollon77/hive) Optimize authentication check when no cookie is set
  • (Apollon77) Prevent some crash cases

4.1.2 (2022-02-20)

  • (TactfulElf) Allow csrf to be updated on cookie refresh and add 401 error handling

4.1.1 (2021-11-13)

  • (Apollon77) Prevent crash case in edge cases when unexpected WSMQTT responses are received

4.1.0 (2021-11-13)

  • (Apollon77) SequenceNodes created for a device are now bound to the "deviceOwnCustomer" - should help in mixed owner groups

4.0.4 (2021-11-06)

  • (Apollon77) Fix crash case

4.0.3 (2021-10-12)

  • (Apollon77) Fix crash case (Sentry IOBROKER-ALEXA2-AT)

4.0.2 (2021-10-12)

  • (Apollon77) Adjust Timing on Push Connection initialization
  • (Apollon77) Adjust timing when matching History entries because sometimes Amazon seems to need a bit longer for new infos become available

4.0.1 (2021-10-11)

  • (Apollon77) Adjust call headers

4.0.0 (2021-10-11)

  • IMPORTANT: Node.js 10 support is dropped, supports LTS versions of Node.js starting with 12.x
  • (Apollon77) Change Push connection to new signed flow
  • (RodolfoSilva) Add TypeScript Type definitions

3.9.0 (2021-07-30)

  • (guilhermelirio) Add skill launch function
  • (guilhermelirio) Add getSkills() function

3.8.1 (2021-06-04)

  • (bbindreiter) Set missing Accept Header

3.8.0 (2021-05-11)

  • (Apollon77) Always recognize "alexa" as wakeword to handle commands via the apps correctly

3.7.2 (2021-04-18)

  • (Apollon77) Adjust automatic Cookie Refresh interval from 7 to 4 days
  • (Apollon77) Add other checks for websocket connection handling (Sentry IOBROKER-ALEXA2-32)

3.7.1 (2021-02-03)

  • (Apollon77) also capture tests from ASR_REPLACEMENT_TEXT and TTS_REPLACEMENT_TEXT into summary and alexaResponse

3.7.0 (2021-02-03)

  • (Apollon77) Implement new method to get History/Activities
    • getActivities Method is still there and still triggers the Amazon route as till now. INo idea ng it still works for some users. I declared it as deprecated now
    • add new method "getCustomerHistoryRecords" which uses another endpoint on Amazon side and delivers different data. The return is returned relative compatible to getActivities, so should be a drop in replacement - beside the fact that some fileds can not be provided any longer and will be simply empty! (e.g. activityStatus, deviceAccountId ...) Also in the amazon data some fields are no longer existing (e.g. domainAttributes ...)
    • the event "ws-device-activity" is migrated to use the new getCustomerHistoryRecords endpoint, and so returns compatible, but not 100% the same data
  • (Apollon77) Make sure to not hammer requests to Amazon in case the activity request returns an error and the received PUSH_ACTIVITY entry was not found
  • (Apollon77) Detect and handle 50x error cases and handle them as if no content was returned
  • (Apollon77) Enhance communication to also support gzip and deflate encoded responses because Amazon sometimes ignore requested Accept-Encoding specs. This also could improve speed

3.6.0 (2021-01-28)

  • (Apollon77) Adjust to new automations (Routines) route
  • (Apollon77) Add getAllDeviceVolumes method
  • (Apollon77) Return relationships in getSmarthomeDevices call

3.5.2 (2021-01-17)

  • (Apollon77) Fix potential crash issue (Sentry IOBROKER-ALEXA2-39)

3.5.0 (2020-12-24)

  • (Apollon77) Fix potential crash issue (Sentry IOBROKER-ALEXA2-2V)
  • (FliegenKLATSCH) add cookie as new event when a new cookie is generated
  • (FliegenKLATSCH) fix error code handling

3.4.0 (2020-12-11)

  • (Apollon77) add support for textCommand - tell an Alexa device a text as you would speak it

3.3.3 (2020-12-03)

  • (Apollon77) fix potential crash case (Sentry IOBROKER-ALEXA2-2K)

3.3.2 (2020-11-23)

  • (Apollon77) handle potential crash case (Sentry IOBROKER-ALEXA2-27)
  • (Apollon77) also ignore PUSH_DEVICE_SETUP_STATE_CHANGE push messages
  • (Apollon77) Optimize WSMQTT Reconnection handling for timeout cases

3.3.1 (2020-07-24)

  • (Apollon77) Update cookie lib to maybe be more backward compatible if login/baseUrl was changed
  • (Apollon77) Increase timeout when reading routines

3.3.0 (2020-07-19)

  • (Apollon77) update amazon-cookie library again to optimize upgrades from earlier versions

3.2.6 (2020-07-16)

  • (Apollon77) update amazon-cookie library: Another try to work around Amazon changes

3.2.5 (2020-07-15)

  • (Apollon77) update amazon-cookie library: Another try to work around Amazon changes

3.2.4 (2020-07-15)

  • (Apollon77) update amazon-cookie library: Another try to work around Amazon changes

3.2.3 (2020-07-13)

  • (Apollon77) update amazon-cookie library to work around amazon security changes
  • (Apollon77) Prevent crash on invalid data in request data (Sentry IOBROKER-ALEXA2-1A)
  • (Apollon77) Make sure to handle invalid list responses correctly (Sentry IOBROKER-ALEXA2-1T)

3.2.2 (2020-06-17)

  • (Apollon77) Optimize Request Handling to also Handle timeouts correctly
  • (Apollon77) Increase timeouts for some Smart Home calls to 30s

3.2.1 (2020-06-17)

  • (Apollon77) update amazon-cookie library: another optimization for Node.js 14

3.2.0 (2020-06-16)

  • (Apollon77) Update Cookie Library to allow Proxy Signup again after Amazon changes
  • (hive) add new commands, jokes/facts/goodnight/cleanup
  • (hive) add new command curatedtts with allowed values ["goodbye", "confirmations", "goodmorning", "compliments", "birthday", "goodnight", "iamhome"] to play random curated sentences

3.1.0 (2019-12-30)

  • (Apollon77) remove device._orig because really big objects happened and got exceptions on deep copy using JSION.stringify

3.0.3 (2019-12-28)

  • (Apollon77) update cookie lib

3.0.2 (2019-12-26)

  • (Apollon77) Prevent some errors

3.0.1 (2019-12-24)

  • (Apollon77) Prevent some errors, dependency update

3.0.0 (2019-12-24)

  • (Apollon77) dependency updates
  • (Zefau) add functionality for handling of lists
  • nodejs 8.x is minimum now!

2.5.5 (2019-08-09)

  • (Apollon77) user different mqtt regex to hopefully support other countries better

2.5.4 (2019-08-08)

  • (Apollon77) make sure amazon domains are used as configured instead of "amazon.de" sometimes

2.5.3 (2019-07-22)

  • (Apollon77) also allow Reminders in Future >+1 day

2.5.0/1 (2019-07-21)

  • (Apollon77) enhance announce/ssml to allow send to multiple devices using one command

2.4.0 (2019-07-21)

  • (Apollon77) Finalize methods and logix to send and read and delete messages and what's needed for this

2.3.7 (2019-07-06)

  • (Apollon77) fix (finally) special case on authentication check

2.3.6 (2019-07-05)

  • (Apollon77) fix (finally) special case on authentication check

2.3.5 (2019-07-01)

  • (Apollon77) fix special case on authentication check

2.3.4 (2019-06-25)

  • (Apollon77) fix potential error on PUSH_MEDIA_PROGRESS_CHANGE push infos

2.3.3 (2019-06-23)

  • (Apollon77) change authentication check to hopefully better handle DNS or other "Network unavailable" errors

2.3.2 (2019-06-21)

  • (Apollon77) fix ssml

2.3.1 (2019-06-21)

  • (Apollon77) optimize handling for missing csrf cases

2.3.0 (2019-06-20)

  • (Apollon77) use alexa-cookie lib 2.1 with latest adoptions to Amazon changes (Cookie CSRF was missing)
  • (Apollon77) fixed default cookie refresh interval
  • (Apollon77) When Speak via SSML is done this is not send as card value
  • (Apollon77) add PUSH_MEDIA_PROGRESS_CHANGE to known WS-MQTT topics
  • (Apollon77) change WS reconnection logic to try once per minute

2.2.0 (2019-01-xx)

  • (Apollon77) add new sequenceCommands "calendarNext", "calendarToday", "calendarTomorrow"
  • (Apollon77) fix wake word handling and history sanitizing

2.1.0 (2019-01-12)

  • (Apollon77) add new sequenceCommands "deviceStop", "notification", "announcement" and finally "ssml"

2.0.0 (2018-12-02)

  • (Apollon77) upgrade amazon-cookie lib to 2.0

1.0.3 (2018-11-17)

  • (Apollon77) upgrade amazon-cookie lib
  • (Apollon77) better handle ws errors and upgrade ws version to still support nodejs 6

1.0.2 (2018-11-17)

  • (Apollon77) upgrade amazon-cookie lib

1.0.1 (2018-11-09)

  • (Apollon77) upgrade amazon-cookie lib
  • (Apollon77) small fix for strange history summary content

1.0.0 (2018-09-06)

  • (Apollon77) polishing and finalization and make it 1.0.0

0.6.1 (2018-08-28)

  • (Apollon77) rework scenes and add option to send Parallel or Sequencial commands
  • (Apollon77) enhance methods for smart home device and group handling

0.6.0 (2018-08-24)

  • (Apollon77) several fixes and optimizations
  • (Apollon77) enhance methods for smart home device and group handling

0.5.2 (2018-08-16)

  • (Apollon77) also allow new reminder on next day :-)

0.5.0 (2018-08-16)

  • (Apollon77) fix an error when getting new cookie
  • (Apollon77) Add Reminder and Alarms support.
  • (Apollon77) Enhance Push Connection
  • (Apollon77) Added some more deviceTypes

0.3.0 (2018-08-13)

  • (Apollon77) Added Websocket/MQTT connection class and also initialize it when requested via alexa-remote class.
  • (Apollon77) Websocet/MQTT class and also Alexa-Remote are now event emitters to be able to notify on push changes
  • (Apollon77) many fixes and optimizations, changed code to be an ES6 class
  • (Apollon77) reworked the "prepare" step and only initialize what's really needed and allow extra "init" methods also to update Devices, Bluetooth and such. Docs will follow
  • (Apollon77) API breaking: executeAutomationRoutine is not expecting a routineId anymore, but the complete routine definition.

0.1.0

  • (Apollon77) added automatic cookie renewal when email and password are provided
  • (Apollon77) added authentication checks by bootstrap call (like alexa-remote-control)
  • (Apollon77) several fixes
  • (Apollon77) added logger option

0.0.x

  • Versions by soef

alexa-remote's People

Contributors

586837r avatar alandtse avatar apollon77 avatar bbindreiter avatar dependabot-preview[bot] avatar dependabot[bot] avatar fliegenklatsch avatar germanbluefox avatar guilhermelirio avatar nebzhb avatar rodolfosilva avatar soef avatar tactfulelf avatar zefau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alexa-remote's Issues

Error after session active > 24 hours

Hello, Alexa-remote won't correctly process speak functions after its been running for > 24 hours. Here are the relevant log entries:

Alexa-Remote: No authentication check needed (time elapsed 33888)
Alexa-Remote: Sending Request with {"host":"pitangui.amazon.com","path":"/api/behaviors/preview","method":"POST","timeout":10000,"headers":{}} and data={"behaviorId":"PREVIEW","sequenceJson":"{"@type":"com.amazon.alexa.behaviors.model.Sequence","startNode":{"@type":"com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode","operationPayload":{"deviceType":"AKNO1N0KSFN8L","deviceSerialNumber":"G0B0H506617700D3","locale":"de-DE","customerId":"AWMF3SVYOF8RS","textToSpeak":"hello"},"type":"Alexa.Speak"}}","status":"ENABLED"}
Alexa-Remote: Response: No body
Error: no body
at IncomingMessage. (C:\alexa-speaks\public\alexa-remote.js:767:126)
at IncomingMessage.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1184:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)

Alexa-Remote always returns "Response: No body" and then Alexa speaks the text, but it appears that the status code is something other than 200 when the problem starts occurring. Here's how the logs look when the command is successful:
Alexa-Remote: No authentication check needed (time elapsed 24222)
Alexa-Remote: Sending Request with {"host":"pitangui.amazon.com","path":"/api/behaviors/preview","method":"POST","timeout":10000,"headers":{}} and data={"behaviorId":"PREVIEW","sequenceJson":"{"@type":"com.amazon.alexa.behaviors.model.Sequence","startNode":{"@type":"com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode","operationPayload":{"deviceType":"AKNO1N0KSFN8L","deviceSerialNumber":"G0B0H506617700D3","locale":"de-DE","customerId":"AWMF3SVYOF8RS","textToSpeak":"hello"},"type":"Alexa.Speak"}}","status":"ENABLED"}
Alexa-Remote: Response: No body

As you can see, they appear to be identical except the successful attempt is receiving a status code that begins with "2".

how to setup

Hello,

can you at least provide documentation regarding how to get the login credentials?

cookie, service host, serial or name etc..

Thanks

Promise-ing the lib

As enhancement, That would be nice to promise-ing the commands to alexa, that would be easier for command chaining ;-)

how to send text to my Alexa device?

Hi ,
I want to send text command my physical Alexa device.
But I take error that is "no body".

Help me anyone this issue?

let serialOrName="G2A0WK04..........";
let sequenceType=null;
let commands=[{"command":"speak","value":"hello"}];
alexa.sendMultiSequenceCommand(serialOrName, commands, sequenceType, function(err, res) {
if (!err && res) {
console.log ("alexa.sendMultiSequenceCommand is success");
}
});

Question: Sending a basic command

How do i send a basic command to the echo device say asking whats the weather ?
I have completed the full process of setup and now the example code which you have shared is doing this

Alexa-Remote WS-MQTT: Send Ping
Alexa-Remote WS-MQTT: Received Pong

Also, when i press a button on the echo, i see some output as well. So definitely everything is connected.

Please help, thanks in advance.

Provide TypeScript type definitions

Is your feature request related to a problem? Please describe.
It's painful to use pure JavaScript modules, like alexa-remote2, in a TypeScript project.

Describe the solution you'd like
The most thorough solution would be to rewrite this package in TypeScript, but I would find it sufficient for the package to include a set of TypeScript type definitions.

Describe alternatives you've considered
The only real alternative is for each TypeScript project that depends on alexa-remote2 to write their own type definitions.

Additional context
N/A

Check/Add Reminders/Alarms

Create Reminder:

PUT https://alexa.amazon.de/api/notifications/createReminder
alarmTime	1532336400000
createdDate	1532329097900
deviceSerialNumber	XXXXXXXX
deviceType	A3S5BH2HU6VAYF
id	createReminder
isRecurring	false
isSaveInFlight	true
originalDate	2018-07-23
originalTime	11:00:00.000
recurringPattern	null
reminderIndex	null
reminderLabel	Testen
sound	null
status	ON
timeZoneId	null
type	Reminder
-> Answer 
{"alarmTime":1532336400000,"createdDate":0,"deferredAtTime":null,"deviceSerialNumber":"XXXXXXXX","deviceType":"A3S5BH2HU6VAYF","id":"A3S5BH2HU6VAYF-XXXXXXXX-ee3f4656-64f8-47f7-85bb-146245c3ba70","musicAlarmId":null,"musicEntity":null,"notificationIndex":"ee3f4656-64f8-47f7-85bb-146245c3ba70","originalDate":"2018-07-23","originalTime":"11:00:00.000","provider":null,"recurringPattern":null,"remainingTime":0,"reminderLabel":"Testen","sound":{"displayName":"Simple Alarm","folder":null,"id":"system_alerts_melodic_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3"},"status":"ON","timeZoneId":null,"timerLabel":null,"triggerTime":0,"type":"Reminder","version":"2"}

Read:

GET https://alexa.amazon.de/api/notifications/A3S5BH2HU6VAYF-XXXXXXXX-ee3f4656-64f8-47f7-85bb-146245c3ba70?_=1532329020816
{"alarmTime":1532336400000,"createdDate":1532329098436,"deferredAtTime":null,"deviceSerialNumber":"XXXXXXXX","deviceType":"A3S5BH2HU6VAYF","id":"A3S5BH2HU6VAYF-XXXXXXXX-ee3f4656-64f8-47f7-85bb-146245c3ba70","musicAlarmId":null,"musicEntity":null,"notificationIndex":"ee3f4656-64f8-47f7-85bb-146245c3ba70","originalDate":"2018-07-23","originalTime":"11:00:00.000","provider":null,"recurringPattern":null,"remainingTime":0,"reminderLabel":"Testen","sound":{"displayName":"Simple Alarm","folder":null,"id":"system_alerts_melodic_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3"},"status":"ON","timeZoneId":null,"timerLabel":null,"triggerTime":0,"type":"Reminder","version":"2"}

Delete:

PUT https://alexa.amazon.de/api/notifications/A3S5BH2HU6VAYF-XXXXXXXX-ee3f4656-64f8-47f7-85bb-146245c3ba70
alarmTime	1532336400000
createdDate	1532329104430
deferredAtTime	null
deviceSerialNumber	XXXXXXXX
deviceType	A3S5BH2HU6VAYF
id	A3S5BH2HU6VAYF-XXXXXXXX-ee3f4656-64f8-47f7-85bb-146245c3ba70
isSaveInFlight	true
musicAlarmId	null
musicEntity	null
notificationIndex	ee3f4656-64f8-47f7-85bb-146245c3ba70
originalDate	2018-07-23
originalTime	11:00:00.000
provider	null
recurringPattern	null
remainingTime	0
reminderIndex	null
reminderLabel	Testen
sound	{…}
    displayName	Simple Alarm
    folder	null
    id	system_alerts_melodic_01
    providerId	ECHO
    sampleUrl	https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3
status	OFF <<------
timerLabel	null
timeZoneId	null
triggerTime	0
type	Reminder
version	2
--> {"alarmTime":1532336400000,"createdDate":0,"deferredAtTime":null,"deviceSerialNumber":"XXXXXXXX","deviceType":"A3S5BH2HU6VAYF","id":"A3S5BH2HU6VAYF-XXXXXXXX-ee3f4656-64f8-47f7-85bb-146245c3ba70","musicAlarmId":null,"musicEntity":null,"notificationIndex":"ee3f4656-64f8-47f7-85bb-146245c3ba70","originalDate":"2018-07-23","originalTime":"11:00:00.000","provider":null,"recurringPattern":null,"remainingTime":0,"reminderLabel":"Testen","sound":{"displayName":"Simple Alarm","folder":null,"id":"system_alerts_melodic_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3"},"status":"OFF","timeZoneId":null,"timerLabel":null,"triggerTime":0,"type":"Reminder","version":"4"}

Daily reminder:

alarmTime	1532334600000
createdDate	1532331059626
deviceSerialNumber	XXXXXXXX
deviceType	A3S5BH2HU6VAYF
id	createReminder
isRecurring	true
isSaveInFlight	true
originalDate	null
originalTime	10:30:00.000
recurringPattern	P1D
reminderIndex	null
reminderLabel	Testen
sound	null
status	ON
timeZoneId	null
type	Reminder

Only weekdays:

PUT https://alexa.amazon.de/api/notifications/A3S5BH2HU6VAYF-XXXXXXXX-3b5ada2f-f8f1-4a2a-97c9-47d713531347
alarmTime	1532334600000
createdDate	1532331116953
deferredAtTime	null
deviceSerialNumber	XXXXXXXX
deviceType	A3S5BH2HU6VAYF
id	A3S5BH2HU6VAYF-XXXXXXXX-3b5ada2f-f8f1-4a2a-97c9-47d713531347
isRecurring	true
isSaveInFlight	true
musicAlarmId	null
musicEntity	null
notificationIndex	3b5ada2f-f8f1-4a2a-97c9-47d713531347
originalDate	null
originalTime	10:30:00.000
provider	null
recurringPattern	XXXX-WD
remainingTime	0
reminderIndex	null
reminderLabel	Testen
sound	{…}
displayName	Simple Alarm
folder	null
id	system_alerts_melodic_01
providerId	ECHO
sampleUrl	https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3
status	ON
timerLabel	null
timeZoneId	null
triggerTime	0
type	Reminder
version	3

Delete:

DELETE https://alexa.amazon.de/api/notifications/A3S5BH2HU6VAYF-XXXXXXXX-3b5ada2f-f8f1-4a2a-97c9-47d713531347

Alarm activate (creation not possible!!):

PUT https://alexa.amazon.de/api/notifications/A3S5BH2HU6VAYF-XXXXXXXX-a20127b3-64b2-3598-8b54-d8e87c9c3cce
alarmIndex	null
alarmTime	1532325600422
createdDate	1522654450951
deferredAtTime	null
deviceSerialNumber	XXXXXXXX
deviceType	A3S5BH2HU6VAYF
id	A3S5BH2HU6VAYF-XXXXXXXX-a20127b3-64b2-3598-8b54-d8e87c9c3cce
isSaveInFlight	true
musicAlarmId	null
musicEntity	null
notificationIndex	a20127b3-64b2-3598-8b54-d8e87c9c3cce
originalDate	2018-04-03
originalTime	00:40:00.000
provider	null
recurringPattern	null
remainingTime	0
reminderLabel	null
sound	{…}
    displayName	Countertop
    folder	null
    id	system_alerts_repetitive_04
    providerId	ECHO
    sampleUrl	https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_repetitive_04.mp3
status	ON
timerLabel	null
timeZoneId	null
triggerTime	0
type	Alarm
version	4
--> {"alarmTime":1532325600422,"createdDate":0,"deferredAtTime":null,"deviceSerialNumber":"XXXXXXXX","deviceType":"A3S5BH2HU6VAYF","id":"A3S5BH2HU6VAYF-XXXXXXXX-a20127b3-64b2-3598-8b54-d8e87c9c3cce","musicAlarmId":null,"musicEntity":null,"notificationIndex":"a20127b3-64b2-3598-8b54-d8e87c9c3cce","originalDate":null,"originalTime":"00:40:00.000","provider":null,"recurringPattern":null,"remainingTime":0,"reminderLabel":null,"sound":{"displayName":"Countertop","folder":null,"id":"system_alerts_repetitive_04","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_repetitive_04.mp3"},"status":"ON","timeZoneId":null,"timerLabel":null,"triggerTime":0,"type":"Alarm","version":"6"}

Change Alarm: IMPORTANT alarmIndex:null!!

PUT https://alexa.amazon.de/api/notifications/A3S5BH2HU6VAYF-XXXXXXXX-YYYYYYYYYY

alarmIndex	null
alarmTime	1532338800000
createdDate	1532331330464
deferredAtTime	null
deviceSerialNumber	XXXXXXXX
deviceType	A3S5BH2HU6VAYF
id	A3S5BH2HU6VAYF-XXXXXXXX-YYYYYYYYYY
isSaveInFlight	true
musicAlarmId	null
musicEntity	null
notificationIndex	YYYYYYYYYY
originalDate	2018-04-02
originalTime	11:40:00.000
provider	null
recurringPattern	
remainingTime	0
reminderLabel	null
sound	{…}
    displayName	Schimmer
    folder	null
    id	system_alerts_melodic_06
    providerId	ECHO
    sampleUrl	https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_06.mp3
status	ON
timerLabel	null
timeZoneId	null
triggerTime	0
type	Alarm
version	4
--> {"alarmTime":1532338800000,"createdDate":0,"deferredAtTime":null,"deviceSerialNumber":"XXXXXXXX","deviceType":"A3S5BH2HU6VAYF","id":"A3S5BH2HU6VAYF-XXXXXXXX-YYYYYYYYYY","musicAlarmId":null,"musicEntity":null,"notificationIndex":"YYYYYYYYYY","originalDate":null,"originalTime":"11:40:00.000","provider":null,"recurringPattern":null,"remainingTime":0,"reminderLabel":null,"sound":{"displayName":"Glimmer","folder":null,"id":"system_alerts_melodic_06","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_06.mp3"},"status":"ON","timeZoneId":null,"timerLabel":null,"triggerTime":0,"type":"Alarm","version":"6"}

Add Smart Home device group management

Retrieve Groups:
in phoenix reply parallel to first amazonBridgeDetails:

"applianceGroups": {
                    "applianceGroups": {
                        "amzn1.HomeAutomation.ApplianceGroup.XXXXXX.550a4bf5-4852-4a35-81c4-b3568b222033": {
                            "applianceGroupName": "Lichter Küche",
                            "applianceGroupIdentifier": {
                                "value": "amzn1.HomeAutomation.ApplianceGroup.XXXXX.550a4bf5-4852-4a35-81c4-b3568b222033"
                            },
                            "spaceTypes": [],
                            "children": [],
                            "alexaEndpoints": [],
                            "defaults": []
                        }
                    }
                }

Create group:

POST https://alexa.amazon.de/api/phoenix/group
applianceIds	[…]
    0	SKILL_eyJza2lsbElkIjoiYW16bjEuYXNrLXXXXXXEtNDhhOS1iYzBhLWQzZDNiZGU4YjVmYyIsInN0YWdlIjoibGl2ZSJ9_Licht_K_che
    1	SKILL_eyJza2lsbElkIjoiYW16bjEXXXXXXZjEtNDhhOS1iYzBhLWQzZDNiZGU4YjVmYyIsInN0YWdlIjoibGl2ZSJ9_Deckenlicht_K_che
groupId	null
name	Lichter Küche
--> keine

Read a group:

GET https://alexa.amazon.de/api/phoenix/group?_=1532329020882
{"applianceGroups":[{"applianceIds":["SKILL_eyJza2lsbElkIjoiYWXXXXXXXNDhhOS1iYzBhLWQzZDNiZGU4YjVmYyIsInN0YWdlIjoibGl2ZSJ9_Licht_K_che","SKILL_eyJza2lsbElkIjoiYW16XXXXXXZjEtNDhhOS1iYzBhLWQzZDNiZGU4YjVmYyIsInN0YWdlIjoibGl2ZSJ9_Deckenlicht_K_che"],"defaults":[],"groupId":"amzn1.HomeAutomation.ApplianceGroup.YYYYYYYYYY.6e1ee4e0-d152-4ca4-8755-3e826c99dcab","name":"Lichter Küche"}]}

Change a group:

PUT https://alexa.amazon.de/api/phoenix/group/amzn1.HomeAutomation.ApplianceGroup.YYYYYYYYYY.6e1ee4e0-d152-4ca4-8755-3e826c99dcab
applianceIds	[…]
    0	SKILL_eyJza2lsbElkIjoiYW16bjEuYXNrLnNraWxXXXXXXS1iYzBhLWQzZDNiZGU4YjVmYyIsInN0YWdlIjoibGl2ZSJ9_Licht_K_che
    1	SKILL_eyJza2lsbElkIjoiYW16bjEuYXNrLnNraWXXXXXX1iYzBhLWQzZDNiZGU4YjVmYyIsInN0YWdlIjoibGl2ZSJ9_Deckenlicht_K_che
defaults	[]
groupId	amzn1.HomeAutomation.ApplianceGroup.YYYYYYYYYY.6e1ee4e0-d152-4ca4-8755-3e826c99dcab
name	Lichter Küche

All play Amazon Music Playlist

command = "{"playlistId":"" + playListId + "","playQueuePrime":true}";
"POST",
alexaServer + "/api/cloudplayer/queue-and-play?deviceSerialNumber=" + device.serialNumber
+ "&deviceType=" + device.deviceType + "&mediaOwnerCustomerId="
+ device.deviceOwnerCustomerId + "&shuffle=false",
command

maybe without ,"playQueuePrime":true} ?!

no csrf found

Dear,

alot of my users receive this message the last 24h hours, are you aware Amazon changed something ?

I see you display that if this.csrf is not found in headers on getCookie ... any clue where it could come from ?

BR's

Nebz

Question on volume

Hello,
I would like to reproduce one text at a given volume, for instance 100, without changing the default volume of the Echo.

I have not understood how to do that, can you please help?

Thanks,
Dan

Add play Amazon Music Track

String command = "{"trackId":"" + trackId + "","playQueuePrime":true}";
("POST",
alexaServer + "/api/cloudplayer/queue-and-play?deviceSerialNumber=" + device.serialNumber
+ "&deviceType=" + device.deviceType + "&mediaOwnerCustomerId="
+ device.deviceOwnerCustomerId + "&shuffle=false",
command

Add/Check query for wifi details

'/api/device-wifi-details?deviceSerialNumber=' + amazonDeviceObject.serialNumber + '&deviceType=' + amazonDeviceObject.deviceType

--> essid, macAddress

Muted

Hello,

Sorry for my bad English.

The Mute command does not appear to exist.

While the value is well up in the PUSH_VOLUME_CHANGE

Is it possible to add it?

The goal is to take into account the mutated for an announcement or to "make speak" to restore it after the announcement.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

[Feature Request] Add endpoints for settings APIs

Thank you for this helpful repository. I was wondering if you have any plans to add the endpoints for various settings.

For example couple of them which might be useful are:

  1. History API: Using this we can fetch the past statements which are said to alexa
  2. Language: This can be used to change the language

Audio tag is not working in ssml

I send to ssml my Alexa device. Text can be converted speech, whispered effect is working but audio url does not work.

    let serialOrName="G2A0WK048432057N";
    let command="ssml";
    let value='<speak><audio src="https://s3-us-west-1.amazonaws.com/sayspring-prod/media/celtic-open-chime.mp3"/> Welcome to Car-Fu.<amazon:effect name="whispered">I am not a real human.</amazon:effect>.</speak>';
    alexa.sendSequenceCommand(serialOrName, command, value, function(err, res) {
        console.log ("error: "+err)
        console.log ("result: "+res)
        if (!err && res) {
            console.log ("alexa.sendSequenceCommand is successfull");
        }

    });

logs:

deviceSerial :87c51d3bcffe48019bf9c55fb4928df6
deviceSerial :G2A0WK048432057N
deviceSerial :DB35389691CA4C4AA1037BAFEBFE9E1A
Alexa-Remote: No authentication check needed (time elapsed 6706)
Alexa-Remote: Sending Request with {"host":"pitangui.amazon.com","path":"/api/behaviors/preview","method":"POST","timeout":10000,"headers":{}}and data={"behaviorId":"PREVIEW","sequenceJson":"{"@type":"com.amazon.alexa.behaviors.model.Sequence","startNode":{"@type":"com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode","operationPayload":{"customerId":"A2Q8GQKLT884AQ","expireAfter":"PT5S","content":[{"locale":"en-US","display":{"title":"ioBroker","body":"<audio src=\"s3-us-west-1.amazonaws.com/sayspring-prod/media/celtic-open-chime.mp3\"/> Welcome to Car-Fu.<amazon:effect name=\"whispered\">I am not a real human.</amazon:effect>."},"speak":{"type":"ssml","value":"<audio src=\"s3-us-west-1.amazonaws.com/sayspring-prod/media/celtic-open-chime.mp3\"/> Welcome to Car-Fu.<amazon:effect name=\"whispered\">I am not a real human.</amazon:effect>."}}],"target":{"customerId":"A2Q8GQKLT884AQ","devices":[{"deviceSerialNumber":"G2A0WK048432057N","deviceTypeId":"A18O6U1UQFJ0XK"}]}},"type":"AlexaAnnouncement"}}","status":"ENABLED"}

Player info returns "null" for all features for one device ?

Bit weird issue, but making a Player info request works just fine for all other devices but for some reason my only Echo Dot Gen3 is returning all "null"
It's online, and I can do anything I want with it, except the get player info part....
Set volume, speak, play music etc... all works - any ideas ?

Alexa-Remote: Sending Request with {"host":"pitangui.amazon.com","path":"/api/np/player?deviceSerialNumber=G090...&deviceType=A32DOYMUN6DTXA&screenWidth=1392&_=","method":"GET","timeout":10000,"headers":{}}
Alexa-Remote: Response: {"playerInfo":{"hint":null,"infoText":null,"isPlayingInLemur":false,"lemurVolume":null,"lyrics":null,"mainArt":null,"mediaId":null,"miniArt":null,"miniInfoText":null,"playbackSource":null,"playingInLemurId":null,"progress":null,"provider":null,"quality":null,"queueId":null,"state":null,"template":null,"transport":null,"upNextItems":null,"volume":null}}

WS-MQTT fail to initialize

Alexa-Remote WS-MQTT: Open: htt ps://dp-gw-na-js.amazon.com/?x-amz-device-type=ALEGCNGL9K0HM&x-amz-device-serial=undefined-timeserial

Alexa-Remote WS-MQTT: Initialization Msg 1 sent
Alexa-Remote WS-MQTT: Initialization Msg 2+3 sent
Initialization not done within 30s
Alexa-Remote WS-MQTT: Close: 1005
Alexa-Remote WS-MQTT: Retry Connection in NaNs

Any chance it might have to do with the cookie handling in alexa-wsmqtt.js since it seems to be looking for a cookie from Amazon.de ? if (cookie) serialArr = cookie.match(/ubid-acbde=([^;]+);/);
where's mine is from the .com, i.e. ubid-main=....

announcement & ssml

announcement & ssml can both be called without "devices" to send them to ALL devices. Do you see a chance to remove the "devices"-property in seqNode.operationPayload.target if i.e. "ALL" is given as "device"?

get Music providers and Play Music like Voice command

GET: headers.put("Routines-Version", "1.1.201102");
"GET",
alexaServer + "/api/behaviors/entities?skillId=amzn1.ask.1p.music"

PLAY as command: use sequence command with Alexa.Music.PlaySearchPhrase and the provider

{
                "@type": "com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode",
                "type": "Alexa.Music.PlaySearchPhrase",
                "operationPayload": {
                    "deviceType": "A3S5BH2HU6VAYF",
                    "sanitizedSearchPhrase": "mike oldfield",
                    "searchPhrase": "Mike Oldfield",
                    "customerId": "A3NSX4MMJVG96V",
                    "locale": "de-DE",
                    "musicProviderId": "CLOUDPLAYER",
                    "deviceSerialNumber": "G090LF09643202VS"
                },
                "name": null
            }

cookie refresh, mqtt and other....

Hi,

Found this archive while looking for a cookie refresh solution while sending commands to alexa. Will your code, once it has a working cookie, auto refresh it automatically - forever?

When I have the example program configured with useWsMqtt=true, I get the following log messages which look like something is wrong.... (no messages if false) [In ether case I can send commands to Alexa with a modified example.js program]

Alexa-Remote WS-MQTT: Initialization Msg 1 sent
Alexa-Remote WS-MQTT: Initialization Msg 2+3 sent
Alexa-Remote WS-MQTT: Initialization not done within 30s
Alexa-Remote WS-MQTT: Close: 1005:
Alexa-Remote WS-MQTT: Retry Connection in NaNs
Alexa-Remote WS-MQTT: Open https://dp-gw-na-js.amazon.com/?x-amz-device-type=ALGCNCL9K0HM&x-amz-device-serial=undefined-1556940942909
[repeat]

lastly, cookieRefreshInterval: 7 * 24 * 60 * 1000 is in the example code AND in the source code for the library. Should this not be 7 * 24 * 60 * 60 * 1000? (7 days in milliseconds)...

Thanks,
-Stan

How to send voice message

I see on alexa app have send voice to alexa.
Can u tell me how to do it ?
Im from Viet Nam, alexa dont have Vietnames. Like to google tts then send it to alexa.

thank you

"Error while checking Authentication: Error: no JSON"

Hello all,

anybody facing issues with login initialisation? Till yesterday everything was working fine but suddenly i had to reinitialise my account. With cookies it was not working so i tried the other 2 options but i'm having same issues.

I think amazon has changed something in logging in or is it just me having problems?

Thanks in advance, Michael

How to use in a Raspberry

Hello,
how can I use Alexa-remote to command line send TTS in a Raspberry environment?

Can anyone please help?

Thanks,
Dan

play TuneIn Radio

Hi
i´m trying play a Tunein radio. Could you provide a example on how to do this.
Thanks

Voice recognition

Hello,

is it possible to get the detected voice with the Alexa return ? (if available).

I've created two voice profiles and I didn't find any clue about a detected voice in the returned JSON. Perhaps you have an idea ?

Thanks :)

Allow to query available notification sounds

GET https://alexa.amazon.de/api/notification/sounds?deviceSerialNumber=XXXXXXX&deviceType=A3S5BH2HU6VAYF&softwareVersion=611498620&_=1532329020829

{"notificationSounds":[{"displayName":"Grand Tour: Season 2","folder":"FOLDER_CELEBRITY","id":"system_alerts_grand_tour_2","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_grand_tour_2.mp3"},{"displayName":"Grand Tour","folder":"FOLDER_CELEBRITY","id":"system_alerts_grand_tour","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_grand_tour.mp3"},{"displayName":"Adrift","folder":null,"id":"system_alerts_soothing_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_soothing_01.mp3"},{"displayName":"Clangy","folder":null,"id":"system_alerts_atonal_02","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_atonal_02.mp3"},{"displayName":"Clarity","folder":null,"id":"system_alerts_melodic_05","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_05.mp3"},{"displayName":"Countertop","folder":null,"id":"system_alerts_repetitive_04","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_repetitive_04.mp3"},{"displayName":"Focus","folder":null,"id":"system_alerts_melodic_03","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_03.mp3"},{"displayName":"Glimmer","folder":null,"id":"system_alerts_melodic_06","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_06.mp3"},{"displayName":"Nightstand","folder":null,"id":"system_alerts_repetitive_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_repetitive_01.mp3"},{"displayName":"Nimble","folder":null,"id":"system_alerts_melodic_07","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_07.mp3"},{"displayName":"Orcas","folder":null,"id":"system_alerts_soothing_05","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_soothing_05.mp3"},{"displayName":"Porchlight","folder":null,"id":"system_alerts_atonal_03","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_atonal_03.mp3"},{"displayName":"Pulsar","folder":null,"id":"system_alerts_rhythmic_02","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_rhythmic_02.mp3"},{"displayName":"Rainier","folder":null,"id":"system_alerts_musical_02","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_musical_02.mp3"},{"displayName":"Simple Alarm","folder":null,"id":"system_alerts_melodic_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3"},{"displayName":"Simple Timer","folder":null,"id":"system_alerts_melodic_02","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_02.mp3"},{"displayName":"Squared Waves","folder":null,"id":"system_alerts_alarming_03","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_alarming_03.mp3"}]}

Enable Alexa Guard away mode

Hello, is there way to set alexa guard to away or home mode?
I don't want to have to say "Alexa I'm leaving" each time someone leaves the house, I'd like to use this module to manage it.

Thanks

Add retrieving Playlists

(alexaServer + "/api/cloudplayer/playlists?deviceSerialNumber=" + device.serialNumber + "&deviceType=" + device.deviceType + "&mediaOwnerCustomerId=" + device.deviceOwnerCustomerId)

Problems using login credentials

I would like my script to automatically login using the login credentials provided in the script.

This is my log

Alexa-Remote: Use as Login-Amazon-URL: amazon.de
Alexa-Remote: Use as Base-URL: layla.amazon.de
Alexa-Remote: No cookie given, generate one
Alexa-Cookie: Use as Login-Amazon-URL: amazon.de
Alexa-Cookie: Use as User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
Alexa-Cookie: Use as Accept-Language: en-US,en;q=0.9,de;q=0.8
Alexa-Cookie: Proxy mode disabled
Alexa-Cookie: Step 1: get first cookie and authentication redirect
Alexa-Cookie: Sending Request with {"host":"alexa.amazon.de","path":"","method":"GET","headers":{"DNT":"1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36","Accept-Language":"en-US,en;q=0.9,de;q=0.8","Connection":"keep-alive","Accept":"*/*"}}
Alexa-Cookie: Response (302) - Redirect to https://www.amazon.de/ap/signin?showRmrMe=1&openid.return_to=https%3A%2F%2Falexa.amazon.de%2F&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=amzn_dp_project_dee_de&openid.mode=checkid_setup&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&
Alexa-Cookie: Sending Request with {"host":"www.amazon.de","path":"/ap/signin?showRmrMe=1&openid.return_to=https%3A%2F%2Falexa.amazon.de%2F&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=amzn_dp_project_dee_de&openid.mode=checkid_setup&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&","method":"GET","headers":{"DNT":"1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36","Accept-Language":"en-US,en;q=0.9,de;q=0.8","Connection":"keep-alive","Accept":"*/*","Cookie":""},"body":""}
Alexa-Cookie: Response (200)
Alexa-Cookie: Add Cookie session-id = 257-6882699-5178908
Alexa-Cookie: Add Cookie session-id-time = 2208727619l
Alexa-Cookie: Step 2: login empty to generate session
Alexa-Cookie: Sending Request with {"host":"www.amazon.de","path":"/ap/signin","method":"POST","headers":{"DNT":"1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36","Accept-Language":"en-US,en;q=0.9,de;q=0.8","Connection":"keep-alive","Content-Type":"application/x-www-form-urlencoded","Referer":"https://www.amazon.de/ap/signin?showRmrMe=1&openid.return_to=https%3A%2F%2Falexa.amazon.de%2F&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=amzn_dp_project_dee_de&openid.mode=checkid_setup&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&","Cookie":"session-id=257-6882699-5178908; session-id-time=2208727619l","Accept":"*/*"},"gzip":true,"body":""}
Alexa-Cookie: Response (404)
Alexa-Cookie: Add Cookie ubid-acbde = 257-2645367-6834169
Alexa-Cookie: Step 3: login with filled form, referer contains session id
Alexa-Cookie: Sending Request with {"host":"www.amazon.de","path":"/ap/signin","method":"POST","headers":{"DNT":"1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36","Accept-Language":"en-US,en;q=0.9,de;q=0.8","Connection":"keep-alive","Content-Type":"application/x-www-form-urlencoded","Referer":"https://www.amazon.de/ap/signin/257-6882699-5178908","Cookie":"session-id=257-6882699-5178908; session-id-time=2208727619l; ubid-acbde=257-2645367-6834169","Accept":"*/*"},"gzip":true,"body":"email=MYMAIL%2Bdev%40gmail.com&password=PASSWORD"}
Alexa-Cookie: Response (404)
Alexa-Remote: Error from retrieving cookies
Error: Login unsuccessfull. Please check credentials.
    at request (/opt/alexa-timer-on-lametric-time/node_modules/alexa-cookie2/alexa-cookie.js:351:50)
    at IncomingMessage.res.on (/opt/alexa-timer-on-lametric-time/node_modules/alexa-cookie2/alexa-cookie.js:111:33)
    at IncomingMessage.emit (events.js:198:15)
    at endReadableNT (_stream_readable.js:1139:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)```

Connection: close

Hello,

from time to time, i receive a Connection: close from Amazon :

HTTP/1.1 0 x-amzn-RequestId: a33eaaaa-aaaa-aaaa-aaaa-8fdfdaaaab9e
Access-Control-Allow-Origin: https://alexa.amazon.fr
Vary: Origin
Access-Control-Expose-Headers: x-amzn-dat-gui-client-upgrade,X-Amzn-Error,loginUrl,X-Amzn-RequestId,x-amzn-alt-domain,Date,Location
Access-Control-Allow-Credentials: true
Date: Mon, 01 Apr 2019 15:41:37 GMT
Connection: close

of course the ret = JSON.parse(body); fail with that error : Response: No/Invalid JSON
(the exception is of course Unexpected token H in JSON at position 0)

do you know when that occurs ? and the solution ?

Thank you in advance

Cookie generation

Is there any way using access token instead of cookie? Or do I generate cookie from process of taking access token?

Control smart home devices and groups using SequenceCommands OR direct commands like API

{
                    "@type": "com.amazon.alexa.behaviors.model.SerialNode",
                    "name": null,
                    "nodesToExecute": [{
                        "@type": "com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode",
                        "type": "turnOn",
                        "operationPayload": {
                            "customerId": "XXXXXX",
                            "operationId": "turnOn",
                            "target": "e1813447-0a52-455b-b53f-ccd978d2f074"
                        },
                        "name": null
                    }, {
                        "@type": "com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode",
                        "type": "setPercentage",
                        "operationPayload": {
                            "percentage": 50,
                            "customerId": "XXXXXX",
                            "operationId": "setPercentage",
                            "target": "e1813447-0a52-455b-b53f-ccd978d2f074"
                        },
                        "name": null
                    }]
                }, {
                    "@type": "com.amazon.alexa.behaviors.model.SerialNode",
                    "name": null,
                    "nodesToExecute": [{
                        "@type": "com.amazon.alexa.behaviors.model.OpaquePayloadOperationNode",
                        "type": "turnOn",
                        "operationPayload": {
                            "customerId": "XXXXXX",
                            "operationId": "turnOn",
                            "target": "9f2abbc9-f639-4caf-8f45-3d6e4ee97038"
                        },
                        "name": null
                    }]
                }

Check/Add Task/Shopping-Lists

GET https://alexa.amazon.de/api/todos?startTime=&endTime=&completed=&type=TASK&size=100&offset=-1&_=1532329020785
{"values":[{"cardId":null,"complete":false,"createdDate":1492332736639,"customerId":"YYYYYYYYYY","deleted":false,"itemId":"YYYYYYYYYY#50733e27-763c-34c6-9134-e21a8c3f51a6","lastLocalUpdatedDate":null,"lastUpdatedDate":1492332736639,"nbestItems":null,"originalAudioId":null,"reminderTime":null,"text":"portal schneiden","type":"TASK","version":1}]}
GET https://alexa.amazon.de/api/todos?startTime=&endTime=&completed=&type=SHOPPING_ITEM&size=100&offset=-1&_=1532329020786
{"values":[{"cardId":null,"complete":false,"createdDate":1530366776413,"customerId":"YYYYYYYYYY","deleted":false,"itemId":"YYYYYYYYYY#c86b339b-1a90-4363-a68c-6c065110bbbf","lastLocalUpdatedDate":null,"lastUpdatedDate":1530366776413,"nbestItems":null,"originalAudioId":null,"reminderTime":null,"text":"alleine","type":"SHOPPING_ITEM","version":1}]}

Create:

POST https://alexa.amazon.de/api/todos
complete	false
createdDate	1532331960725
deleted	false
itemId	null
lastLocalUpdatedDate	null
lastUpdatedDate	null
nbestItems	null
reminderTime	null
text	neuer Eintrag Einkauf
type	SHOPPING_ITEM
utteranceId	null
version	null
--> {"cardId":null,"complete":false,"createdDate":1532331960787,"customerId":"YYYYYYYYYY","deleted":false,"itemId":"YYYYYYYYYY#e5b94122-12be-4cf4-b8f0-31e3a408d0c5","lastLocalUpdatedDate":null,"lastUpdatedDate":1532331960787,"nbestItems":null,"originalAudioId":null,"reminderTime":null,"text":"neuer Eintrag Einkauf","type":"SHOPPING_ITEM","version":1}

Delete:

PUT https://alexa.amazon.de/api/todos/YYYYYYYYYY
cardId	null
complete	false
createdDate	1532331960787
customerId	YYYYYYYYYY
deleted	true
itemId	YYYYYYYYYY#e5b94122-12be-4cf4-b8f0-31e3a408d0c5
lastLocalUpdatedDate	1532332056183
lastUpdatedDate	1532331960787
nbestItems	null
originalAudioId	null
reminderTime	null
text	neuer Eintrag Einkauf
type	SHOPPING_ITEM
utteranceId	null
version	1

Change:

PUT https://alexa.amazon.de/api/todos/YYYYYYYYYY
cardId	null
complete	false
createdDate	1530366776413
customerId	YYYYYYYYYY
deleted	false
itemId	YYYYYYYYYY#c86b339b-1a90-4363-a68c-6c065110bbbf
lastLocalUpdatedDate	1532332105633
lastUpdatedDate	1530366776413
nbestItems	null
originalAudioId	null
reminderTime	null
text	alleine2
type	SHOPPING_ITEM
utteranceId	null
version	1
--> {"cardId":null,"complete":false,"createdDate":1530366776413,"customerId":"YYYYYYYYYY","deleted":false,"itemId":"YYYYYYYYYY#c86b339b-1a90-4363-a68c-6c065110bbbf","lastLocalUpdatedDate":null,"lastUpdatedDate":1532332105714,"nbestItems":null,"originalAudioId":null,"reminderTime":null,"text":"alleine2","type":"SHOPPING_ITEM","version":2}

Move Shopping to task

PUT https://alexa.amazon.de/api/todos/YYYYYYYYYY
cardId	null
complete	false
createdDate	1530366776413
customerId	YYYYYYYYYY
deleted	false
itemId	YYYYYYYYYY#c86b339b-1a90-4363-a68c-6c065110bbbf
lastLocalUpdatedDate	1532332150395
lastUpdatedDate	1532332105714
nbestItems	null
originalAudioId	null
reminderTime	null
text	alleine2
type	TASK
utteranceId	null
version	2
--> {"cardId":null,"complete":false,"createdDate":1530366776413,"customerId":"YYYYYYYYYY","deleted":false,"itemId":"YYYYYYYYYY#c86b339b-1a90-4363-a68c-6c065110bbbf","lastLocalUpdatedDate":null,"lastUpdatedDate":1532332150454,"nbestItems":null,"originalAudioId":null,"reminderTime":null,"text":"alleine2","type":"TASK","version":3}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.