Workflow : Action send HTTP - download and store PDF in return

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zkuun8
    Junior Member
    • Dec 2024
    • 20

    Workflow : Action send HTTP - download and store PDF in return

    Hello,

    I’m looking to create an automated process using the WORKFLOW extension, with the goal of retrieving a PDF by sending an HTTP request.

    Currently, the POST returns a response that I capture in WORKFLOW. However, this response is a download link for a PDF file.

    My goal is to download this PDF and then add it to my Attachment's entity.

    Unless I’m mistaken, this isn’t possible natively.

    What approach do you recommend? Hook, Custom Services action, ... ?


  • yuri
    Member
    • Mar 2014
    • 8509

    #2
    Hi,

    I'd create a custom Formula function that will download the attachment content. Your workflow action can obtain the link from the Send HTTP Request action response, write it into a formula variable. Then, your custom function will download the attachment by a given URL and create an Attachment entity. The function could return the attachment ID.

    It's just on option. Maybe there're are better approaches for you.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8509

      #3
      You can also utilize a second Send HTTP Request action that will download the file. You can use placeholders when specifying the URL. Then, using a formula script, you can create an attachment record.

      It's important to unset the variable with the file content at the end.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      • rabii
        Active Community Member
        • Jun 2016
        • 1254

        #4
        Originally posted by zkuun8
        Hello,

        I’m looking to create an automated process using the WORKFLOW extension, with the goal of retrieving a PDF by sending an HTTP request.

        Currently, the POST returns a response that I capture in WORKFLOW. However, this response is a download link for a PDF file.

        My goal is to download this PDF and then add it to my Attachment's entity.

        Unless I’m mistaken, this isn’t possible natively.

        What approach do you recommend? Hook, Custom Services action, ... ?

        Check this link below it might help, it should be similar, you just need to create a custom function which download the content and return an attachment id and you are good to go.

        Hello, please, has anyone been able to send a PDF file via the workflow? I'm unable to send my file to the external API, and there are no errors in the log file. However, I can send it using JavaScript.
        Rabii
        Web Dev

        Comment

        Working...