V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Cybozu0
V2EX  ›  推广

看板应用 teambition 和其他企业系统的整合

  •  
  •   Cybozu0 · 2020-08-14 10:23:35 +08:00 · 1186 次点击
    这是一个创建于 1344 天前的主题,其中的信息可能已经有所发展或是发生改变。

    概要

    看板应用 teambition 企业 OA 系统 kintone

    我们希望能把自己企业 OA 系统(kintone)中的任务直接发布到外包企业的项目管理系统(teambition)上。

    效果图

    关键代码

            function genAppAccessToken(param) {
                const periodical = 3600;
                const iat = Math.floor(Date.now() / (1000 * periodical)) * periodical;
                const oHeader = {
                    alg: 'HS256',
                    typ: 'JWT'
                };
                const oPayload = {
                    iat:iat,
                    exp: iat + Math.floor(1.1 * periodical),
                    _appId: param.appId,
                };
                return KJUR.jws.JWS.sign('HS256', oHeader, oPayload, { utf8: param.appSecret });
            }
    
            function createTask(param) {
                const data = {
                    'operatorId': param.uid,
                    'projectId': param.projectId,
                    'templateId': param.templateId,
                    'content': param.content,
                    'priority': param.priority,
                    'visible': param.visible            }
                const options = ['tasklistId', 'taskgroupId', 'executorId', 'statusId', 'startDate', 'dueDate', 'note', 'parentTaskId', 'participants', 'customfields'];
                for (let i = 0; i < options.length; i++) {
                    param[options[i]] && (data[options[i]] = param[options[i]]);
                }
                return kintone.proxy('https://open.teambition.com/api/task/create', 'POST', {
                    'Content-Type': 'application/json',
                    'Authorization': 'Bearer ' + param.appAccessToken,
                    'X-Tenant-Id': param.orgId,
                    'X-Tenant-Type': 'organization'
                }, data);
            }
    

    具体实现请参考: 通过 kintone 发布 teambition 任务

    更多文章和演示:Kintone demo 环境

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1175 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 23:50 · PVG 07:50 · LAX 16:50 · JFK 19:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.