I found that we can read gmail messages from a terminal window by using

curl
curl -u user --silent "https://mail.google.com/mail/feed/atom"

I would now like to submit some text (from a textarea + button press) from terminal. So what are the steps to identify the action triggered when a button is pressed and how to simulate the same actions in terminal ?