I\'m trying to send a text message to a WhatsApp contact from a react-native apps , i found that i can do it through Linking
Linking.openURL(\'whatsapp://send?t
share message to whatsapp to a specific predefined number independent to platform
sendWhatsApp = () => {
let msg = 'type something';
let phoneWithCountryCode = 'xxxxxxxxxx';
let mobile = Platform.OS == 'ios' ? phoneWithCountryCode : '+' + phoneWithCountryCode;
if (mobile) {
if (msg) {
let url = 'whatsapp://send?text=' + msg + '&phone=' + mobile;
Linking.openURL(url).then((data) => {
console.log('WhatsApp Opened');
}).catch(() => {
alert('Make sure WhatsApp installed on your device');
});
} else {
alert('Please insert message to send');
}
} else {
alert('Please insert mobile no');
}
}
Please Note: send + in front of phone with country if opening in android