About automations with PDF attachment

Hello everyone,

I’m currently failing on something pretty easy to solve I think.

I’d like to create an automation that will send an email when a record matches certains conditions. I also want this email to contain an attachment that is always the same (PDF file), that is not in my airtable.

I cannot find any easy solution. Does someone have one ?

Thank you

Franck

I am pretty sure you cant send something from Airtable that is not in Airtable itself.
Cant you just add attachment field to the base with the required PDF? That would be easy solution to your problem i guess
There might be some more complicated solutions involving scripting or possible some other workarounds, but I will leave that to member of this forum who are more experienced with coding.

Thanks for your help. I am trying your idea but it is still quite complicated.

Here I am :

  1. When a client complete a Typeform, a new record is created (thanks to Zapier) in my table “order”
  2. I want this client to receive a mail where he will find an attachment (PDF file), this file is not the same from each client (only 3 different files are possible)
  3. I have created another table that is linked to “order” which allows me to import this PDF file in the record each time a client complete a Typeform.
  4. With automation, when a new record is created, I want my client to receive a mail that contains a PDF file. But, it is impossible to attach something that is coming from another table. So I made a Formula that is just linked to the previous field that is linked to another record. With this technic I am allowed to created an automation with this formula thanks to the fact that is not a “look up” field. But, because it is a “formula” and not an “attachment” field, it contains something like this :
    Fiche laboratoire.pdf (https://dl.airtable.com/.attachments/e3141cf156890f153493502e50c781b7/f17f2feb/Fichelaboratoire.pdf)

and not the file himself…

Do you have any idea about how to solve this ?

Thanks a lot !

Franck

There are at least two things wrong with this statement:

  1. This process doesn’t actually import anything into the record. Instead, it is either being attached (in which case it creates a new attachment link) OR the attachment link from the source table where it was originally attached is being copied. In either case, the file itself (a binary image in this case) does not exist in the record. File attachments in Airtable records are by reference (i.e., links); not by value (i.e., actual files).

  2. As you point out, copying file references from one table into another upon creation of a new record achieves nothing except, it makes a new attachment (by reference) which ultimately makes a copy of the original file in your Airtable account, a process that – over time – will erode the storage quota of your Airtable account needlessly.

Ergo, this is an attachment “by reference”, not “by value”.

This is the prime directive of your requirements - an email with [one of] the designated attached files. Before discussing the best approach to achieve this requirement, let’s understand how Gmail works with links and actual attachments.

  • Despite the recommendation to import the three documents into Airtable, it leaves you with only a URL to work with and this fails the prime directive.

  • Document URLs placed into Gmail do not automatically cause the referenced file to be “attached” by value. They just become links in the email body.

  • There is one – and only one – exception to the second bullet point; if the URL points to a Google Drive document that exists within the same gmail account used to create the email automation, said document will be linked (by reference) and also attached (by value).

One Approach

  • Store your three PDF documents in Google Drive; expose them as accessible to “Anyone with the link…”.

  • Determine the direct URLs to each of the three documents such that they can be directly downloaded.

  • Modify your action process to chose which of the three Google Drive documents should be included in the email and embed such directly downloadable URLs into the email message.

  • Ensure that the Gmail account authenticated for the action process uses the same Google account where the three documents are stored.

Emails dispatched with this configuration should include both the link to the document and the document attached to the email message. Note, it is possible to conceal the long Google Drive URL in the message by using a little HTML so that your messages are prettier - this will not impact the ability of Gmail to perform the attachment.

2 Likes

Thank you so much this is the perfect solution, you made it way more clear for me.

Best

Franck

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.