chile-kit
ES Support

WhatsApp links

Build a wa.me chat link from any phone format, with an optional prefilled message. Returns null when there are no digits, so you render no button instead of a broken one.

import { buildWaLink } from "chile-kit/wa";

buildWaLink("+56 9 1234 5678");                // "https://wa.me/56912345678"
buildWaLink("912345678", "Hola, ¿sigue disponible?");
// "https://wa.me/56912345678?text=Hola%2C%20%C2%BFsigue%20disponible%3F"
buildWaLink("12345678");                       // "https://wa.me/56912345678" (legacy 8 digits)
buildWaLink("+54 11 1234 5678");               // "https://wa.me/541112345678"
buildWaLink("sin número");                     // null