Create an automation for WhatsApp's chat app?

Ok, I've figured it out myself. Putting it out here if anyone needed it in the future.

 on run {input, parameters}
        set text1 to the clipboard
        if first character of text1 is "0" then
            set text2 to 1 - text1 as integer
            do shell script "open https://api.whatsapp.com/send?phone=" & "994" & 1 - text2
            return
        end if
        do shell script "open https://api.whatsapp.com/send?phone=" & text1
        return input
 end run