How to send decode base64 encoded pdf data and attach the pdf in Zapier?
Context:
I want to send various files from my app to Zapier via webhook. I don’t want to use urls for files.
Currently I am passing base64 encoded data of a pdf inside the payload via webhook to Zapier.
I have written a JS code which decodes the base64 data.
I want to attach this data to "attachments" of Gmail and send a pdf as an attachment to this email.
I am not able to do this. I have attached a few images to explain better.
Issues:
Inside attachment I am writing {{code.attachment}} but it is not working.
Suppose the file object contains content, filename, content type then I am passing this object to output. But when I click on attachment I can't use this object as a whole. The keys get broken down. I can use attachment.content or attachment.filename but not attachment object as a whole.
What should I do?
Page 1 / 1
Hi! I have one last question if you could help me out here.
When I am returning an object attachment from the code and using it in Attachment field, how can I use attachment as a single key and not get separate keys for attachment filename, attachment type, attachment content?
File objects are the bundles of data that represent the actual file. This is different from the name of the file or other file attributes. For example, the actual image of an apple is the file object, while the file name might be “apple.jpg”.
Isnt file an object? So to send a pdf as an attachment in gmail inside attachment field, what output variable should I add/write from code step?
@Adrika Gupta
Your code is returning an attachment variable, which is set as the file, but the file is an object with 3 parameters.
Those correspond to these 3 output variables from the Code step, which can be mapped to following Zap action steps.
I have attached the screenshots of test action of code by zapier and also the options coming when I click on Attachment field.
@Adrika Gupta
Please provide a list of variables returned/output from the Code step, that you can select using the ‘Custom’ mapping option.
NOTE: You are returning a value named “attachment” from the Code step, not a variable named “Code Attachment”.
For context, here’s an example of a properly mapped variable from a Code step.
Notice the step # (e.g. 2.) that indicates the Step from which the variable is mapped, and the </> icon that indicates the Code step.
If you take a look at the code I am returning the object named "attachment"
Inside Attachment field I had written {{code.attachment}} yet it is not working
@Adrika Gupta
You need to remove the currently mapped variable for Code Attachment, then select the desired output variable from the Code step, that has the value you are trying to use as an attachment.
That must be a file object or a file url.
Okay, so how should I correct it?
I have attached the code image as well in the question.
Hi @Adrika Gupta
Good question.
The black icon with ! means the variable is not mapped correctly from a previous step.