In this article you will learn how you can send files captured by Mapsly forms back to your Zoho CRM account as one of the following:
Attachments (for all default modules, including Leads, Accounts, Contacts, Events and Notes)
Record's main photo (for Leads, Contacts, Accounts, Products, Vendors, and custom modules)
Upload to Zoho File System (ZFS)
Each of these options follow the same common procedure with the difference only being in setting up the Scope and Target URL which will be described later in the article.
This guide will also contain a section on how to authenticate in order to use Zoho CRM API and will consist of the following parts:
Create a self-client and generate a code
Obtain refresh token
Set up Invoke URL action to request access token
Common procedure:
1- Add a file field to your form:
In our case we will select "Image" as the allowed file type:
β
2- Create a self-client and generate a code
First, you need to visit Zoho API Console.
There, you need to add a client (if you don't have it already) and add scope for your application. You can use the following scope:
ZohoCRM.modules.ALL
or you can grant specific scopes depending on how you want to upload your files to Zoho CRM:
For uploading files as attachments use this scope:
ZohoCRM.modules.{module_name}.ALL
(and)
ZohoCRM.modules.attachments.ALL
For uploading files to Zoho File System use this scope:
scope=ZohoCRM.Files.CREATE
For uploading files as a Record's main photo you need to use this scope:
ZohoCRM.modules.{module_name}
after that click "Create" to generate a 10-minute authorization code.
3- Obtain refresh token
Then, send a POST request to:
In the URL parameters you need to add the following parameters:
code: here you need to paste your code that we generated previously
client_id - here you need to paste your client id
client_secret - here you need to paste your client secret
grant_type: authorization_code
To send this request can use the web version of Postman (requires log in) or you can use this tool (no log in needed):
In the response you will find the refresh token, which we will use in the next step:
4- Configure Invoke URL action to obtain access token
Then, you need to configure an Invoke URL action that will refresh access token request which will be invoked every time when you submit a file. This request will return access token which will then be used to send this file to Zoho CRM.
To do that, simply go to Mapsly > Setup > Actions > create Invoke URL action:
Name your Invoke URL action, choose Method: POST, Content Type: JSON. Target URL has to be in the form of:
Important! Depending on your Accounts instance, you may have a different domain. To know exactly what domain you have please log in to your Zoho Accounts and check the URL in the address bar.
In the URL parameters you need to add the following parameters:
refresh_token: here you need to paste your refresh token
client_id - here you need to paste your client id
client_secret - here you need to paste your client secret
grant_type: refresh_token
Once everything is filled in, click on "Save":
4- Configure Invoke URL
Now we will configure the Invoke URL action that will send your Mapsly files back to Zoho CRM as attachments. 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:
For uploading files as attachments use this endpoint:
βhttps://www.zohoapis.com/crm/v2/contacts/{{record.id}}/Attachments
For uploading files to Zoho File System use this endpoints:
βhttps://www.zohoapis.com/crm/v2/files
For uploading files as a Record's main photo use this endpoint:
βhttps://www.zohoapis.com/crm/v2/{module_api_name}/{record_id}/photoHeader parameter: Authorization with the value: Zoho-oauthtoken {{ lastAction.response.access_token }}
Form parameter: file with the path to your file field in Mapsly
{{ GetFileContent("#{form.fields.file.value[0]}") }}
You will end up having 2 requests one after another:
After submitting a file you will see your file saved as an attachment under the contact record:
In case you submitted the file as a photo it will be update the main image of that record.
If you have any questions or need help with configuring your Zoho CRM automation contact Mapsly support team 24/7 by chat or email at [email protected], we'll be happy to help.