Pro Yearly is on sale from $80 to $50! »

kintone & Backlogハンズオン / kintone devCamp 2018 handson

3e77f9dbec6a87756d1dbdddab283aee?s=47 Nulab Inc.
August 02, 2018

kintone & Backlogハンズオン / kintone devCamp 2018 handson

2018年8月2日の「kintone devCamp 2018」にて、Backlog SREの吉澤(@muziyoshiz)が、kintoneとBacklogの連携方法をハンズオン形式で解説しました。
前半はkintoneプラグインを用いたノンプログラミングでの連携、後半はwebhookとAWS Lambdaを用いた高度なAPI連携の解説です。

kintone devCamp 2018
https://developer.cybozu.io/hc/ja/articles/360001062323-kintone-devCamp-2018

サンプルコード
https://github.com/nulab/backlog-kintone-handson

3e77f9dbec6a87756d1dbdddab283aee?s=128

Nulab Inc.

August 02, 2018
Tweet

Transcript

  1. B A P E S R I &

  2. &( 1 @ /B8  • A L F L

    • 8 @ gNm : 2:@ @ -B B::E 2- • & iNnl • r cNjds v w y zekh a t • Rcp T S F) 8 @ 8 A : • 0 A :EI:E@:FF .E A: E s • u u ! : @ lp o b WT 
  3. 0 1  • .1 21 02 8 • A

    I B  A N P
  4. .  • 82 • 82 8 1 • 82

    FI N S • PL W • .0 8 1 1 • PL N S AB 
  5.  

  6. 0   • T 8 N   

     • 8 N . 1 8 • 11 B I8 • 2 . C I8 
  7. 0  • . 8 1 • 2 . 2

    
  8.   . 1 . 1 . 1 . I

    1 0 N8 0 2 8 0
  9.    •  . . . . 0

    8 1   0 2 
  10. 0 1 2 !'%"  !'*2& +   /0

    .,&1  #$( -)+  74 $PQZSJHIU/VMBC*OD"MMSJHIUTSFTFSWFE . 1 2
  11. 0      • N8 . 1

    k B g aI • ib I • n c I8 W . 2 • a G • l G N l I 
  12.     ϝχϡʔΛΫϦοΫ ಺༰Λॻ͍ͯ ௥ՃϘλϯͰ࡞੒   

  13.   • • . 4I 8 2 • 4

    8 2 0 N 1 • 8 2  ະରԠ ॲཧத ॲཧࡁΈ ׬ྃ
  14.    •    . 02 1

     λεΫ؅ཧ • λεΫͷ؅ཧ͕Ͱ͖Δ͔ʁ • λεΫ͔ΒࣗಈతʹΨϯτ νϟʔτ͕࡞੒Ͱ͖Δ͔ʁ จॻ؅ཧ • จॻΛΦϯϥΠϯ্Ͱ࡞੒ͯ͠ ڞ༗Ͱ͖Δ͔ʁ ϑΝΠϧ؅ཧ • ϑΝΠϧΛڞ༗Ͱ͖Δ͔ʁ • 8FC%"7Λ࢖ͬͯ1$͔Β௚ ઀ϑΝΠϧʹΞΫηεͰ͖Δ ͔ʁ ιʔείʔυ؅ཧ • (JUͰιʔείʔυ͕؅ཧͰ͖Δ ͔ʁ • 4VCWFSTJPOͰιʔείʔυ͕ ؅ཧͰ͖Δ͔ʁ ϞόΠϧରԠ • ެࣜͷϞόΠϧΞϓϦ͕ఏڙ͞ Ε͍ͯΔ͔ʁ ηΩϡϦςΟ • άϩʔόϧ*1ΞυϨεʹΑΔ αʔϏε΁ͷΞΫηε੍ݶ౳ͷ ઃఆ͕Ͱ͖Δ͔ʁ • ΞΫηεϩάͷఏڙαʔϏε͕ ͋Δ͔ʁ ֦ுੑ • "1*͕ఏڙ͞Ε͍ͯΔ͔ʁ • ৘ใͷߋ৽࣌ʹ֎෦γεςϜʹ ௨஌͢Δ࢓૊Έ 8FCIPPLͳͲ ͕ఏڙ͞Ε͍ͯΔ͔ʁ • ֎෦γεςϜͳͲ͔Βϝʔϧܦ ༝ͰλεΫΛ࡞੒Ͱ͖Δ͔ʁ
  15. 0  1 2    ϓϩδΣΫτ؅ཧʹඞཁͳ ػೳ͕ू໿͞Ε͍ͯΔͷͰ ৘ใ͕෼ࢄ͠ͳ͍

    . 1 2 74
  16. 8 0 1,     • . .

    G . .21 
  17.   • 1 . . 20 . 8 

    $* *!'" *"!'" .O0<A[%)"LN6/,W\K .OP-VB  >SRGF (5? *)#CY &("* ;:3]E+ ZMJXQJ@HJ T= 9D4827 1[  ,W U .O&("*IQ  >SRGF  ཧ૝ઢ ࣮੷ઢ ܭըઢ
  18. 1 0. I NA k   • 2 W

    • i I 8 c • B I  ab l W c W I NA k
  19.  • l . N  0 • a I

    8 uc8     • n 2 . b • 1 IN • N .
  20.   • . 8. . 20 3 • 3

    . 1  ,0 ࡾҪॅ༑ۜߦ
  21.  • 8 1 . 02 

  22.     

  23. 0 1       02 •

    N • N a . . I B • Nc B N b i 8 NWge .1 21 • NU • l N • Bno 8 • k B k W
  24. 2.      • b .0 c

    i u 10 g • 10 u • 10 l • 10 u .0 tko • ne u N • 10 a .0 I B i 8 
  25.  • BI 20 : BI • N 2 .

     /:: 1 / 2 1 8 0 8: / /:
  26.     

  27. 812      • abO SO 1

    8 T U n Ne T • 1 8 • 1 8 0 2 AB Hg O RuIU T • P o • 0 2 • O c kt LOW Bh N Bl N O U T .. .A
  28.     • /:: - - -8 0

    1 2 . 
  29. C -. / • N e • .-/ :2 /:8

    - . :2 - .-/ :2 /- 1 0B • -/ :2GI NapH .iIdc -/ :2Hgo • jI m hm I - : Hlk  .I n -/ :2 Idc br
  30. -. 8/ • -8 -8ckbl • : .-/ 2 /

    - . 2 -8 -8 1-/0. : -/0 .-/ 2 • lr W me I : -/0 . -/0. ut • W N -/ 2 g  :-/0 W B s h pf -/ 2 W S an j owF
  31. . 80  • c v s N L •

    c v s . 2 bmZ F 8 2 . • uot rpu WIA • IA kud u PLW • Leni Z LW • a l NW • Sorgin LW • 8 82 kud u • , . 1. S 80 8 . . 2 02 kud u 
  32. . 1 1

  33. /E 3 .  a 2: -:a Wi 0 B

    ow s m da. e c k 1 BF B CC -B3 B C Cu : D W W bI n a j c n a bI P i WShc 3 8 l I pt W l iN ar n W W bI avn g © a j c DDAC 3 8 3 AB: : 8 21 : :CDB3D B CC W W bI lro a j c 
  34. . 0    B . ! B 2

    1 . ! ( (1 3 3 . 8 (002 I A 2 2 2 ) . 2 8 4 F 
  35. % 3E 45 2 6 • k D 8aog hn

    • 8 8 8B 8DG B N 1 9 8d • aog leij :DD -## 8 8 8B 6 5 IE #:6# 4#4BD 6 8 # 8 8 8B 8DG B 0 % . 0 0 % 0 % 0 % / D8 • p D 8bc p 
  36.     • 02 1 . 8 

  37. 1 0 • e c • . • . ab

    • e 8 2 . N I . e ab 
  38. 1 0    • . 8 2 

  39. 1 0    • 2 . 8 8

    
  40. 1 0    • . 2 8 

  41. 1 0 . • 8 • 2 3 IB 

     • 2 N 
  42. / 1    • ./2 20 :8 

  43.    • 2 8 01 . 

  44.    • 8 . 102 

  45. 1 0. • S S I • 0. DH •

    S I • b A S I b • D 8A S I c • 28A HNO a 
  46. : 2 )    • /88 7( 12

    .  a b 12 . 0 N 12 .8 2 N 12 . c I
  47. -.    • D B A • D

    B A H - 2 1 - 08   • D B A    
  48.    • 2 0. 1 

  49.    • 02 1 8 .0 

  50.    • 2. 8 10 

  51. 2.      • B e8 c

    N • eBa I 10 • BI .0  I I e g i g k b g
  52. 2.    • 10 .0 8 10 B

    N   I
  53. . 0  • 8 2 DN A .0 8

    N B a • .0 8 a N H B  ). 1 O DN O ) ( N SI  .0 8 a N H
  54. 0 81   ) 82 8H H S A

    H H ) (. O I 1 BP a 8 8 H H b 8 8 A c 1 O I d D e 8 8 BP BPHI N 8 8 BP
  55. 8 0 1 . • 1 1 .1 21-I I

     O HN H HN H
  56. 3 2 0- .  4 0.1 0 8 8

  57. . • 0 . 1 2 

  58. 1- . . • 2 8 .0 . I N

     I I N I
  59. . - .  23 018

  60. . - .  4 1 20 8 2 8

    8    
  61. D B 12 * .  ( ) ( *

    ( * i i . B 2 n e B28 n t rk ) U C g I I I d I U sy 1 B g I a Ip Ip jR Ic d I a n 1 b 0. 1 * B 0. luo luo ( 1 C P Pm NS LLP
  62. .  

  63. . - .  25 18 0 1

  64. . • 0 . 1 2 

  65. -. . • NO N I DS ABN I H

    • N I - 2 1 - 08   • N I    
  66. .  21 I 0 . 21 8

  67. 0 . • • .-0210 P A A  A

    8 NI
  68. 0 - . .  2 8 3 3 A

    I 1 3
  69. . • 0 . 1 2  

  70. 2. . • .0 b g • N u o

    elc 10 • it 8B elc a k B nI 
  71. : . • • / 8 1 1 :.0 2

    . 
  72. 0 . .  I 2 N 8 1 -

    8 2
  73. 2 1- . .  I 8 .0 .

  74. . - .  0 1 4 8 0 2

    31 4 8
  75. 2 0- . .  I 6 1 8 5

  76. . • 0 . 1 2 

  77. 2 1- . . . • .0 . 8 

  78. . - . .  8 3 02 8 3

    1 0 2
  79. 0 - . . .  8 6 6 4

    5 1 26
  80. . - . .  7 12 80

  81. . 4 . .    )4 8 S

    L 4 8 )4 8 (0 U H )4 8 (0 U )4 8 c U (. 2 . )4 8 c c U OIm DPO R b nl R b nl )4 8 a R b )4 8 1- u R b u B o gLk ALNNI O
  82. . - . .  1 I2 1 2 8

    9 0
  83. 8 3 4.  214 54 b N .2350 a

    G .2350 I I e 1 121 B .2350 W 214 54 c WGg I B 
  84.  

  85.  

  86.  

  87.  

  88. None
  89. 81 ,  • t k g p • t

    k g . 2 • ic i r n uo • AN i i l • p Zb P t • t a • m Ic b e • 0 i i • 2 
  90. A # 812 3 ( ) 0 ,1 2 1

    • G I cC,1 2 1 I a • G WPJ bC I I S • . 1 1 LN  ,1 2 1 .
  91. 2 ( ) 8 • a c A WbGa P

    I • hWb L N d e A • .  . 0 1 .
  92. 1 • I b I L N • 2 .

    8 • 0 S F 2 . 2 . N a I 
  93. .C 23 • 10 el z s • b a

    gIM S& 2 n no cl g • vy • 2G 2 2 • N 10 ia 10 - C 12 L • gs 2A C C 2A L • d af p I8 P h mrw t • pu vy • p ,2 3 2 2 2 W A AA ln rL 
  94. . & 2

  95. 2.    10 N8 .0 B B I

    B N8 34 (4 )) 33 A ! . 33 ( 3.3 ! 
  96. 1 0. • N • N • Sb aN •

    u • • SW A • D I DA 2 Nl • Sb a • SW 2 c n M AI • I D SW 82 c I D Sb SW 8 
  97. :2   • / 8 8 1 .08 -2

    
  98. 81  • I N F • . . 1.

    2. 0 A 2 . F 
  99.  • 012 8 . 0 2 

  100.  • . 2 1 01 22 A8 

  101. .     • 20 2 81 

           
  102. L 0F 5 6 4 . • 0A78 h aM

    • 28 8 8 8 A h aM • /eM MW g h d wy • h aM sWonp • 385:AA Wru mk zvW 1 P . 57 jv 0A78 t SN WS Wbc il : F IA : : 8 5 A9 6A 8 I 
  103. . / . • 3 801 8:2 S 08 1:I

    L W • N I • T 
  104. :2 . • . . a I HN H _

    • / 8 . 8/ 0 . 1 • H  $ brew install npm
  105. 80 2 • .2 • .2 NS 11 2 1

    a O O W I • 1 • W I  $ npm install –g serverless
  106. .     • • I2 0 1

    8 N  $ sls config credentials --provider aws --key ID --secret   
  107. 2.      • B e8 c

    N • eBa I 10 • BI .0  I I e g i g k b g
  108. 2.    • 10 .0 8 • .0

    10 8  B   N I
  109. 801 2 0 dB . O DH N I 

     A c gN Ia kRb 02 8 0 1 0 U h 1 0 1 0 U a l Se m 1 n o LPH
  110. . 0 . 1 IP I Wb AO IP I

    O HD L   . 1. . 1. hN S d L e k I a c m . 1. O l e n 2 88 d o 2 88 d
  111. C 01 ) 2 • abNny c PD  

       m SR • LPD Luy c UI m          d j d j 2 1 o i . 1 2 o si k ( 2 e a B e a r . 0 o i 028 g 028 ) ltp ltp 0 B
  112. 1 • 2 N 0 .. 8 I  {

    "id": "ef84c2fb-63d5-4a14-9ebf-c301fbdec1e7", "type": "ADD_RECORD", "app": { "id": "13", "name": " " }, "record": { "Status": { "type": "DROP_DOWN", "value": " " }, "RecordNumber": { "type": "RECORD_NUMBER", "value": "1" },   
  113. . - . 2 • 0 N 0 8 

    P A 1 0 2 A P 1I 82 A
  114. 2 1 - 0. . 2  I 3 4

    3A N5 4 3A 5 8 4 5
  115. . - . 2  1 2 6I 8 0

  116. A /0 1 . • . /802/ ae W I

    • : L • : RLN L d  1 0: 1:8  bc • : S • U S DDDD 1 0: 1:8   bc 
  117. 8 . . • t l • 21 oIc bU

    c g R • .2 0L Rl LN A g P • t 21 c • 21 o c a g R • euA B c i L c k n R 
  118. 8 2 .  12 10 . - B B

    O H I B N
  119. . - .  04 1 3 8 04 2

    1 3 8
  120. 8 7 -. .  U N L  

     R 21 65 0 I
  121. . • 0 . 1 2 

  122. 0 81 . • . 02 aA S D •

    OR H • W L H • L U • L 8 8 I N 
  123. . . • R PNO I . 2/. • R

    PNO U SHP 1 :EE D = A A? E0 A 8 E E A A 8 E LLLL LLLL 
  124. E 12 = . • R L • R L

    T NL0. ? & III 21 : 8 /D? 1 8 = 8 /D? 8 8 /D? ? L LU 
  125. A 01 2 . • IL DRU E • IL

    D8 N/. E • IL /. =? 1028 2 : 1A 02 0 1A 
  126. A . . • ic WC a S P ihC

    • ic WC Pu Lom g e t • sa S 01 Po • C C dSbdeLSi C • L chSPpn • Wi C h SiGI chS NLPlv • .0 • 8 1 • 8 8 0 82 
  127. -. 8/     • : 2 .

    / 8 -. .-/ 2 8 81 -80 8 • ID 81 0 8 -0 C 8 -0 
  128. 0 81   backlog-kintone-handson ├── README.md ├── serverless.yml ├──

    handler.js ├── backlog.js ├── kintone.js ├── package-lock.json ├── package.json └── conf ├── dev.yml.sample └── production.yml.sample Y NAS ej 02 & d 02 c al 82 G I LW 2 MAP b hc Y .
  129.     functions: add_issue_to_backlog: handler: handler.addIssueToBacklog events: -

    http: path: add_issue_to_backlog method: post environment: BACKLOG_SPACE: (.) ... module.exports.addIssueToBacklog = (event, context, callback) => { const backlog = new Backlog( process.env.BACKLOG_SPACE, process.env.BACKLOG_API_KEY, ( .) . A G
  130.     functions: add_issue_to_backlog: handler: handler.addIssueToBacklog events: -

    http: path: add_issue_to_backlog method: post environment: BACKLOG_SPACE: (.) ... module.exports.addIssueToBacklog = (event, context, callback) => { const backlog = new Backlog( process.env.BACKLOG_SPACE, process.env.BACKLOG_API_KEY, ( .) . . . .
  131. 8 0 1     • 388 •

    nN _ JO B l kU uI • 388 . 388 . 388 • nN _ JO BoeO 388 cg L a uI • 22. 3. .0 1 8 • 3 O 30 g l kU 1 8 Ob tw 3 Ob tw i • 2 3. 3. . 3 • 1 8 O 30 g l kU b d OR 3 O hp S _ s i 
  132. /   • 0/ . 2 .1 8 0/

    .  --- MESSAGE: Hello YEAR: "2018" BACKLOG_SPACE: YOUR_DOMAIN.backlog.com BACKLOG_API_KEY: YOUR_API_KEY BACKLOG_PROJECT_ID: "YOUR_PROJECT_ID" BACKLOG_ISSUE_TYPE_ID: "YOUR_ISSUE_TYPE_ID" KINTONE_DOMAIN: YOUR_DOMAIN KINTONE_APP_ID: "YOUR_APP_ID" KINTONE_API_TOKEN: YOUR_API_TOKEN BACKLOG_CFID_CREATED_BY: "YOUR_CUSTOM_FIELD_ID_1" BACKLOG_CFID_KINTONE_RECORD_URL: "YOUR_CUSTOM_FIELD_ID_2"    
  133.   • 201 8.  --- MESSAGE: Hello YEAR:

    "2018" BACKLOG_SPACE: YOUR_DOMAIN.backlog.com BACKLOG_API_KEY: YOUR_API_KEY BACKLOG_PROJECT_ID: "YOUR_PROJECT_ID" BACKLOG_ISSUE_TYPE_ID: "YOUR_ISSUE_TYPE_ID" KINTONE_DOMAIN: YOUR_DOMAIN KINTONE_APP_ID: "YOUR_APP_ID" KINTONE_API_TOKEN: YOUR_API_TOKEN BACKLOG_CFID_CREATED_BY: "YOUR_CUSTOM_FIELD_ID_1" BACKLOG_CFID_KINTONE_RECORD_URL: "YOUR_CUSTOM_FIELD_ID_2" 3 5 5 ik 5 I ( ik R gBc e ( ik R gB 5 PA 1/ ( ik OUB) ( ( ik fmB RO ( ik dH D nal 5 . UAO ik 23 . NA SL 23 R ARo
  134. 2- .     • I • a

    N 1 0 0- 11 - . 8  $ npm install
  135.   • 0 18 2  $ sls deploy

    $ sls deploy --profile N 1 2 . . I
  136.   • 2 0 18  $ sls deploy

    Serverless Warning -------------------------------------- A valid file to satisfy the declaration 'file(./conf/production.yml)' could not be found. Serverless: Packaging service... Serverless: Excluding development dependencies... Serverless: Creating Stack... Serverless: Checking Stack create progress... ..... Serverless: Stack create finished... Serverless: Uploading CloudFormation file to S3... Serverless: Uploading artifacts... Serverless: Uploading service .zip file to S3 (2.27 MB)... .
  137.   • 01 2 8 .  . Serverless:

    Stack update finished... Service Information service: backlog-kintone-handson stage: dev region: ap-northeast-1 stack: backlog-kintone-handson-dev api keys: None endpoints: POST - https://NNNNNNNNNN.execute-api.ap-northeast-1.amazonaws.com/dev/hello GET - https://NNNNNNNNNN.execute-api.ap-northeast-1.amazonaws.com/dev/hello_ hello_hello POST - https://NNNNNNNNNN.execute-api.ap-northeast-1.amazonaws.com/dev/add_i ssue_to_backlog POST - https://NNNNNNNNNN.execute-api.ap-northeast-1.amazonaws.com/dev/updat e_issue_on_kintone     
  138. 0 . • 8 2 41 

  139. . • 81 0, 8 2 A G C 

  140. . • 4 18 2 0 

  141. 1 0. • 8 2 A 

  142. 2. • CC 4 N 8  .02 1 4

    C I
  143. - . • 88 0 - . 1L N 

    I N 0-2
  144. . 0  N I .11-4 2- 8- .05 83L

    2 1 84 R
  145. . -  2 N 2 0 7 I6 8

    1
  146. - . . . • 0 288 0 2 0W

     N U I U RL 0-1 RL
  147. 3 2 0 . .  -11.8 8

  148. 801 2 . .  _ 0 4 6 4

    76 4 I4 6 I- L _ I W L N _ .415 7 L U _ .415 7L R LN N
  149. . . • 0 . 1 2 

  150.   B

  151.     #  "  ! 

    
  152.        

  153.     

  154.       

  155.  

  156.  

  157.  

  158. 82   • 8. 12 o • tk a

    I b T e c d ps 10 . g O • il IB N • 8 . 8. 0 .o • 12 n n 10 . g • n nK 10 . u 
  159. 

  160. .  • . 1L c S g g e

    b • 2 8 0L b • . 1 2 8 0 a W kIut Pm • L . 1I 2 8 0 l Po B N • L 2 8 0 a d ni AN d d • L ni AN d d 
  161. 

  162. . 12 - 3 . • 13: /37 • 13:

    v N ina ew S u cjf • N I7BB 4 4 B 5 9 4 4 B 5 7 • • 13: t r • 13: gob o • w koe W • oe l e • 08:8 • h m • p 13: s 
  163. .B:12 . . • : 0 A MN 1 :

    a bc • AA 8A B2 B:12 21 : 2B: 8 B 8 A 1A8 1 2: 2 1 A / - • : R S E G I D 1 : a bc N E 
  164. 1F? 0 . . • x q = A 9

    feb q ?A p = A 9 oc 34z • / 2 h ln k n 34k an z QN BD : C I A F = :A ?B D AB9 I A F 9 = A 9 .9 =? DB =8 ?A t V 34k an w ?A qs e og d i S qs yu 
  165. # - 01 2 3 . • 0G . 0

    4 0FN I I b • # d c S I a A 0 A 0 0G 2 01 0 A 0 A 4 # # 0 0G 0 8 0 4 0F A A 4A 24 8284A • /4 4 4AA 0 4 : I P . 0 4 0FN I I S I • A A4 4 4AA 2 0 4 : 2A 8 4 A 0 A 4 4 A 0 8 0 4 0F 4A 24 82F 
  166.     provider: name: aws ( .) resourcePolicy:

    - Effect: Allow Principal: "*" Action: execute-api:Invoke Resource: - execute-api:/*/*/* Condition: IpAddress: aws:SourceIp: - "52.199.190.133" - "54.238.59.48" ... .
  167. • . 2 1 08 

  168. 8 . :/      • /

    8 1. KI • . / 8 / 1/ B1. • : :1 1. KI • 18 : :1 / 1:1 8 0 : 8 2 00 1 8 
  169. 8 1 2  • I Pai e I P

    B ln • o 01 . 0 2 2 N 2 0 2 2 01 . N • P i I g_P kb e P i dc ln  resourcePolicy: - Effect: Allow Principal: "*" Action: execute-api:Invoke Resource: - execute-api:/*/*/*
  170. . • • /:: - - -8 0 1 2

    . 0 0 - 
  171. 8 4 . . • 34 1 N B 0.2

    3 A B      D P     I P
  172. 801 92 . • NP /. • 5 34 48:

    4 2 1: : 52 70 0 284 • I • 5 34 48: 4 2 1: : 52 70 0 284