Get Country Flag from a phone number

Hi,
I’d like a function or module that can get me the corresponding flag from a phone number.

Input:
a phone number (text). full number with country code, not just a country code on its own.

Desired output:
the corresponding country flag for this phone number (as emoji text)

EXAMPLE:

INPUT: “+33123456789”

OUTPUT: “:fr:

Any idea how to do this ?

Thanks for the help.

I use the Phone Number module to extract and normalize the country codes from well-structured phone number data (in my case, I send and receive via Openphone, Calendly, and use Hubspot ph# acquisitions).

Then, create a switch statement or lookup table to translate the country codes to your known country identifiers. See also:

Best.

2 Likes

One way to do what @mixelpix says is to use a data store which contains one column with the country code and another with the flag’s Unicode.

This discussion shows you how you could do that:

L

2 Likes

Thank you to @mixelpix and @L_Duperval for the help!

I’ll explore that route. Cheers

This API might also be helpful:
https://emoji-api.com/#documentation

2 Likes

thank you!

I managed to get what I needed with an Aritable lookup.
But this API could defo be helpful for other needs ! Thanks for sharing

2 Likes