Reactjs React native向特定whatsapp号码发送消息
我试图从一个本地应用程序向WhatsApp联系人发送一条短信,我发现我可以通过链接来实现Reactjs React native向特定whatsapp号码发送消息,reactjs,react-native,whatsapp,Reactjs,React Native,Whatsapp,我试图从一个本地应用程序向WhatsApp联系人发送一条短信,我发现我可以通过链接来实现 Linking.openURL('whatsapp://send?text=hello'); 上面的代码只会打开whats应用程序,我需要打开一个特定号码的聊天室,有没有参数我必须发送类似文本 您可以使用此功能向特定号码发送消息: Linking.openURL('whatsapp://send?text=hello&phone=xxxxxxxxxxxxx)您可以使用此方法将whatsApp消息直接发送到
Linking.openURL('whatsapp://send?text=hello');
上面的代码只会打开whats应用程序,我需要打开一个特定号码的聊天室,有没有参数我必须发送类似文本 您可以使用此功能向特定号码发送消息:
Linking.openURL('whatsapp://send?text=hello&phone=xxxxxxxxxxxxx)
您可以使用此方法将whatsApp消息直接发送到某个号码
示例链接:
将消息共享到whatsapp,共享到独立于平台的特定预定义号码
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');
}
}
请注意:如果在android中打开,请在手机前面发送+并注明国家/地区whatsapp://send?abid=(ID)&text=hellothis仅打开屏幕共享,并要求我选择要与之共享邮件的帐户!我需要打开一个与特定用户的直接聊天,你也可以显示我的abid格式吗?嗨,linkedIn呢!我对linkedIn Profile也一样如何发送图片和文本如何发送到WhatsApp businessHi,如何在facebook、twitter、pinterest等其他社交媒体上共享特定文本或数据,google plus等@Shaileshpragapati我认为相同的链接可以在手机上打开可用的链接,或者选择一个(如果两者都可用)API url可以是这样:
https://api.whatsapp.com/send?phone=+31612345678
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');
}
}