I’m new to Zapier and I am trying to build a solution for the following challenge:
When a new Email arrives in a Gmail inbox, a task should be created in awork.io (a work management software). Everything works fine with mails without attachments, but when it comes to attachments, they are not accepted by the action provided by awork.io, so I need another solution.
Trigger: New Gmail email
- if email has attachments, upload them as single files (not as zip) to a cloud drive (Google Drive, Dropbox, whatever) and remember the file URL that can be used to access the files without a login (public share URL needed)
- attach URLs of attachment files to the Gmail Body field or a new variable that combines Body field and URLs
- Action: create new task in awork with Taskname = Gmail subject and Description = Gmail Body field (this part works) or the new variable
Path B (if no attachments):
- Action: create new task in awork with Taskname = Gmail subject and Description = Gmail Body field (this part works)
Instead of Gmail I could also use another email service (e.g. Zapier’s own service). Same for the cloud storage. All I want is to upload the attachments (if there are attachments) and add the URLs to a text field.
Are there any ideas how to build this as a zap?
Thanks a lot,
Best answer by Tobias Hagenau // awork
great that you’re trying out our Zapier integration. The tricky part is uploading single files to Drive instead of a zip. Let’s do the basic flow with a single zip-file first, though, to cover the basics.
Trigger: Gmail → New email
The trigger is pretty straight forward. To include a path or a filter based on there being attachments or not, use the field “attachment_count”. If it’s zero, no attachment ;-)
Action: Google Drive → Upload file
Use the “all_attachments” field from the email to add all attachments as a single zip file to drive.
Action: awork → Create new project task
Add whatever info you’d like from the email to the new task (e.g. subject, body text etc.) and of course include the “alternateLink” field from the Upload step to link to the file.
If a link to a zip-file isn’t what you want, you’ll have to get a bit more creative. The issue with using Gmail’s new attachment trigger (as suggested by Troy) is, that you don’t want to create several tasks in awork and we do not yet support task searches with Zapier. You can’t easily check if a task has been created already. So what you could do is use the above flow but instead of uploading a file, create a folder in Drive.
You could then store that folders Id using Zapier-Storage (use the email’s Id as a key) and create an awork task with the link to that folder.
Now you can use the New attachment trigger to retrieve the folder from storage and upload the single attachments to it.
Possible issue: You’d have to make sure that the New email zap runs before the attachment zap (otherwise the folder won’t exist, yet). To make reasonably sure that’s the case, put a delay (say 30s) as a first action into the new attachment zap.
Finally i’d recommend creating a task view in awork that automatically shows all newly created tasks from this zap. That way you could also show it as an “inbox” on your awork dashboard. To simplify this even further and work across projects, you could label you Zapier-created tasks with a tag (e.g. “created from zap”) and use that to build your task view.
Hope this points you in the right direction! Let me know if I can help with any of this.