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

查看:33
本文介绍了以编程方式向特定联系人发送文本(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-developer没有实现这种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天全站免登陆