# API # update workflow node 更新 crescendo workflow 時須在 `attributes` 中加入 `module_type` 以及 `pnp_event` 以及 `channel_id`。 * module_type - 目前有 `PNP` 以及 `NORMAL` 兩種。 * `PNP` - 代表使用 pnp module。 * `NORMAL` - 代表使用原本漸強節點功能。 * pnp_event - 目前只有 `REGISTRATION` 事件。 * `REGISTRATION` - 註冊事件。 ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| |`group_id`||Group id。|Int|當 `module_type` 為 `NORMAL` 的時候必填, `PNP` 時不填寫| |`template_id`||template_id。|Int|當 `module_type` 為 `NORMAL` 的時候必填, `PNP` 時不填寫| |`personalized_send_time`||personalized_send_time。|Boolean|當 `module_type` 為 `NORMAL` 的時候選填, `PNP` 時不填寫| |`ignore_daily_limit`|| ignore daily limit | Boolean |當 `module_type` 為 `NORMAL` 的時候選填, `PNP` 時不填寫| |`ignore_no_subscriber`|| ignore no subscriber | Boolean |當 `module_type` 為 `NORMAL` 的時候選填, `PNP` 時不填寫| |`do_not_disturb_days`|| do not disturb days | Boolean |當 `module_type` 為 `NORMAL` 的時候選填, `PNP` 時不填寫| |`module_type`|`PNP`、`NORMAL`| module type|String| 必填| |`pnp_event`|`REGISTRATION `| pnp event|String| 必填| |`channel_id`|| Crescendo channel 的 ID|Int| 必填| ## endpoint > /ma_workflow/workflow-node/ ## method > PATCH ## request > PATCH `http://localhost:8000/ma_workflow/workflow-node/` { "name":"Line 漸強", "attributes":{ "module_type":"PNP", "pnp_event":"REGISTRATION", "channel_id":1 }, "template_config":{} } ## response { "SUCCESS": true, "PAYLOAD": { "id": 102, "name": "Line 漸強", "node_type": "workflownodeactionlinecrescendo", "display_name": "CrescendoLineMessage", "category": "ACTION", "attributes": { "starting_node": false, "requires_audience": true, "personalized_send_time": false, "ignore_daily_limit": false, "ignore_no_subscriber": false, "do_not_disturb_days": 0, "module_type": "PNP", "pnp_type": "REGISTRATION", "crescendo_channel_id": 1, "crescendo_channel_name": "test crescendo channel" }, "ui_data": { "x": 691, "y": 89 }, "is_valid": true, "is_uneditable": false, "description": null } } ---- # Sync crescendo template 用來向漸強獲取 template 並儲存在系統中,只會回應是否同步成功,並不會回傳 template,須在 `info` 中加入 `channel_id`。 ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| |`channel_id`|正整數| Crescendo channel 的 ID。|Int| 當 organization 的 `is_multi_channel` 為 `True` 時必填,為 `False` 時不填。| ## endpoint > /ma_cms/crescendo/sync-template/ ## method > POST ## request > POST `http://localhost:8000/ma_cms/crescendo/sync-template/` { "info": { "channel_id":2 } } ## response { "SUCCESS": true, "PAYLOAD": { "status": 200 } } ---- # get crescendo template 用來獲取 crescendo template,需在確認漸強 token 有效後使用,會回傳漸強 template。 ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| |`channel_id`|正整數| Crescendo channel 的 ID。|Int| 當 organization 的 `is_multi_channel` 為 `True` 時必填,為 `False` 時不填。| ## endpoint > /ma_cms/crescendo/template/ ## method > GET ## request > GET `http://localhost:8000/external_api/crescendo/templates/?channel_id=2` > GET `http://localhost:8000/external_api/crescendo/templates/` ## response { "SUCCESS": true, "PAYLOAD": { "status": 200, "data": { "next": null, "results": [ { "id": 20742, "name": "南", "parameters": [] }, { "id": 20740, "name": "中", "parameters": [] }, { "id": 20739, "name": "北", "parameters": [] }, { "id": 7516, "name": "【omni】LINE日常推播_1103_NASL", "parameters": [ "LineA", "LineB", "LineC", "LineD", "LineE", "LineF", "LineG", "LineH" ] }, { "id": 4156, "name": "PV_S1_L", "parameters": [ "link1", "link2", "link3", "link4", "link5", "link6" ] } ] } } } ---- # get template 用來獲取 template 。 ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| |`template_id`|正整數| Template channel 的 ID。|Int| 必填| ## endpoint > ma_cms/template/{template_id}/ ## method > GET ## request > GET `http://localhost:8000/ma_cms/template/4/` ## response { "SUCCESS": true, "PAYLOAD": { "id": 4, "name": "fdsf", "created_at": "2021-10-18T17:55:01.633094+0800", "updated_at": "2021-10-19T11:17:48.956498+0800", "sent_at": null, "is_active": false, "created_by": "admin", "template": { "msg": {}, "type": "crescendo_line", "parameters": [ "LineA", "LineB", "LineC", "LineD", "LineE", "LineF", "LineG", "LineH" ] }, "title_template": "【omni】LINE日常推播_1103_NASL", "is_template": false, "group_id": 4, "group_name": "asfsf", "preview_text": null, "tid": "OA-c19eb6", "crescendo_template_id": 7516, "webpopup_start_time": null, "webpopup_end_time": null, "crescendo_channel_id": 1 } } ---- # Send crescendo test 發送 crescendo 測試。 ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| |`line_id`|| Line account 的 ID。| String | 必填| |`template_id`|正整數| template 的 ID。|Int| 必填| |`member_sn`|| Audience 的 member_sn|String| 必填| |`channel_id`|正整數|Crescendo channel 的 ID|Int| 必填| ## endpoint > /external_api/crescendo/send-crescendo-test/ ## method > POST ## request > POST `http://localhost:8000/external_api/crescendo/send-crescendo-test/` { "line_id":"line_id", "template_id":2, "member_sn":"member_sn", "channel_id":2 } ## response { "SUCCESS": true, "PAYLOAD": payload } > 結果與原本 api 的 response 相同,但目前沒有可測試的真正 crescendo token,所以詳細 respons 暫時無法得知。 ---- # Get crescendo channel list 獲取所有 crescendo channel 資訊。 ## endpoint > `/ma_account/crescendo-channel/` ## method > GET ## request > GET `http://localhost:8000/ma_account/crescendo-channel/` ## response { "SUCCESS": true, "PAYLOAD": { "data": [ { "id": 1, "crescendo_channel_name": "dasd", "crescendo_access_token": "9ersrqijtKVWP244Jz0gPMktikis5gv+XZXBju348mA=", "organization": 2 } ] } } ---- # Get crescendo channel 獲取目標 crescendo channel 資訊。 ## endpoint > `/ma_account/crescendo-channel/{channel_id}/` ## method > GET ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| | `channel_id `|| Crescendo channel 的 ID。|Int| 必填| ## request > GET `http://localhost:8000/ma_account/crescendo-channel/1` ## response { "SUCCESS": true, "PAYLOAD": { "id": 1, "crescendo_channel_name": "dasd", "crescendo_access_token": "9ersrqijtKVWP244Jz0gPMktikis5gv+XZXBju348mA=", "organization": 2 } } ---- # create crescendo channel 建立 Crescendo channel。 ## endpoint > `/ma_account/crescendo-channel/` ## method > POST ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| | `channel_name`|| crescendo channel 的名稱。|String| 必填| | `access_token`|| crescendo channel 的 token。|String| 必填| ## request > POST `http://localhost:8000/ma_account/crescendo-channel/` { "channel_name": "test_crescendo_line_channel", "access_token":"token" } ## response { "SUCCESS": true, "PAYLOAD": { "id": 2, "crescendo_channel_name": "test_crescendo_line_channel", "crescendo_access_token": "token", "organization": 2 } } ------ # update crescendo channel 更新 crescendo channel。 ## endpoint > `/ma_account/crescendo-channel/{channel_instance_id}/` ## method > PATCH ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| | `channel_instance_id `|| Crescendo channel instance 的 id。|Int| 必填| | `channel_name`|| Crescendo channel 的名稱。|String|選填| | `access_token`|| Crescendo channel 的 token。|String|選填| ## request > PATCH `http://localhost:8000/ma_account/crescendo-channel/2/` { "info":{ "channel_name": "test_crescendo_line_channel", "access_token":"token" } } ## response { "SUCCESS": true, "PAYLOAD": null } ---- # Get Crescendo pnp event list 獲取 crescendo pnp event 列表。 ## endpoint > /ma_account/crescendo-pnp-event/ ## method > GET ## request > GET `http://localhost:8000/ma_account/crescendo-pnp-event/` ## response { "SUCCESS": true, "PAYLOAD": { "data": [ { "id": 2, "pnp_setting_id": "123", "pnp_event": "REGISTRATION", "crescendo_channel_id": 1, "crescendo_channel_name": "tecrescendo_line_channel" } ] } } --- # Get Crescendo pnp event instance 獲取指定 Crescendo pnp event instance。 ## endpoint > /ma_account/crescendo-pnp-event/{pnp_event_id}/ ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| | `pnp_event_id `|| crescendo pnp evet 的 instance id。|Int|必填| ## method > GET ## request > GET `http://localhost:8000/ma_account/crescendo-pnp-event/2` ## response { "SUCCESS": true, "PAYLOAD": { "id": 2, "pnp_setting_id": "123", "pnp_event": "REGISTRATION", "crescendo_channel_id": 1, "crescendo_channel_name": "tecrescendo_line_channel" } } --- # create Crescendo pnp event 建立 crescendo pnp event instance。 ## endpoint > /ma_account/crescendo-pnp-event/ ## method > POST ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| | `pnp_setting_id`|| Pnp setting 的 id。|Int| 必填| | `channel_id`|| line channel 的 id 。|Int| 必填| | `pnp_event`|"REGISTRATION"|pnp 事件。|String|必填| ## request > POST `http://localhost:8000/ma_account/crescendo-pnp-event/` { "pnp_setting_id": "123", "channel_id": 2, "pnp_event": "REGISTRATION" } ## response { "SUCCESS": true, "PAYLOAD": { "id": 3, "pnp_setting_id": "123", "pnp_event": "REGISTRATION", "crescendo_channel_id": 2, "crescendo_channel_name": "test_crescendo_line_channel" } } --- # update Crescendo pnp event 更新 crescendo pnp event。 ## endpoint > /ma_account/crescendo-pnp-event/{crescendo-pnp-event-id}/ ## method > PATCH ## Parameters | Parameter | Value | Description | Data Type || |:------------- |:---------------:|:------------- |:-------------:|:-------------:| | `crescendo-pnp-event-id`|| Crescendo pnp event 的 instance id。|Int| 必填| | `pnp_setting_id`|| Pnp setting 的 id。|Int| 選填| | `channel_id`|| Crescendo channel 的 id 。|Int| 選填| | `pnp_event`|"REGISTRATION"|pnp 事件。|String|選填| ## request > PATCH `http://localhost:8000/ma_account/crescendo-pnp-event/2/` { "info": { "pnp_setting_id": "222", "pnp_event": "REGISTRATION", "channel_id": 2 } } ## response { "SUCCESS": true, "PAYLOAD": null } -- ## Get crescendo pnp events 獲取 crescendo pnp event 類型。 ## endpoint > `/ma_account/get-crescendo-pnp-events/` ## method > GET ## request > GET `http://localhost:8000/ma_account/get-crescendo-pnp-events/` ## response { "SUCCESS": true, "PAYLOAD": [ "REGISTRATION" ] } --