Handle messages from the browser extension