Active Collab 在使用 API 创建、关闭或重新打开任务时通知用户 [英] Active Collab notify user when create, close or reopen task using API

查看:14
本文介绍了Active Collab 在使用 API 创建、关闭或重新打开任务时通知用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Active Collab API 创建了任务,也使用 API 处理关闭任务和重新打开任务.现在,如果我创建或关闭或重新打开任务,然后想通知用户,但我不知道如何使用 Active Collab API 执行此操作.

I have created task using Active Collab API also working with close task and reopen task using API. Now if I create or close or reopen task then want to notify user but I don't know how to do this using Active Collab API.

下面是我创建任务、关闭任务和重新打开任务的代码.

Below is my code for create task, close task and reopen task.

/* 使用 API 创建任务 */

/* create task using API */

try {
    $res = API::call('projects/60/tasks/add', null, array(
    'task[name]' => $_POST['name'],
    'task[body]' => $_POST['message'],
    'task[priority]' => $priority,  
    'task[due_on]' => $date,
    'task[assignee_id]' => 21,      
    ));
    
    $GLOBALS['$mytask'] = $res['task_id'];      
    $GLOBALS['$myValue'] = $res['permalink']; 
    echo $GLOBALS['$myValue']."+=";  
    echo $GLOBALS['$mytask'];
    //echo 'Ticket Created Successfully.';  
    
    
} catch(AppException $e) {
  print $e->getMessage() . '<br><br>';
  // var_dump($e->getServerResponse()); (need more info?)
}

/*使用API​​关闭任务*/

/*close task using API */

try {
    
    $res = API::call('projects/60/tasks/200/complete', null, array(
    'submitted' => 'submitted',     
    ));
    
    echo 'Ticket Updated Successfully.';        
} catch(AppException $e) {
  print $e->getMessage() . '<br><br>';
}

/* 使用 API 重新打开任务*/

/* Reopen task using API*/

try {
    $res = API::call('projects/60/tasks/200/reopen', null, array(
    'task[body]' => $_POST['message'],
    'submitted' => 'submitted',     
    ));
    echo 'Ticket Updated Successfully.';        
} catch(AppException $e) {
  print $e->getMessage() . '<br><br>';
}

我需要的是在创建或关闭或重新打开任务时通知用户.为此,我需要在上面的代码中更改或添加什么?

What I need is to notify user when create or close or reopen task. For that what I need to change or add in above code?

而且我也想给负责这个任务的用户(分配用户)发送邮件.

And I also want to send mail to user who is responsible for this task (assign user).

推荐答案

Active Collab 4 在发送电子邮件时有自己的逻辑.创建任务时,所有受让人和订阅者都会收到通知.当您完成或重新打开任务时,系统也会通知所有订阅者.请注意,不会通知执行操作的人(通知您您所做的事情是多余的).

Active Collab 4 has its own logic when sending emails. When you create a task, all assignees and subscribers will receive a notification. When you complete or reopen a task, system will also notify all subscribers. Note that person who performs the action is not notified (it's redundant to notify you about something that you did).

话虽如此,我觉得您应该向您的 PHP 代码发送通知,而不是依赖 Active Collab 为您发送通知.这样您就可以控制行为,即使 Active Collab 发生变化(例如,版本 5 不会通知订阅者任务已完成或重新打开,您需要发表评论才能这样做).

That being said, I feel that you should and notifications to your PHP code, instead of relying on Active Collab to send notifications for you. That way you control the behavior, even when Active Collab changes (for example, version 5 does not notify subscribers that tasks are completed or reopened, you need to leave a comment to do that).

这篇关于Active Collab 在使用 API 创建、关闭或重新打开任务时通知用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆