Class YCloudMessageService

java.lang.Object
com.bytedesk.social.whatsapp.ycloud.YCloudMessageService

@Service public class YCloudMessageService extends Object
WhatsApp Webhook服务 https://docs.ycloud.com/reference/whatsapp_message-send-directly
  • Field Details

    • objectMapper

      private final com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • restTemplate

      private final org.springframework.web.client.RestTemplate restTemplate
    • SEND_MESSAGE_URL

      private static final String SEND_MESSAGE_URL
      See Also:
    • ENQUEUE_MESSAGE_URL

      private static final String ENQUEUE_MESSAGE_URL
      See Also:
    • messageSendService

      private final IMessageSendService messageSendService
    • threadRestService

      private final ThreadRestService threadRestService
    • visitorRestService

      private final VisitorRestService visitorRestService
    • springAIServiceRegistry

      private final SpringAIServiceRegistry springAIServiceRegistry
    • uidUtils

      private final UidUtils 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

      public YCloudBaseMessage processMessages(String rawPayload)
      处理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

      public void handleWhatsappMessageUpdated(YCloudWhatsappMessageUpdated event)
      处理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 - 图片URL
      caption - 图片说明(可选)
      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 - 图片URL
      caption - 图片说明(可选)
      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 - 图片URL
      caption - 图片说明(可选)
      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 - 图片URL
      caption - 图片说明(可选)
      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 - 图片URL
      caption - 图片说明(可选)
      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 - 视频URL
      caption - 视频说明(可选)
      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 - 视频URL
      caption - 视频说明(可选)
      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 - 视频URL
      caption - 视频说明(可选)
      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 - 视频URL
      caption - 视频说明(可选)
      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 - 视频URL
      caption - 视频说明(可选)
      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 - 音频URL
      caption - 音频说明(可选)
      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 - 音频URL
      caption - 音频说明(可选)
      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 - 音频URL
      caption - 音频说明(可选)
      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 - 音频URL
      caption - 音频说明(可选)
      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 - 音频URL
      caption - 音频说明(可选)
      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 - 文档URL
      caption - 文档说明(可选)
      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 - 文档URL
      caption - 文档说明(可选)
      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 - 文档URL
      caption - 文档说明(可选)
      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 - 文档URL
      caption - 文档说明(可选)
      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 - 文档URL
      caption - 文档说明(可选)
      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 - 贴纸URL
      caption - 贴纸说明(可选)
      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 - 贴纸URL
      caption - 贴纸说明(可选)
      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 - 贴纸URL
      caption - 贴纸说明(可选)
      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 - 贴纸URL
      caption - 贴纸说明(可选)
      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 - 贴纸URL
      caption - 贴纸说明(可选)
      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 - 要回复的消息ID
      emoji - 表情符号
      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 - 要回复的消息ID
      emoji - 表情符号
      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 - 要回复的消息ID
      emoji - 表情符号
      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 - 消息ID
      apiKey - API密钥
      Returns:
      消息详情