APIs & Integrations

KSingh42
Member

How to auto-populate country of residence field based on Phone number

SOLVE

I currently have a form that requires users to enter their phone number and other details. Once the form is submitted a contact gets created on Hubspot with the details from the form. A lot of times Contacts are also created Manually or through some other means. 

My question is I have a 'Country of Residence' field for each contact. How can this be auto populated by using a contact's phone number ?Is there a way to automate this by looking at the country code? 

0 Upvotes
1 Accepted solution
Teun
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to auto-populate country of residence field based on Phone number

SOLVE

Hi @KSingh42 ,

 

If you have Operations Hub, this can be done through a coded action where you create a simple script that maps the country code of a number to the country. If you do not have Operations Hub, you could create a small NodeJS app that listens to a Private App webhook using the same script that you would use in a coded action. 

 

An alternative approach is creating a front-end script that listens to changes to the phone number field in your form and stores the country in a hidden field in your form.

This would require a custom mapping and probably the usage of a library like: https://www.npmjs.com/package/libphonenumber-js

 

But yes, there are quite a few ways you can achieve this.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


View solution in original post

0 Upvotes
4 Replies 4
fmischel
Member

How to auto-populate country of residence field based on Phone number

SOLVE

I was able to accomplish this using Make.com and OpenAI. I did a bulk load with 20k contacts and then activated a watch scenaario that monitored all new clients and will add their country as they are added if they have a phone number.

 

0 Upvotes
KSingh42
Member

How to auto-populate country of residence field based on Phone number

SOLVE

@Teun I'm not quite familiar with the coded action part and I'm also not well versed with coding in general. Can you help me out with how the script is going to be and what code to put? 

0 Upvotes
Teun
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to auto-populate country of residence field based on Phone number

SOLVE

Hi @KSingh42 ,

 

I would advise to search for a freelance HubSpot developer who can code this for you. This might require a bit of testing and debugging, so it's not like I can give you a ready-to-use script.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
Teun
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

How to auto-populate country of residence field based on Phone number

SOLVE

Hi @KSingh42 ,

 

If you have Operations Hub, this can be done through a coded action where you create a simple script that maps the country code of a number to the country. If you do not have Operations Hub, you could create a small NodeJS app that listens to a Private App webhook using the same script that you would use in a coded action. 

 

An alternative approach is creating a front-end script that listens to changes to the phone number field in your form and stores the country in a hidden field in your form.

This would require a custom mapping and probably the usage of a library like: https://www.npmjs.com/package/libphonenumber-js

 

But yes, there are quite a few ways you can achieve this.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes