云开发客服对话,发送小程序卡片自动回复图片延迟?
发布于 5 年前 作者 jie00 6172 次浏览 来自 问答

通过<button>进入客服对话页面,发送小程序卡片给客服,自动回复一张图片,发送成功后,要退出聊天窗口才能收到图片,这是为社么啊?

<button class="btn_like btn_join" open-type="contact" show-message-card="true" send-message-title="加入粉丝群" send-message-img="/images/default_img.png" send-message-path="/pages/lordHome/lordHome"
        bindcontact="handleContact">
      <text>加入社群</text>
    </button>

js

handleContact: function (e) {
    console.log(e)
    console.log(this.data.flockInfo.mediaId)
    wx.cloud.callFunction({
      name: 'serviceMsg',
      data: {
        content: 'qrCode',
        mediaId: this.data.flockInfo.mediaId
      }
    }).then(res => {
      console.log("客服消息下发成功:", res)
    }).catch(err => {
      console.error(err)
    })
  },


云函数

function sendFlockQRcode() {
    try {
      cloud.openapi.customerServiceMessage.setTyping({
        touser: wxContext.OPENID,
        command: 'Typing'
      })

      cloud.openapi.customerServiceMessage.send({
        touser: wxContext.OPENID,
        msgtype: 'image',
        image: {
          mediaId: event.mediaId
        }
      })

      cloud.openapi.customerServiceMessage.setTyping({
        touser: wxContext.OPENID,
        command: 'CancelTyping'
      })
    } catch (error) {
      console.log(error)
      return error
    }
  }

1 回复

说明自动回复并不自动啊

回到顶部