Skip to content
csharp
//文字消息
string txt = "欢迎关注我们";
TextMessageRequest txtMessageRequest = new TextMessageRequest(token, openId, txt);
await wechat.SendAsync(txtMessageRequest);

//图片消息
ImageMessageRequest imageMsgRequest = new ImageMessageRequest(token, openId, "your img mediaId");
var res=await wechat.SendAsync(imageMsgRequest);
var s= await res.Content.ReadAsStringAsync();

登录微信公众号 配置消息推送服务器url
消息服务器url填写 http://yousite/wxmp, 具体查看RsCode.WeChat配置

处理收到的客服会话消息

自定义类 YourMessageManager,继承SessionMessageManager,重写方法

csharp
public override async Task ProcessSessionAsync(SessionEvent sessionEvent)
{
    var openId = sessionEvent.FromUserName;
    //你的逻辑 
}

注册服务

csharp
services.AddTransient<ISendWeCahtMsgIntegrationHandler, YourMessageManager>();