Search code examples
javascriptemoji

Is there a way I can get the name of an emoji from its character as a string?


I'm working in javascript (in the browser not nodejs) and I want to be able to take an emoji character (something like 🤨) and grab a description or name for it (like face with raised eyebrow). This data seems to be available in some form in Unicode's full list of emojis but I'd like to know if there is some kind of way to fetch this data automatically.

Thanks!


Solution

  • I've been searching for this and found Open Emoji Api. Probably it'll be helpful for your use case.

    Example usage:

    const emoji = "🤨";
    const key = "20fa1d1b04d5a670f8f7a0d1ace322c0d49f9012";
    fetch(`https://emoji-api.com/emojis?search=${emoji}&access_key=${key}`)
      .then(e => e.json())
      .then(e => {
        console.log(emoji, e[0].unicodeName);
      })

    Working API keys
    If you don't want to give out your own email, I used a temp one to create these keys:

    • 20fa1d1b04d5a670f8f7a0d1ace322c0d49f9012
    • ec07ff80043b910ad20772b199f7bf256815e17a
    • 934d90059eef84fdd74bf104380b56837025f187
    • 0c180627af50c8ab3fef62731790c9ea4a407d5f