TL;DR Mit Applescript auf dem Mac WhatsApp Nachrichten an Telefonnummern schicken, die nicht im Adressbuch sind.
Use Applescript on a Mac to send WhatsApp messages to recipients not stored in your contacts.
Manchmal passierts, dass ich jemandem eine Nachricht über WhatsApp schreiben wollte aber nicht extra dafür einen neuen Kontakt im Adressbuch anlegen möchte, da es wahrscheinlich nur eine oder wenige Nachrichen sind (z.B. bei Ebay Kleinanzeigen).
Die Lösung? wa.me
Hier in den FAQ von WhatsApp wird die Verwendung von wa.me beschrieben: https://faq.whatsapp.com/general/chats/how-to-use-click-to-chat?category=5245251
WhatsApp’s click to chat feature allows you to begin a chat with someone without having their phone number saved in your phone’s address book. … Use https://wa.me/<number> where the <number> is a full phone number in international format.
Dadurch kommt man auf die Seite https://api.whatsapp.com/send/?phone=<number>&text&app_absent=0 und muss nochmal auf einen Button „WEITER ZU CHAT“ drücken, damit sich WhatsApp mit der neuen Nachricht an diese Nummer öffnet.
wa.me öffnet einfach nur die URL: whatsapp://send/?phone=<number>
Geht das nicht einfacher wenn man eh schon am Mac sitzt und die WhatsApp Desktop App oder WhatsApp Web nutzt?
Ja, mit Automator und Apple Script direkt aus dem Kontexmenü!
Automator öffnen, neues Dokument mit der Art „Schnellaktion“ erstellen (siehe https://support.apple.com/de-de/guide/automator/aut7cac58839/mac)

Arbeitsablauf empfängt „Text“ in „jedem Programm“ auswählen.
Block „Apple Script ausführen“ in der Bibliothek links suchen, doppelklicken oder in das graue Feld ziehen und diesen Text rein kopieren:
on run {input, parameters}
try
-- set input data to type text, initialize variable plus
set raw_num to input as text
set plus to "0"
-- set the url that opens whatsapp to the variable
set wa_prefix to "whatsapp://send/?phone=" as text
-- if input already starts with plus, then set the variable "plus" to 1
if character 1 of raw_num is "+" then set plus to "1"
-- remove all non-digit characters from raw_input to create number, this drops all hyphens, brackets, dashes, etc. from input
set nummer to do shell script "echo " & quoted form of raw_num & " | tr -dc '[:digit:]'"
-- if input already started with plus the previous step removed it, add plus at the beginning and return output
if plus is "1" then return wa_prefix & "+" & nummer
-- if input starts with 00, remove first two digits and add plus at the beginning and return output
if text 1 thru 2 of nummer is "00" then
return wa_prefix & "+" & characters 3 thru -1 of nummer
end if
-- if input starts with 0X and X is any number, remove first digit and add +49 (german country code) at the beginning and return output
if character 1 of nummer is "0" and character 2 of nummer is not "0" then
return wa_prefix & "+49" & characters 2 thru -1 of nummer
end if
-- if any error occurs, this error message asks for the phone number, then without further checks return this number
on error
set err_num to display dialog "Fehler: Bitte Telefonummer manuell eingeben." default answer "+49XXXXX" with icon caution
return wa_prefix & (text returned of err_num)
end try
end run
Block „Webseiten anzeigen“ suchen und unter dem Apple Script Block einfügen. Das Ganze sollte dann so aussehen:

Speichern als „Whatapp“ oder irgendeinem anderen passenden Dateinamen. (Der Speicherort für Dienste ist immer /Users/BENUTZERNAME/Library/Services)
Nun finden wir systemweit bei markiertem Text im Kontextmenü unter Dienste den soeben gespeicherten Dateinamen.

Telefonnummer kopieren > Rechtsklick > Dienste > Dateiname >> WhatsApp wird geöffnet und das Nachrichtenfenster ist bereit für eine Nachricht an die markierte Nummer.
Bei einem Fehler (z.B. nur Text kopiert) erscheint ein Eingabefeld und die Nummer muss im internationalen Format manuell eingegeben werden. Falls die ausgewählte Nummer nicht bei WhatsApp registriert ist, wird angezeigt dass die über URL geteilte Nummer ungültig ist.
How to send WhatsApp messages without having the recipients number saved to your contacts:
Use wa.me or create a service on your Mac using Automator and Apple Script. See the screenshots above for details.
Open Automator, create a new service. Set input to text, add „Apple Script“ block, paste the code. Add block „Open websites“, save the service and you are ready to go.
You find the service in the context menu of marked text.
If there is an error, eg. you copied text and not a phone number you will be prompted to to enter a valid phone number in international format.
If the selected number is no WhatsApp account you get an „invalid“ notification.
NOTE: The script converts input without country code to German country code. If you wish, change the +49 to another country code.