WhatsApp-Link in Kirby

Hello there, I came along to build a “Click to Chat” Link for WhatsApp via Panel, so I collect the Phone Number and the desired prefilled message via Panel.

Then I try to build a Whatsapplink as followed:

<?php
  $number = $site->whatsapp_number()
  $text = rawurlencode($site->whatsapp_text())
?>

<a href="https://wa.me/<?= $number ?>?text=<?= $text  ?>"> LINKTEXT </a> 

The
rawurlencode()
is necessary, because the format is required.
Everything seems fine. When I now add a Emoji to that text, it is shown as emoji in var_dump, when I set the variable as “alt=” the emoji is shown in the alt-tag.

But when I click on the Link (even the link preview in the lower left corner the emoji is shown!) The emoji becomes an ugly square with a question mark.

Does anyone know how I can fix this?

Thanks a lot and much love.

Well, actually I found the answer myself and I want to share it with you:

This seems to be just the wrong URL. When I use:

<a href="https://api.whatsapp.com/send?phone=<?= $site->whatsapp_number()?>&text=<?= rawurlencode($site->whatsapp_text()) ?>"> LINK TEXT </a>

Everything works fine.