How to get Gmail Attachment using JavaScript before send via GET request

Currently I am working on Chrome extension I want particular email (i.e message_id=1543c2a6347d984c) attachment data. I got email message_id also get attachment file name (i.e abc.zip) but how to get that attachment and send back to my server using Ajax.

Your message_id is a string, then you call getAttachments method and pass it as second parameter, in getAttachments, you call message.payload.parts, which means you want to get a property payload from a string, of course it is undefined.