跳转至

消息场景示例

发送钉钉文本消息

H3.Notification.UserMessageType.DingTalkPlainText

List <H3.Notification.UserMessage> _messageList=new List<H3.Notification.UserMessage>();
string title = "欢迎词";//标题
string welcomeWords = "hello,氚云!\n很荣幸加入你";//发送内容
string send =   H3.Organization.User.SystemUserId;//发起人
string receiverid =   this.Request.UserContext.UserId;//接收人
H3.Notification.UserMessage   _message = new  H3.Notification.UserMessage(
    H3.Notification.UserMessageType.DingTalkPlainText,   
    send, receiverid, 
    "", 
    title, 
    welcomeWords, 
    "");
_messageList.Add(_message);
if(_messageList.Count > 0)
{
    this.Request.Engine.Notifier.Send(_messageList.ToArray());//执行发送
}

发送邮件

H3.Notification.UserMessageType.Email

List < H3.Notification.UserMessage > _messageList = new List<H3.Notification.UserMessage>();
string title = "欢迎词";//标题
string sendContent = "hello,氚云!\n很荣幸加入你";//发送内容
string emailAddress = "jian23523@163.com";//邮箱地址
H3.Notification.UserMessage   _message = new H3.Notification.UserMessage(
    H3.Notification.UserMessageType.Email, 
    "", 
    "",
    emailAddress, 
    title,
    sendContent,
    "");
_messageList.Add(_message);
if(_messageList.Count > 0)
{
    this.Request.Engine.Notifier.Send(_messageList.ToArray());//执行发送
}

发送短信

List < H3.Notification.UserMessage > _messageList=new List<H3.Notification.UserMessage>();
string sendContent = "hello,氚云欢迎你的加入!";//发送内容
H3.Notification.UserMessage _message = new H3.Notification.UserMessage(
    this.Request.UserContext.UserId, 
    new string[] { "接收的手机号" }, 
    sendContent);
_messageList.Add(_message);
if(_messageList.Count > 0)
{
    this.Request.Engine.Notifier.Send(_messageList.ToArray());//执行发送
}

发送企业微信消息

H3.Notification.UserMessageType.WeChat

List <H3.Notification.UserMessage> _messageList=new List<H3.Notification.UserMessage>();
string title = "欢迎词";//标题
string welcomeWords = "hello,氚云欢迎你的加入!";//发送内容
string send = H3.Organization.User.SystemUserId;//发起人
string receiverid =   this.Request.UserContext.UserId;//接收人
H3.Notification.UserMessage _message = new H3.Notification.UserMessage(
    H3.Notification.UserMessageType.WeChat,   
    send, 
    receiverid, 
    "", 
    title, 
    welcomeWords, 
    "");
_messageList.Add(_message);
if(_messageList.Count > 0)
{
    this.Request.Engine.Notifier.Send(_messageList.ToArray());//执行发送
}

发送飞书消息

H3.Notification.UserMessageType.FeiShu

List <H3.Notification.UserMessage> _messageList=new List<H3.Notification.UserMessage>();
string title = "欢迎词";//标题
string sendContent = "hello,氚云欢迎你的加入!";//发送内容
string send = H3.Organization.User.SystemUserId;//发起人
string receiverid =   this.Request.UserContext.UserId;//接收人
H3.Notification.UserMessage _message = new H3.Notification.UserMessage(
    H3.Notification.UserMessageType.FeiShu,   
    send, 
    receiverid, 
    "", 
    title, 
    sendContent, 
    "");
_messageList.Add(_message);
if(_messageList.Count > 0)
{
    this.Request.Engine.Notifier.Send(_messageList.ToArray());//执行发送
}

发送流程结束消息

流程结束消息数据模型:H3.Notification.InstanceFinishedNotification

H3.Notification.InstanceFinishedNotification finishedNotification = new H3.Notification.InstanceFinishedNotification(
                        this.Request.UserContext.UserId,
                        this.Request.UserContext.UserId,
                        "流程结束通知测试",
                        "流程结束通知测试摘要",
                        "D0001837dc8288927204832ba440f7cf0542687",
                        "2ea0b9cc-55d8-4b9d-983a-503f787bac94",
                        "4b165903-8e11-4d68-993f-993d6d7391a6",
                        true);
  this.Engine.Notifier.Notify(finishedNotification);

发送催办消息

调用催办接口,以下是操作示例。

this.Engine.WorkItemManager.Urge(this.Request.UserContext.UserId, //谁发起催办
                                 "72a38719-8a92-42d3-a878-0c5690ca64df", //对哪个流程实例发起催办
                                 "催办测试内容" //催办的内容
                                );

发送消息提醒

TaskTypeH3.Task.TaskType.Reminder时,会在消息中的提醒事项里面添加一条提醒事项,同时会发送一条接入平台的消息,比如:当前企业是钉钉集成的,会发送一条钉钉消息。其他类型则只会发送消息不会添加提醒事项。

H3.Task.UserTask task = new H3.Task.UserTask();
string appId = "D000024corporateCulture";   //应用编码
task.AppCode = appId;//应用编码
task.SchemaCode = "D000024chuangjian"; //表单编码
task.ObjectId = Guid.NewGuid().ToString();//Guid码
task.Sender = H3.Organization.User.SystemUserId;//任务的发起人id
task.UserId = this.Request.UserContext.UserId; //任务的接收人id
task.TaskType = H3.Task.TaskType.Reminder; //任务类型为提醒
task.TargetType = H3.LinkTargetType.BizObject; //关联类型
task.TargetId = this.Request.BizObjectId; //关联业务对象的ID
task.TargetName = this.Request.BizObject.Name;  //关联业务对象的数据标题
task.Name = "您的客户跟进日期快要到了,请尽快跟进!"; //提醒标题
task.Summary = "您的客户跟进日期快要到了,请尽快跟进!"; //提醒的内容
task.AlertTime = DateTime.Now;  // 提醒时间
task.ReminderType = H3.Task.ReminderType.Once; //提醒类型,这里只提醒一次
task.StartTime = DateTime.Now; //开始时间
task.EndTime = DateTime.Now;   //截止时间
task.TaskState = H3.Task.TaskState.Unfinished; //任务状态
task.AlertState = H3.Task.AlertState.Waiting; //提醒的状态
this.Request.Engine.TaskManager.AddTask(task);//添加任务