In this article you will learn the different ways how to send files from Mapsly to HubSpot. Depending on the level of access of your users, you can do the following types of uploads:

- If your users have access to HubSpot files:

  • Upload to HubSpot Files (no attachment to a record)

- If your users do not have access to HubSpot files or you want them to access files directly from the record page:

  • Save the File URL as a property

  • Attach a Timeline event with the File URL in it

  • Create a Note/Meeting/Task with the File as an attachment in it

This article will consist of 4 steps needed to send a file to HubSpot:

  1. Create a new private app and obtain Access Token

  2. Add a file field to your form

  3. Configure Invoke URL action

  4. Optionally, save attachments directly to records (contacts/companies/deals)

1- Create a new private app and obtain Access Token

In your HubSpot account, click the settings icon in the main navigation bar > In the left sidebar menu, navigate to Integrations > Private Apps > Click Create private app.

You will see a window like this:

Fill in the Name of the app and select the "files" scope. Then, click "Create app":

You will see a window with your access token. Save it, since it will be needed for future steps:

2- Add a file field to your form:

In our case we will select "Image" as the allowed file type:

3- Configure Invoke URL action

Now we will configure the Invoke URL action that will send your Mapsly files back to HubSpot. In this example we will cover the case with having just one file.

Go to Actions > click on + > choose Invoke URL

In the Invoke URL fill in the following:

  • Action Name

  • Method: POST

  • Content Type: POST MULTIPART FORM

  • Target URL: https://api.hubapi.com/filemanager/api/v3/files/upload

  • Header parameter: Authorization with the value Bearer Your_Access_Token, where you need to replace Your_Access_Token with the token that you generated earlier

  • Form parameter: options with the value

{"access": "PUBLIC_INDEXABLE", "ttl": "P3M", "overwrite":"False",  "duplicateValidationStrategy": "NONE",
"duplicateValidationScope": "ENTIRE_PORTAL"}

Note! If you don't want anyone without permissions to HubSpot files to be able to open these links you need to set the access property to "PRIVATE".

  • Form parameter: file with the path to your file field in Mapsly
    {{ GetFileContent("#{form.fields.file.value[0]}") }}

  • Form parameter: folderId with the ID of your folder where you want to save files to.
    To find your folderId simply go to that folder and then copy the folderId from the URL:

    Note, that folderId is not required and you can save files to your root folder.

    Your final Invoke URL action should look like this:

After submitting the form your file will be uploaded to HubSpot and you will find it in the Files section:

4- Saving files as attachments to records

Once the file is submitted to HubSpot, you can access the file URL by using this code:

{{ lastAction.response.s3_url }}

The File URL can be saved as a property:

You can also save it inside the Timeline event by modifying the Invoke URL action like this:

and the activity will look like this:

Finally, you can save your file as an attachment linked to a Meeting, Task or a Note. When creating one of those records, for example a Note, you can specify the "Attached file IDs" property in the Create record action and add this value:

[{{ lastAction.response.objects[0].id }}]

After submitting the form you will see the note with an attachment like this:

If you have any questions or need help with configuring your HubSpot automation contact Mapsly support team 24/7 by chat or email at [email protected], we'll be happy to help.

Did this answer your question?