Store attachements from Gmail to Drive and send them to a chat

Hey community, experts, pros, all! :wink:

Need some help:

Background: I am currently building an automation that is being implemented in our kindergarten. The kindergarten administration sends out newsletters to all parents with 2-5 file attachments (PDFs, image files, Office documents).

Recently, we introduced Mattermost as a messaging tool to streamline communication and make it more direct. Thus, I have expanded my workflow to ensure that whenever the kindergarten administration sends an email to the parent distribution list (which forwards emails to all invited parents), the message along with attachments should also be posted in a specific Mattermost channel.

Challenge: The main challenge I am facing is that the number of attachments varies, and I am using Google Drive as an intermediate storage solution to provide the files as links. However, I am struggling with retrieving the email attachments (plural) and sending all the files to the Mattermost chat. Currently, I can only send links, and even then only one link at a time. My goal is to forward all attachments from the email.

Current Workflow: The intended workflow is as follows:

  1. Email & Attachments Retrieval:
  • Gmail retrieves incoming emails with the label ā€œKiga.ā€
  • Using a loop, I instruct the automation to save all attachments (with filenames) to Google Drive with the ā€œGoogle Drive Uploadā€ piece.
  • Unfortunately, this approach only works for the first attachment; additional attachments are ignored, and instead, the first attachment is duplicated multiple times on Drive.
  1. Sending to Mattermost:
  • After uploading, I attempt to individually retrieve the files via the ā€œDriveā€ Get Files action, so I can then send them along with the email body text to the Mattermost channel using the ā€œSend to Mattermostā€ piece.

Can anyone explain me how to collect multiple files at once (I thought a loop is perfect for itā€¦) and how send to a mattermost (or any other chat) multiple files. I just thought Drive ā€œRead fileā€ in a loop piece would work, but not for me).

As alternative I will also happy to get a kind of template about similar workflow.

many thanks in advance!
Simon

@ashrafsam Maybe this usecase would something for your new planned AI Feature ?