How to Retrieve External Data in a Worksheet
When integrating with external systems, you may need to actively retrieve data from an external API rather than simply receive data pushed by those systems.
Example Use Case
When a customer's phone number is entered in a Contacts worksheet, you can send the number to the Mobile Number Lookup API to retrieve its location information, then write the returned province and city to the corresponding field in the worksheet.
How to Set It Up
-
Create a workflow triggered by worksheet events.
Configure the workflow to trigger when a phone number is added or updated in the Phone Number field.
-
Add a Send API Request node.

-
Select Send Custom Request as the request type.
-
Select GET as the request method.
-
Enter the following API URL:
http://apis.juhe.cn/mobile/get?key=4c80e35a4220b955a2932a38e6511e9e&phone= -
Click Test API. If the request succeeds, the API response data will be returned.
-
-
Remove the country code from the phone number.
Phone numbers in HAP are stored with the
+86country code, which is not supported by this API. You need to remove the country code before sending the request.Add a Code Block node before the Send API Request node and configure it as follows:

Enter the following code in the Code Block node to remove the first three characters (
+86) from the phone number and return the result:output = {output: input.phone.slice(3)}; -
Write the retrieved location information to the worksheet.
Add an Update Record node to write the returned location information to the corresponding field in the worksheet.
You can combine the province and city values into a single field value.

-
Publish the workflow.
-
Test the workflow.
Update the Phone Number field in an existing worksheet record to verify that the workflow runs and retrieves the location information correctly.
Was this document helpful?