UUencoded data from Gmail

Hello, I am having some issues extracting .txt data from an email through my Gmail account. Instead of the .txt attachment data being the actual data I need, it is encoded into weird letters and symbols when it is autoforwarded to my Make Mailhook. Photos attached.

I used some online de-coders to try to figure out what code it is, and it is called “UUEncode” which is not base64, what Make.com has a decoder for built in already (I believe). Is there any way of getting around this so I can actually extract the data I need?

This is a snippet of my mailhook/scenario set up

This is what the attachment is supposed to look like (an invoice file)

And this is what I get (gibberish)

I have never encountered such a file before, by any chance could you upload an example copy of the file here so we can try to explore what can be done?

Let me know if there are any further questions or issues.

@samliew

Hi Sam, thanks for the response. Yes, I think it is really odd. Here is an example of the .txt file I get, with sensitive information redacted.

Redacted-Check-Number.txt (2.3 KB)

What is weird is that when I manually forward the email with the .txt attachment to the Make Mailhook, the .txt file is completely fine. I only have this issue when I use the Gmail Autoforwarding to the mailhook or when I use the “Watch Email” Module on Make.
It just sucks because everything else in my scenario works except the first step.

Thanks for the sample data.

I have good news, I’ve figured out a way to convert the UUEncoded text back to a normal text variable. The other news is that we’ll have to use custom JavaScript code to do it.

I highly recommend using the free CustomJS integration for this to save on operations.

Screenshot_2024-08-09_220841

You’ll need a minimum of one “Execute Inline JavaScript Code” module:
Screenshot_20240822_181632

Example Input/Output

Module Export - quick import into your scenario

You can copy and paste this module export into your scenario. This will import the modules (with fields/settings/filters) shown in my screenshots above.

  1. Move your mouse over the line of code below. Copy the JSON by clicking the copy button on the right of the code, which looks like this:

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.

  3. Click on each imported module and re-save it for validation. There may be some errors prompting you to remap some variables and connections.

JSON module export — paste this directly in your scenario

{"subflows":[{"flow":[{"id":237,"module":"custom-js:inlineexecutev2","version":1,"parameters":{"__IMTCONN__":2457341,"jscode":"function decode($){var e=!1,n=0,r=0,x=0,F=new Buffer($),o=F.length,t=new Buffer(o);do if(n<o){var i=F[n]-32&63;if(++n,i>45)throw\"Invalid Data\";for(i<45&&(e=!0),x+=i;i>0;)decodeChars(F,n,t,r),r+=3,n+=4,i-=3;++n}else e=!0;while(!e);return t.slice(0,x).toString()}function decodeChars($,e,n,r){var x=$[e],F=$[e+1],o=$[e+2],t=$[e+3];n[r]=255&((x-32&63)<<2|(F-32&63)>>4),n[r+1]=255&((F-32&63)<<4|(o-32&63)>>2),n[r+2]=255&((o-32&63)<<6|t-32&63)}\nreturn decode(input);","returnValueType":"text"},"mapper":{"input":"{{234.output}}"},"metadata":{"designer":{"x":616,"y":-2664,"name":"UUDecode"},"parameters":[{"name":"__IMTCONN__","type":"account:custom-js2","label":"Connection","required":true},{"name":"jscode","type":"text","label":"JavaScript Code","required":true},{"name":"returnValueType","type":"select","label":"Return Type","required":true,"validate":{"enum":["text","collection","array","binary"]}}]}}]}],"metadata":{"version":1}}

Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?

Hope this helps! Let me know if there are any further questions or issues.
Note: I see hundreds of posts, notifications, and messages daily on this forum, so if I missed your reply, please message me to look at your reply.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

How to set-up a FREE Custom JS connection?

  1. Go to the app’s website and click “Create Account”.

  2. Once logged in, on the right-hand side, click on the “Show” link. Copy the API key.

  3. Click “Create a connection” in the Custom JS module:

  4. Paste API key and click Save:

How to use the Custom JS module?

  1. Map a variable (or a JSON object) into the “Input” field.

  2. Write a function to do something with the input variable. If the input is a JSON, you can reference object properties using dot notation.

  3. Write a final statement to return the call of the function you wrote.

Further Information

If you need help with using Custom JS modules, please create a new thread. This helps keep the forum organized and helps me get to your question faster.

You can also take a look at the official documentation here for more advanced usage:

1 Like

thank you so much for responding! i have been swamped with other things for work but i am replying because i don’t want this subject to automatically close when i get back to it on monday :sweat_smile: this looks very promising and i will get back to this

Don’t worry, I think it auto closes after a month. Also if it auto closes you can always flag the post for a moderator to help reopen the thread.

Okay so I tried it and I think I am a little confused on how to implement the code you gave under " Module Export - quick import into your scenario" and “How to use the Custom JS module?”. I copied and pasted the code you put in the first one but just exchanged the {{234.output}} with my own variable. I am sorry, I am not super familiar with JS, just some python. The output I get is literally the code I put into the module :sweat_smile:

How does your scenario look like now?

My input (the code you gave me to copy-paste, I just spaced it out so I could attempt to read it a little easier):

My output:

Basically my scenario is trying to take a .txt attachment from an email and convert it into a PDF so I can send it to Docparser to parse checks and invoices automatically (while it has an option to parse as a txt file, it is not nearly as flexible as a pdf so that is why I go through this whole process of turning it into a pdf). I upload the txt file and download it again to get the data and then use the convert a file option in the Upload to Gmail Module.

Noo, you don’t paste the module import into your module fields.

Please read the provided instructions carefully. You paste it directly in your scenario editor canvas, and it pastes entire modules (just like how clone works).

Do this and then map your connection and input variable only.

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

OH Okay, sorry I understand what you meant now. I didn’t know that was how you can clone modules. I copied and pasted the JSON module export and changed the input to my data but now I am getting just “r” as the output instead of the actual output out the txt file like yours.

Again, thank you so much for your responses and patience with me :pray:

I don’t think I can help any further unless I have access to a sample of that encoded file…