以编程方式将文本发送给特定的联系人(whatsapp) [英] Send text to specific contact programmatically (whatsapp)

查看:127
本文介绍了以编程方式将文本发送给特定的联系人(whatsapp)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何将文本发送给特定的whatsapp联系人.我找到了一些代码来查看特定的联系人,但不发送数据.

I wanted to know how I can send text to a specific whatsapp contact. I found some code to view a specific contact, but not to send data.

Cursor c = getContentResolver().query(ContactsContract.Data.CONTENT_URI,
    new String[] { ContactsContract.Contacts.Data._ID }, ContactsContract.Data.DATA1 + "=?",
    new String[] { id }, null);
c.moveToFirst();
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("content://com.android.contacts/data/" + c.getString(0)));

startActivity(i);
c.close();

这对于查看whatsapp联系人很好,但是现在如何添加一些文本呢?还是Whatsapp开发人员没有实现这种api?

This works fine for viewing a whatsapp-contact, but how can I add some text now? Or didn't the Whatsapp-developer implement such kind of an api?

推荐答案

现在可以通过 WhatsApp来实现商业API .仅企业可以申请使用它. 这是直接将消息发送到电话号码而无需任何人工干预的唯一方法.

This is now possible through the WhatsApp Business API. Only businesses may apply to use it. This is the only way to directly send messages to phone numbers, without any human interaction.

发送普通消息是免费的.看来您需要在服务器上托管MySQL数据库和WhatsApp Business Client.

Sending normal messages is free. It looks like you need to host a MySQL database and the WhatsApp Business Client on your server.

这篇关于以编程方式将文本发送给特定的联系人(whatsapp)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆