Most notify-send popups are one-way: the script talks, you nod. With the --action option the popup can ask a question and the script gets the answer, which is a small thing that makes shell scripts feel oddly capable.
choice=$(notify-send -A later="Remind me later" -A done="Done" "Backup finished")
echo "You chose: $choice"
The man page’s syntax is -A, --action=[NAME=]Text, and you can repeat it. The text is the label on the button. The NAME is what notify-send writes to standard output when you click that button. If you leave out the NAME, you get the number of the button instead, counting from 1.
notify-send -A "Open log" -A "Ignore" "Backup failed"
Here the output is 1 or 2. A script can then run a command depending on the answer:
case "$choice" in
later) sleep 600; notify-send "Backup" "Reminder: check it" ;;
done) : ;;
esac
--action implies --wait, so the command does not return until the notification is closed. If you also set an expire time with -t, the man page says that time is used as the maximum waiting time. That makes the command block, so don’t put it in the middle of a script that must carry on. Run it in the background with & or in its own script.
The man page does not say which notification daemons show action buttons, so the popup may simply appear without them on some desktops. This example follows the libnotify 0.8.1 man page and was not run on a desktop session here.
Further reading: notify-send man page