Skip to main content
Solved

Attach docs to email


felipe-ignacio-arenas

Hi Everyone!

I was wondering if it’s possible to attach a document uploaded on one of my cards in my pipe as an email template?

I know that you can use the Dynamic Field to get the link to the document, but what I really need is the document attached to the email, not the link to the file.

I don’t know much about integrations, so maybe there’s something in that area that could help me.

 

Thank you all!

Best answer by lucas_lee

Hi Felipe!

With the new HTTP Automation you should be able to do that by making a few requests to Pipefy’s API

Requirements: Basic Pipefy API knowledge (https://developers.pipefy.com/docs)

HTTP Automation Knowledge (

https://help.pipefy.com/en/articles/8392669-how-to-create-integrations-with-http-requests)

 

Please note that this automation works for ONLY ONE FILE ATTACHED PER FIELD! If you want to attach multiple files into the email, it will be required to have multiple fields (one per file)

Without Further ado, here are the 3 automations you have to setup:

  1. GET CARD’S INFORMATION
    Since you’ll be using an HTTP automtion, there are a few specific information regarding the card that should be retrieved from the API before creating the email:
    - The card’s email address
    - the attachment field URL path
    Those are values that you will not find on dynamic fields for automation
    The automation will look somewhat like that:

    For the “Request Body”, here’s the query you will be sending:
     

    {
    "query": "query Card {card(id: %ID%) {fields{array_value, name}, creatorEmail, emailMessagingAddress}}"
    }

    %ID% = Card ID
    Now the JSON Schema is a little bit more complex… You will need to make an example API call to have the exact response to be used as model.. It should look something like this, although unique to your pipe:

    {
        "data": {
            "card": {
                "fields": [
                    {
                        "array_value": null,
                        "name": "Título"
                    },
                    {
                        "array_value": [
                            "uploads/d197e5c1-2ad3-4e3d-9cdd-c694c724a0cd/Barbara_joyce_W9-Copia3.pdf"
                        ],
                        "name": "Anexo"
                    },
                    {
                        "array_value": null,
                        "name": "Subject"
                    }
                ],
                "emailMessagingAddress": "pipe304117419+zr8XbAs3@mail.pipefy.com"
            }
        }
    }

    With that, you will have the file URL, which will be in the “array_value” key
     

  2. CREATE EMAIL
    The second automation is going to compose the email via API request. Its trigger is the API response from the first request.
    This is what the automation should look like:
     

    Now, this query has way more parameters than the first one (paste this one into pipefy automation):
     

    {"query": "mutation CreateInboxEmail {    createInboxEmail(        input: {            repo_id: 304117419,            card_id: %ID%,            from: \"%cards_email%\",            to: \"%to_email%\",            subject: \"%subject%\",            html: \"%your_message%",            emailAttachments: [                {                    fileUrl:\"%array_value[0]%\",                    fileName: \"Arquivo.pdf\"                }            ]        }    ) {        inbox_email {            id        }    }}"
    }

    It is a little bit complex, but here’s a cleaner version of this query:
     

    {
    "query": "mutation CreateInboxEmail {
        createInboxEmail(
            input: {
                repo_id: %pipe_id&!
                card_id: %card_id%!
                from: %"from_email"%!
                fromName: %"from_name"%
                to: %"to_email"%!
                cc: %["cc_email"]%
                bcc: %["bcc_email"]%
                subject: "subject"
                emailAttachments: [{
                                      fileUrl: "%fileURL%,
                                      fileName: "%fileName%"
    }]
                text: "email_body"
            }
        ) {
            clientMutationId
            inbox_email{
                id
            }
        }
    }"
    }

    This query creates the email and then leaves it waiting to be sent.
    For JSON Schema, you will add exactly this:
     

    {
        "data": {
            "createInboxEmail": {
                "inbox_email": {
                    "id": "485967390"
                }
            }
        }
    }
  3. SEND THE EMAIL
    That’s the easy part, the automation looks like this:

    The query is:
     

    {
    "query": "mutation SendInboxEmail {sendInboxEmail(input: { id: %email_id%}) {success}}"
    }

    With that, you email is going to be sent, with attachments!
    Example: 
     

This is rather complex and was recently found. If you have any questions, please feel free to post them and I will try to aid you however I can 😀

 

Lucas Lee, Solutions Engineer

View original
Did this topic help you find an answer to your question?

8 replies

marcosmelo
Forum|alt.badge.img+18
  • Pipefy Legend
  • 1461 replies
  • March 20, 2024

gisele-nucci
Forum|alt.badge.img
marcosmelo wrote:

 

 

Hello @marcosmelo 

This article is about manual attachment. Do you now how can I do this automatically by automation? 


marcosmelo
Forum|alt.badge.img+18
  • Pipefy Legend
  • 1461 replies
  • March 21, 2024

Hi, @gisele-nucci , @felipe-ignacio-arenas 
I didn't find the article on this topic, but here are some prints explaining it

Open an email template

1

2 Open Html Editor

 

3 Copy code

 

4 Return to Visual Editor

 

5 Open the link tool

 

6  Insert the link and text

 

7 Delete The dinamic Field

 

8 Test

 

Ready, your file will be attached to the email, if you entered it in the attachment field


lucas_lee
Pipefy Staff
  • Solutions Engineer
  • 2 replies
  • Answer
  • March 21, 2024

Hi Felipe!

With the new HTTP Automation you should be able to do that by making a few requests to Pipefy’s API

Requirements: Basic Pipefy API knowledge (https://developers.pipefy.com/docs)

HTTP Automation Knowledge (

https://help.pipefy.com/en/articles/8392669-how-to-create-integrations-with-http-requests)

 

Please note that this automation works for ONLY ONE FILE ATTACHED PER FIELD! If you want to attach multiple files into the email, it will be required to have multiple fields (one per file)

Without Further ado, here are the 3 automations you have to setup:

  1. GET CARD’S INFORMATION
    Since you’ll be using an HTTP automtion, there are a few specific information regarding the card that should be retrieved from the API before creating the email:
    - The card’s email address
    - the attachment field URL path
    Those are values that you will not find on dynamic fields for automation
    The automation will look somewhat like that:

    For the “Request Body”, here’s the query you will be sending:
     

    {
    "query": "query Card {card(id: %ID%) {fields{array_value, name}, creatorEmail, emailMessagingAddress}}"
    }

    %ID% = Card ID
    Now the JSON Schema is a little bit more complex… You will need to make an example API call to have the exact response to be used as model.. It should look something like this, although unique to your pipe:

    {
        "data": {
            "card": {
                "fields": [
                    {
                        "array_value": null,
                        "name": "Título"
                    },
                    {
                        "array_value": [
                            "uploads/d197e5c1-2ad3-4e3d-9cdd-c694c724a0cd/Barbara_joyce_W9-Copia3.pdf"
                        ],
                        "name": "Anexo"
                    },
                    {
                        "array_value": null,
                        "name": "Subject"
                    }
                ],
                "emailMessagingAddress": "pipe304117419+zr8XbAs3@mail.pipefy.com"
            }
        }
    }

    With that, you will have the file URL, which will be in the “array_value” key
     

  2. CREATE EMAIL
    The second automation is going to compose the email via API request. Its trigger is the API response from the first request.
    This is what the automation should look like:
     

    Now, this query has way more parameters than the first one (paste this one into pipefy automation):
     

    {"query": "mutation CreateInboxEmail {    createInboxEmail(        input: {            repo_id: 304117419,            card_id: %ID%,            from: \"%cards_email%\",            to: \"%to_email%\",            subject: \"%subject%\",            html: \"%your_message%",            emailAttachments: [                {                    fileUrl:\"%array_value[0]%\",                    fileName: \"Arquivo.pdf\"                }            ]        }    ) {        inbox_email {            id        }    }}"
    }

    It is a little bit complex, but here’s a cleaner version of this query:
     

    {
    "query": "mutation CreateInboxEmail {
        createInboxEmail(
            input: {
                repo_id: %pipe_id&!
                card_id: %card_id%!
                from: %"from_email"%!
                fromName: %"from_name"%
                to: %"to_email"%!
                cc: %["cc_email"]%
                bcc: %["bcc_email"]%
                subject: "subject"
                emailAttachments: [{
                                      fileUrl: "%fileURL%,
                                      fileName: "%fileName%"
    }]
                text: "email_body"
            }
        ) {
            clientMutationId
            inbox_email{
                id
            }
        }
    }"
    }

    This query creates the email and then leaves it waiting to be sent.
    For JSON Schema, you will add exactly this:
     

    {
        "data": {
            "createInboxEmail": {
                "inbox_email": {
                    "id": "485967390"
                }
            }
        }
    }
  3. SEND THE EMAIL
    That’s the easy part, the automation looks like this:

    The query is:
     

    {
    "query": "mutation SendInboxEmail {sendInboxEmail(input: { id: %email_id%}) {success}}"
    }

    With that, you email is going to be sent, with attachments!
    Example: 
     

This is rather complex and was recently found. If you have any questions, please feel free to post them and I will try to aid you however I can 😀

 

Lucas Lee, Solutions Engineer


felipe-ignacio-arenas

Thank you all!

@lucas_lee , I think this could be the solution I’ve been searching for! unfortunately I do not have the knowledge needed to develop this action, I’ll look for help with my pipefy contact 😄


lucas_lee
Pipefy Staff
  • Solutions Engineer
  • 2 replies
  • March 21, 2024
felipe-ignacio-arenas wrote:

Thank you all!

@lucas_lee , I think this could be the solution I’ve been searching for! unfortunately I do not have the knowledge needed to develop this action, I’ll look for help with my pipefy contact 😄

Sounds good Felipe! If it helps, please tell them to come talk to me internally and I’ll make sure to address whatever questions you have!


hugosz
Forum|alt.badge.img
  • New Member
  • 1 reply
  • March 28, 2024

Hi Lucas, thank you for this solution.

But if a person is technically savy enough to do this, might as well make a microservice that gets triggered through the first HTTP call, downloads the attachments and sends an e-mail. That would “spend” one automation call instead of three and I would argue that is a more maintainable solution.

 

I have seen idea submitions as far back as 2 years ago proposing automated attachments (as in MIME attachments, not links), and this is the closest solution, although I think this is a little cumbersome. 

 

What I think all the people who requested this would like is something like an option on the dynamic file field indicating wether we would like the attachment to be added to the e-mail (MIME-style) or be sent as a link.

 

I am grateful for your solution, as it is clever and solves the problem, but I think a no-code, UI oriented solution is what we expect from Pipefy.

 

 


Lais Laudari

Thank you for your feedback @hugosz!😀

cc: @lucas_lee   and @Rodrigo Subirá 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings