This flow and the script included in this git repository supports capturing Amazon Dash button presses using the npm node-dash-button package.
This node.js script uses the node-dash-button module to monitor for Dash button presses. When a button is pressed, it sends an MQTT message that can be captured in NodeRed via the MQTT Node.
You'll need to make two changes to the dash.js script. Change the IP address for your MQTT server, the MQTT topic being sent and change the MAC address associated with your Dash button.
This is a NodeRed flow that captures the button press with an MQTT node and then runs a Function Node that toggles a global variable.
You'll want to modify the MQTT node topic to match the topic that you set in dash.js and you'll want to change the name of the variable set.