Class YCloudMessageService
java.lang.Object
com.bytedesk.social.whatsapp.ycloud.YCloudMessageService
WhatsApp Webhook服务
https://docs.ycloud.com/reference/whatsapp_message-send-directly
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
WhatsApp消息详情响应(用于获取消息详情)static class
WhatsApp消息响应 -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private final IMessageSendService
private final com.fasterxml.jackson.databind.ObjectMapper
private final org.springframework.web.client.RestTemplate
private static final String
private final SpringAIServiceRegistry
private final ThreadRestService
private final UidUtils
private final VisitorRestService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate VisitorRequest
buildVisitorRequest
(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, WhatsAppEntity whatsAppEntity) 根据WhatsApp消息构建访客请求对象void
echoMessage
(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, String apiKey, String sender) Echo测试功能 - 将接收到的消息原样发送回去异步发送WhatsApp音频消息enqueueAudioMessage
(String from, String to, String audioUrl, String caption, String filename, String apiKey) 异步发送WhatsApp音频消息enqueueAudioMessage
(String from, String to, String audioUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp音频消息enqueueContactsMessage
(String from, String to, com.fasterxml.jackson.databind.JsonNode contacts, String apiKey) 异步发送WhatsApp联系人消息enqueueContactsMessage
(String from, String to, com.fasterxml.jackson.databind.JsonNode contacts, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp联系人消息异步发送WhatsApp文档消息enqueueDocumentMessage
(String from, String to, String documentUrl, String caption, String filename, String apiKey) 异步发送WhatsApp文档消息enqueueDocumentMessage
(String from, String to, String documentUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp文档消息异步发送WhatsApp图片消息enqueueImageMessage
(String from, String to, String imageUrl, String caption, String filename, String apiKey) 异步发送WhatsApp图片消息enqueueImageMessage
(String from, String to, String imageUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp图片消息enqueueInteractiveButtonMessage
(String from, String to, String body, String[] buttons, String apiKey) 异步发送WhatsApp交互式按钮消息enqueueInteractiveButtonMessage
(String from, String to, String body, String[] buttons, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp交互式按钮消息enqueueLocationMessage
(String from, String to, double latitude, double longitude, String apiKey) 异步发送WhatsApp位置消息enqueueLocationMessage
(String from, String to, double latitude, double longitude, String name, String address, String apiKey) 异步发送WhatsApp位置消息enqueueLocationMessage
(String from, String to, double latitude, double longitude, String name, String address, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp位置消息异步发送WhatsApp反应消息enqueueReactionMessage
(String from, String to, String messageId, String emoji, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp反应消息异步发送WhatsApp贴纸消息enqueueStickerMessage
(String from, String to, String stickerUrl, String caption, String filename, String apiKey) 异步发送WhatsApp贴纸消息enqueueStickerMessage
(String from, String to, String stickerUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp贴纸消息enqueueTextMessage
(String from, String to, String text, String apiKey) 异步发送WhatsApp文本消息异步发送WhatsApp文本消息enqueueTextMessage
(String from, String to, String text, String apiKey, Boolean previewUrl, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp文本消息异步发送WhatsApp视频消息enqueueVideoMessage
(String from, String to, String videoUrl, String caption, String filename, String apiKey) 异步发送WhatsApp视频消息enqueueVideoMessage
(String from, String to, String videoUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp视频消息enqueueWhatsappMessage
(String messageJson, String apiKey) 异步发送WhatsApp消息(入队)enqueueWhatsappMessage
(String messageJson, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp消息(入队)getMessage
(String messageId, String apiKey) 获取WhatsApp消息详情private void
handleRobotResponse
(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, ThreadProtobuf thread, WhatsAppEntity whatsAppEntity, MessageProtobuf messageProtobuf) 处理机器人回复void
handleWhatsappInboundMessage
(YCloudWhatsappInboundReceived event, WhatsAppEntity whatsAppEntity) 处理WhatsApp入站消息void
处理WhatsApp消息状态更新processMessages
(String rawPayload) 处理webhook事件发送WhatsApp音频消息sendAudioMessage
(String from, String to, String audioUrl, String caption, String filename, String apiKey) 发送WhatsApp音频消息(向后兼容方法)sendAudioMessageInternal
(String from, String to, String audioUrl, String caption, String filename, String apiKey, String externalId) 发送音频消息(内部方法)sendContactsMessage
(String from, String to, com.fasterxml.jackson.databind.JsonNode contacts, String apiKey) 发送WhatsApp联系人消息发送WhatsApp文档消息sendDocumentMessage
(String from, String to, String documentUrl, String caption, String filename, String apiKey) 发送WhatsApp文档消息(向后兼容方法)sendDocumentMessageInternal
(String from, String to, String documentUrl, String caption, String filename, String apiKey, String externalId) 发送文档消息(内部方法)发送WhatsApp图片消息sendImageMessage
(String from, String to, String imageUrl, String caption, String filename, String apiKey) 发送WhatsApp图片消息(向后兼容方法)sendImageMessageInternal
(String from, String to, String imageUrl, String caption, String filename, String apiKey, String externalId) 发送图片消息(内部方法)发送WhatsApp交互式按钮消息(向后兼容方法)sendInteractiveButtonMessageInternal
(String from, String to, String content, String apiKey, String externalId) 发送交互式按钮消息(内部方法)sendLinkMessageInternal
(String from, String to, String linkContent, String apiKey, String externalId) 发送链接消息(内部方法)sendLocationMessage
(String from, String to, double latitude, double longitude, String apiKey) 发送WhatsApp位置消息sendLocationMessage
(String from, String to, double latitude, double longitude, String name, String address, String apiKey) 发送WhatsApp位置消息sendLocationMessageInternal
(String from, String to, String locationContent, String apiKey, String externalId) 发送位置消息(内部方法)sendMessage
(String from, String to, MessageTypeEnum messageType, String content, String caption, String filename, String apiKey, String externalId) 统一的消息发送方法发送WhatsApp反应消息发送WhatsApp贴纸消息sendStickerMessage
(String from, String to, String stickerUrl, String caption, String filename, String apiKey) 发送WhatsApp贴纸消息sendStickerMessageInternal
(String from, String to, String stickerUrl, String caption, String filename, String apiKey, String externalId) 发送贴纸消息(内部方法)sendTextMessage
(String from, String to, String text, String apiKey) 发送WhatsApp文本消息发送WhatsApp文本消息(向后兼容方法)发送文本消息(内部方法)private void
sendToCustomerService
(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, VisitorResponse visitor, ThreadProtobuf thread, WhatsAppEntity whatsAppEntity) 发送消息到客服系统发送WhatsApp视频消息sendVideoMessage
(String from, String to, String videoUrl, String caption, String filename, String apiKey) 发送WhatsApp视频消息(向后兼容方法)sendVideoMessageInternal
(String from, String to, String videoUrl, String caption, String filename, String apiKey, String externalId) 发送视频消息(内部方法)private void
sendWelcomeMessage
(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, ThreadProtobuf thread, WhatsAppEntity whatsAppEntity, String welcomeContent) 发送欢迎消息sendWhatsappMessage
(String messageJson, String apiKey) 发送WhatsApp消息sendWhatsappMessage
(String messageJson, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 发送WhatsApp消息
-
Field Details
-
objectMapper
private final com.fasterxml.jackson.databind.ObjectMapper objectMapper -
restTemplate
private final org.springframework.web.client.RestTemplate restTemplate -
SEND_MESSAGE_URL
- See Also:
-
ENQUEUE_MESSAGE_URL
- See Also:
-
messageSendService
-
threadRestService
-
visitorRestService
-
springAIServiceRegistry
-
uidUtils
-
-
Constructor Details
-
YCloudMessageService
public YCloudMessageService()
-
-
Method Details
-
sendMessage
public YCloudMessageService.WhatsappMessageResponse sendMessage(String from, String to, MessageTypeEnum messageType, String content, String caption, String filename, String apiKey, String externalId) 统一的消息发送方法- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)messageType
- 消息类型content
- 消息内容(URL、文本等)caption
- 媒体说明(可选)filename
- 文件名(可选)apiKey
- API密钥externalId
- 外部ID(可选)- Returns:
- 发送结果
-
sendTextMessageInternal
private YCloudMessageService.WhatsappMessageResponse sendTextMessageInternal(String from, String to, String text, String apiKey, String externalId) 发送文本消息(内部方法) -
sendImageMessageInternal
private YCloudMessageService.WhatsappMessageResponse sendImageMessageInternal(String from, String to, String imageUrl, String caption, String filename, String apiKey, String externalId) 发送图片消息(内部方法) -
sendVideoMessageInternal
private YCloudMessageService.WhatsappMessageResponse sendVideoMessageInternal(String from, String to, String videoUrl, String caption, String filename, String apiKey, String externalId) 发送视频消息(内部方法) -
sendAudioMessageInternal
private YCloudMessageService.WhatsappMessageResponse sendAudioMessageInternal(String from, String to, String audioUrl, String caption, String filename, String apiKey, String externalId) 发送音频消息(内部方法) -
sendDocumentMessageInternal
private YCloudMessageService.WhatsappMessageResponse sendDocumentMessageInternal(String from, String to, String documentUrl, String caption, String filename, String apiKey, String externalId) 发送文档消息(内部方法) -
sendLocationMessageInternal
private YCloudMessageService.WhatsappMessageResponse sendLocationMessageInternal(String from, String to, String locationContent, String apiKey, String externalId) 发送位置消息(内部方法) -
sendLinkMessageInternal
private YCloudMessageService.WhatsappMessageResponse sendLinkMessageInternal(String from, String to, String linkContent, String apiKey, String externalId) 发送链接消息(内部方法) -
sendInteractiveButtonMessageInternal
private YCloudMessageService.WhatsappMessageResponse sendInteractiveButtonMessageInternal(String from, String to, String content, String apiKey, String externalId) 发送交互式按钮消息(内部方法) -
sendStickerMessageInternal
private YCloudMessageService.WhatsappMessageResponse sendStickerMessageInternal(String from, String to, String stickerUrl, String caption, String filename, String apiKey, String externalId) 发送贴纸消息(内部方法) -
processMessages
处理webhook事件- Parameters:
rawPayload
- webhook原始负载- Returns:
- 处理后的事件对象
-
handleWhatsappInboundMessage
public void handleWhatsappInboundMessage(YCloudWhatsappInboundReceived event, WhatsAppEntity whatsAppEntity) 处理WhatsApp入站消息- Parameters:
event
- WhatsApp入站消息事件whatsAppEntity
- WhatsApp实体对象
-
buildVisitorRequest
private VisitorRequest buildVisitorRequest(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, WhatsAppEntity whatsAppEntity) 根据WhatsApp消息构建访客请求对象- Parameters:
inboundMessage
- WhatsApp入站消息whatsAppEntity
- WhatsApp实体对象- Returns:
- 访客请求对象
-
sendWelcomeMessage
private void sendWelcomeMessage(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, ThreadProtobuf thread, WhatsAppEntity whatsAppEntity, String welcomeContent) 发送欢迎消息 -
handleRobotResponse
private void handleRobotResponse(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, ThreadProtobuf thread, WhatsAppEntity whatsAppEntity, MessageProtobuf messageProtobuf) 处理机器人回复 -
sendToCustomerService
private void sendToCustomerService(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, VisitorResponse visitor, ThreadProtobuf thread, WhatsAppEntity whatsAppEntity) 发送消息到客服系统 -
echoMessage
public void echoMessage(YCloudWhatsappInboundReceived.WhatsappInboundMessage inboundMessage, String apiKey, String sender) Echo测试功能 - 将接收到的消息原样发送回去- Parameters:
inboundMessage
- 收到的入站消息apiKey
- API密钥sender
- 发送者电话号码
-
handleWhatsappMessageUpdated
处理WhatsApp消息状态更新- Parameters:
event
- WhatsApp消息更新事件
-
sendWhatsappMessage
public YCloudMessageService.WhatsappMessageResponse sendWhatsappMessage(String messageJson, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 发送WhatsApp消息- Parameters:
messageJson
- 消息JSON字符串apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
sendWhatsappMessage
public YCloudMessageService.WhatsappMessageResponse sendWhatsappMessage(String messageJson, String apiKey) 发送WhatsApp消息- Parameters:
messageJson
- 消息JSON字符串apiKey
- API密钥- Returns:
- 发送结果
-
enqueueWhatsappMessage
public YCloudMessageService.WhatsappMessageResponse enqueueWhatsappMessage(String messageJson, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp消息(入队)- Parameters:
messageJson
- 消息JSON字符串apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueWhatsappMessage
public YCloudMessageService.WhatsappMessageResponse enqueueWhatsappMessage(String messageJson, String apiKey) 异步发送WhatsApp消息(入队)- Parameters:
messageJson
- 消息JSON字符串apiKey
- API密钥- Returns:
- 发送结果
-
sendTextMessage
public YCloudMessageService.WhatsappMessageResponse sendTextMessage(String from, String to, String text, String apiKey, Boolean previewUrl) 发送WhatsApp文本消息(向后兼容方法)- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)text
- 文本内容apiKey
- API密钥previewUrl
- 是否显示URL预览(可选)- Returns:
- 发送结果
-
sendTextMessage
public YCloudMessageService.WhatsappMessageResponse sendTextMessage(String from, String to, String text, String apiKey) 发送WhatsApp文本消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)text
- 文本内容apiKey
- API密钥- Returns:
- 发送结果
-
enqueueTextMessage
public YCloudMessageService.WhatsappMessageResponse enqueueTextMessage(String from, String to, String text, String apiKey, Boolean previewUrl, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp文本消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)text
- 文本内容apiKey
- API密钥previewUrl
- 是否显示URL预览(可选)externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueTextMessage
public YCloudMessageService.WhatsappMessageResponse enqueueTextMessage(String from, String to, String text, String apiKey, Boolean previewUrl) 异步发送WhatsApp文本消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)text
- 文本内容apiKey
- API密钥previewUrl
- 是否显示URL预览(可选)- Returns:
- 发送结果
-
enqueueTextMessage
public YCloudMessageService.WhatsappMessageResponse enqueueTextMessage(String from, String to, String text, String apiKey) 异步发送WhatsApp文本消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)text
- 文本内容apiKey
- API密钥- Returns:
- 发送结果
-
sendImageMessage
public YCloudMessageService.WhatsappMessageResponse sendImageMessage(String from, String to, String imageUrl, String caption, String filename, String apiKey) 发送WhatsApp图片消息(向后兼容方法)- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)imageUrl
- 图片URLcaption
- 图片说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendImageMessage
public YCloudMessageService.WhatsappMessageResponse sendImageMessage(String from, String to, String imageUrl, String caption, String apiKey) 发送WhatsApp图片消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)imageUrl
- 图片URLcaption
- 图片说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueImageMessage
public YCloudMessageService.WhatsappMessageResponse enqueueImageMessage(String from, String to, String imageUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp图片消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)imageUrl
- 图片URLcaption
- 图片说明(可选)filename
- 文件名(可选)apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueImageMessage
public YCloudMessageService.WhatsappMessageResponse enqueueImageMessage(String from, String to, String imageUrl, String caption, String filename, String apiKey) 异步发送WhatsApp图片消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)imageUrl
- 图片URLcaption
- 图片说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueImageMessage
public YCloudMessageService.WhatsappMessageResponse enqueueImageMessage(String from, String to, String imageUrl, String caption, String apiKey) 异步发送WhatsApp图片消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)imageUrl
- 图片URLcaption
- 图片说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendVideoMessage
public YCloudMessageService.WhatsappMessageResponse sendVideoMessage(String from, String to, String videoUrl, String caption, String filename, String apiKey) 发送WhatsApp视频消息(向后兼容方法)- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)videoUrl
- 视频URLcaption
- 视频说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendVideoMessage
public YCloudMessageService.WhatsappMessageResponse sendVideoMessage(String from, String to, String videoUrl, String caption, String apiKey) 发送WhatsApp视频消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)videoUrl
- 视频URLcaption
- 视频说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueVideoMessage
public YCloudMessageService.WhatsappMessageResponse enqueueVideoMessage(String from, String to, String videoUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp视频消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)videoUrl
- 视频URLcaption
- 视频说明(可选)filename
- 文件名(可选)apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueVideoMessage
public YCloudMessageService.WhatsappMessageResponse enqueueVideoMessage(String from, String to, String videoUrl, String caption, String filename, String apiKey) 异步发送WhatsApp视频消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)videoUrl
- 视频URLcaption
- 视频说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueVideoMessage
public YCloudMessageService.WhatsappMessageResponse enqueueVideoMessage(String from, String to, String videoUrl, String caption, String apiKey) 异步发送WhatsApp视频消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)videoUrl
- 视频URLcaption
- 视频说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendAudioMessage
public YCloudMessageService.WhatsappMessageResponse sendAudioMessage(String from, String to, String audioUrl, String caption, String filename, String apiKey) 发送WhatsApp音频消息(向后兼容方法)- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)audioUrl
- 音频URLcaption
- 音频说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendAudioMessage
public YCloudMessageService.WhatsappMessageResponse sendAudioMessage(String from, String to, String audioUrl, String caption, String apiKey) 发送WhatsApp音频消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)audioUrl
- 音频URLcaption
- 音频说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueAudioMessage
public YCloudMessageService.WhatsappMessageResponse enqueueAudioMessage(String from, String to, String audioUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp音频消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)audioUrl
- 音频URLcaption
- 音频说明(可选)filename
- 文件名(可选)apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueAudioMessage
public YCloudMessageService.WhatsappMessageResponse enqueueAudioMessage(String from, String to, String audioUrl, String caption, String filename, String apiKey) 异步发送WhatsApp音频消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)audioUrl
- 音频URLcaption
- 音频说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueAudioMessage
public YCloudMessageService.WhatsappMessageResponse enqueueAudioMessage(String from, String to, String audioUrl, String caption, String apiKey) 异步发送WhatsApp音频消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)audioUrl
- 音频URLcaption
- 音频说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendDocumentMessage
public YCloudMessageService.WhatsappMessageResponse sendDocumentMessage(String from, String to, String documentUrl, String caption, String filename, String apiKey) 发送WhatsApp文档消息(向后兼容方法)- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)documentUrl
- 文档URLcaption
- 文档说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendDocumentMessage
public YCloudMessageService.WhatsappMessageResponse sendDocumentMessage(String from, String to, String documentUrl, String caption, String apiKey) 发送WhatsApp文档消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)documentUrl
- 文档URLcaption
- 文档说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueDocumentMessage
public YCloudMessageService.WhatsappMessageResponse enqueueDocumentMessage(String from, String to, String documentUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp文档消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)documentUrl
- 文档URLcaption
- 文档说明(可选)filename
- 文件名(可选)apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueDocumentMessage
public YCloudMessageService.WhatsappMessageResponse enqueueDocumentMessage(String from, String to, String documentUrl, String caption, String filename, String apiKey) 异步发送WhatsApp文档消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)documentUrl
- 文档URLcaption
- 文档说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueDocumentMessage
public YCloudMessageService.WhatsappMessageResponse enqueueDocumentMessage(String from, String to, String documentUrl, String caption, String apiKey) 异步发送WhatsApp文档消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)documentUrl
- 文档URLcaption
- 文档说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendStickerMessage
public YCloudMessageService.WhatsappMessageResponse sendStickerMessage(String from, String to, String stickerUrl, String caption, String filename, String apiKey) 发送WhatsApp贴纸消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)stickerUrl
- 贴纸URLcaption
- 贴纸说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendStickerMessage
public YCloudMessageService.WhatsappMessageResponse sendStickerMessage(String from, String to, String stickerUrl, String caption, String apiKey) 发送WhatsApp贴纸消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)stickerUrl
- 贴纸URLcaption
- 贴纸说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueStickerMessage
public YCloudMessageService.WhatsappMessageResponse enqueueStickerMessage(String from, String to, String stickerUrl, String caption, String filename, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp贴纸消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)stickerUrl
- 贴纸URLcaption
- 贴纸说明(可选)filename
- 文件名(可选)apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueStickerMessage
public YCloudMessageService.WhatsappMessageResponse enqueueStickerMessage(String from, String to, String stickerUrl, String caption, String filename, String apiKey) 异步发送WhatsApp贴纸消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)stickerUrl
- 贴纸URLcaption
- 贴纸说明(可选)filename
- 文件名(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueStickerMessage
public YCloudMessageService.WhatsappMessageResponse enqueueStickerMessage(String from, String to, String stickerUrl, String caption, String apiKey) 异步发送WhatsApp贴纸消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)stickerUrl
- 贴纸URLcaption
- 贴纸说明(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendLocationMessage
public YCloudMessageService.WhatsappMessageResponse sendLocationMessage(String from, String to, double latitude, double longitude, String name, String address, String apiKey) 发送WhatsApp位置消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)latitude
- 纬度longitude
- 经度name
- 位置名称(可选)address
- 地址(可选)apiKey
- API密钥- Returns:
- 发送结果
-
sendLocationMessage
public YCloudMessageService.WhatsappMessageResponse sendLocationMessage(String from, String to, double latitude, double longitude, String apiKey) 发送WhatsApp位置消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)latitude
- 纬度longitude
- 经度apiKey
- API密钥- Returns:
- 发送结果
-
enqueueLocationMessage
public YCloudMessageService.WhatsappMessageResponse enqueueLocationMessage(String from, String to, double latitude, double longitude, String name, String address, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp位置消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)latitude
- 纬度longitude
- 经度name
- 位置名称(可选)address
- 地址(可选)apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueLocationMessage
public YCloudMessageService.WhatsappMessageResponse enqueueLocationMessage(String from, String to, double latitude, double longitude, String name, String address, String apiKey) 异步发送WhatsApp位置消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)latitude
- 纬度longitude
- 经度name
- 位置名称(可选)address
- 地址(可选)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueLocationMessage
public YCloudMessageService.WhatsappMessageResponse enqueueLocationMessage(String from, String to, double latitude, double longitude, String apiKey) 异步发送WhatsApp位置消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)latitude
- 纬度longitude
- 经度apiKey
- API密钥- Returns:
- 发送结果
-
sendInteractiveButtonMessage
public YCloudMessageService.WhatsappMessageResponse sendInteractiveButtonMessage(String from, String to, String body, String[] buttons, String apiKey) 发送WhatsApp交互式按钮消息(向后兼容方法)- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)body
- 消息正文buttons
- 按钮数组(最多3个)apiKey
- API密钥- Returns:
- 发送结果
-
enqueueInteractiveButtonMessage
public YCloudMessageService.WhatsappMessageResponse enqueueInteractiveButtonMessage(String from, String to, String body, String[] buttons, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp交互式按钮消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)body
- 消息正文buttons
- 按钮数组(最多3个)apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueInteractiveButtonMessage
public YCloudMessageService.WhatsappMessageResponse enqueueInteractiveButtonMessage(String from, String to, String body, String[] buttons, String apiKey) 异步发送WhatsApp交互式按钮消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)body
- 消息正文buttons
- 按钮数组(最多3个)apiKey
- API密钥- Returns:
- 发送结果
-
sendReactionMessage
public YCloudMessageService.WhatsappMessageResponse sendReactionMessage(String from, String to, String messageId, String emoji, String apiKey) 发送WhatsApp反应消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)messageId
- 要回复的消息IDemoji
- 表情符号apiKey
- API密钥- Returns:
- 发送结果
-
enqueueReactionMessage
public YCloudMessageService.WhatsappMessageResponse enqueueReactionMessage(String from, String to, String messageId, String emoji, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp反应消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)messageId
- 要回复的消息IDemoji
- 表情符号apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueReactionMessage
public YCloudMessageService.WhatsappMessageResponse enqueueReactionMessage(String from, String to, String messageId, String emoji, String apiKey) 异步发送WhatsApp反应消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)messageId
- 要回复的消息IDemoji
- 表情符号apiKey
- API密钥- Returns:
- 发送结果
-
sendContactsMessage
public YCloudMessageService.WhatsappMessageResponse sendContactsMessage(String from, String to, com.fasterxml.jackson.databind.JsonNode contacts, String apiKey) 发送WhatsApp联系人消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)contacts
- 联系人数组apiKey
- API密钥- Returns:
- 发送结果
-
enqueueContactsMessage
public YCloudMessageService.WhatsappMessageResponse enqueueContactsMessage(String from, String to, com.fasterxml.jackson.databind.JsonNode contacts, String apiKey, String externalId, Boolean filterUnsubscribed, Boolean filterBlocked) 异步发送WhatsApp联系人消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)contacts
- 联系人数组apiKey
- API密钥externalId
- 外部ID(可选)filterUnsubscribed
- 是否过滤已退订用户(可选)filterBlocked
- 是否过滤已屏蔽用户(可选)- Returns:
- 发送结果
-
enqueueContactsMessage
public YCloudMessageService.WhatsappMessageResponse enqueueContactsMessage(String from, String to, com.fasterxml.jackson.databind.JsonNode contacts, String apiKey) 异步发送WhatsApp联系人消息- Parameters:
from
- 发送者电话号码(E.164格式)to
- 接收者电话号码(E.164格式)contacts
- 联系人数组apiKey
- API密钥- Returns:
- 发送结果
-
getMessage
public YCloudMessageService.WhatsappMessageDetailResponse getMessage(String messageId, String apiKey) 获取WhatsApp消息详情- Parameters:
messageId
- 消息IDapiKey
- API密钥- Returns:
- 消息详情
-