{ "createdAt": "2025-03-25T01:49:14.733Z", "updatedAt": "2025-03-25T01:52:44.000Z", "id": "AIoFxcSiFngLarts", "name": "test_send_msg", "active": false, "nodes": [ { "parameters": { "operation": "executeQuery", "query": "select IFNULL(count(1), 0) as count from (\nselect a.rw_id,screen_name,occur_date from craw_warn_log_info a where a.rw_id = {{JSON.stringify(JSON.parse($('Webhook').all()[0].json.body.schedule_id)) }} and a.screen_name = {{JSON.stringify(JSON.parse($('Webhook').all()[0].json.body.info).user_screen_name) }} and a.content like '%429%' and a.status =0 group by screen_name,occur_date) as craw_warn_info;\n", "options": {} }, "id": "be2e9e8e-5969-4791-9dd5-64e4383bb9bd", "name": "is_exists_warn_by_retry", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ 180, 120 ], "alwaysOutputData": false, "credentials": { "mySql": { "id": "YpVIiGwzmmkf7vR7", "name": "SL-DB-PRD" } } }, { "parameters": { "operation": "executeQuery", "query": "select IFNULL(count(1), 0) as count from (\nselect a.rw_id,screen_name,occur_date from craw_warn_log_info a where a.rw_id = {{JSON.stringify(JSON.parse($('Webhook').all()[0].json.body.schedule_id)) }} and a.screen_name = {{JSON.stringify(JSON.parse($('Webhook').all()[0].json.body.info).user_screen_name) }} and (a.content not like '%429%' and a.content not like '%403%' and LENGTH(TRIM(a.content))>0) and a.status =0 group by screen_name,occur_date) as craw_warn_info;\n", "options": {} }, "id": "524e6be9-40a9-4d67-b4d6-7bcc7e0e3f3b", "name": "is_exists_warn_other", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ 180, 380 ], "alwaysOutputData": false, "credentials": { "mySql": { "id": "YpVIiGwzmmkf7vR7", "name": "SL-DB-PRD" } } }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" }, "conditions": [ { "id": "a1541edc-9637-4ac2-83a6-902ee9d29af6", "leftValue": "={{$json.count}}", "rightValue": 1, "operator": { "type": "number", "operation": "gte" } }, { "id": "995d3b4f-9632-485e-9367-021358d56f79", "leftValue": "={{JSON.parse($('Webhook').all()[0].json.body.info).error_info }}", "rightValue": "", "operator": { "type": "string", "operation": "notEmpty", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "id": "cb45ed2b-9a2a-4718-af12-30574d40a6ae", "name": "is_send_msg_judge", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [ 380, 380 ] }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" }, "conditions": [ { "id": "a1541edc-9637-4ac2-83a6-902ee9d29af6", "leftValue": "={{$json.count}}", "rightValue": 3, "operator": { "type": "number", "operation": "gte" } } ], "combinator": "and" }, "options": {} }, "id": "8d355bd4-4c8b-4693-b007-f8a89c0a30b3", "name": "is_send_msg", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [ 380, 120 ] }, { "parameters": { "operation": "executeQuery", "query": "select a.`name` from schedule a where a.id = {{ JSON.parse($('Webhook').all()[0].json.body.schedule_id) }};\n", "options": {} }, "id": "b40719c4-3acc-42ba-86d4-cda1b62c3975", "name": "get_rw_name", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ 580, 240 ], "alwaysOutputData": false, "credentials": { "mySql": { "id": "YpVIiGwzmmkf7vR7", "name": "SL-DB-PRD" } } }, { "parameters": { "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\ninfo_data = JSON.parse($('Webhook').all()[0].json.body.info);\nschedule_id = JSON.parse($('Webhook').all()[0].json.body.schedule_id);\nrw_name = $('get_rw_name').all()[0].json.name;\ninfo_content = \"## twitter采集异常\\n >ID:\"+schedule_id+\"\\n>任务名称:\"+rw_name+\"\\n>博主名称:\"+info_data.user_screen_name+\"\\n>原因: \"+info_data.error_info+\"\\n>失败时间: \"+info_data.occur_date+\"\\n>详情页: [http://16.162.124.172:8080/#/tasks](http://16.162.124.172:8080/#/tasks)\";\noutput_all_data = {};\noutput_all = [];\noutput_all_data['content'] = info_content;\noutput_all.push(output_all_data);\n// console.log(output_all);\nreturn output_all;" }, "id": "69b67f52-52e2-47bf-8082-1589e4e95c41", "name": "get_msg_content", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 740, 240 ] }, { "parameters": { "method": "POST", "url": "k8s-security-ingresss-f24629df48-1909191723.ap-east-1.elb.amazonaws.com/api/v1/msg", "sendHeaders": true, "specifyHeaders": "json", "jsonHeaders": "{\n \"Content-Type\": \"application/json\"\n}", "sendBody": true, "specifyBody": "json", "jsonBody": "={\n \"msgtype\": \"markdown\",\n \"markdown\": {\n \"content\": {{ JSON.stringify($json.content) }}\n }\n }", "options": {} }, "id": "a1853b89-0f5d-4b6f-883d-20767434ff63", "name": "send_msg", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 900, 240 ] }, { "parameters": { "operation": "executeQuery", "query": "update craw_warn_log_info set status = 1 where rw_id = {{JSON.stringify(JSON.parse($('Webhook').all()[0].json.body.schedule_id)) }} and screen_name = {{JSON.stringify(JSON.parse($('Webhook').all()[0].json.body.info).user_screen_name) }}\n", "options": {} }, "id": "e236a700-103d-43f3-a100-4c7a61d9a6dc", "name": "update_warn_info", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ 1060, 240 ], "alwaysOutputData": false, "credentials": { "mySql": { "id": "YpVIiGwzmmkf7vR7", "name": "SL-DB-PRD" } } }, { "parameters": { "operation": "executeQuery", "query": "CALL insert_fail_log({{ JSON.stringify($json.body.info)}},{{JSON.stringify(JSON.stringify($json.body.schedule_id)) }});\n", "options": {} }, "id": "dd760a0d-b700-429a-929b-8dfa73dea59c", "name": "insert_fail_log", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ -40, 260 ], "credentials": { "mySql": { "id": "YpVIiGwzmmkf7vR7", "name": "SL-DB-PRD" } } }, { "parameters": { "httpMethod": "POST", "path": "twitter/fail/test2", "authentication": "headerAuth", "options": { "allowedOrigins": "*", "rawBody": false } }, "id": "582c833e-4940-462d-b804-139f9e00079b", "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ -200, 260 ], "webhookId": "e495a29c-8f43-4175-bdb8-277e03b60b07", "credentials": { "httpHeaderAuth": { "id": "U87Wvnvu9oQ5Zapo", "name": "Header Auth account" } } } ], "connections": { "is_exists_warn_by_retry": { "main": [ [ { "node": "is_send_msg", "type": "main", "index": 0 } ] ] }, "is_exists_warn_other": { "main": [ [ { "node": "is_send_msg_judge", "type": "main", "index": 0 } ] ] }, "is_send_msg_judge": { "main": [ [ { "node": "get_rw_name", "type": "main", "index": 0 } ] ] }, "is_send_msg": { "main": [ [ { "node": "get_rw_name", "type": "main", "index": 0 } ] ] }, "get_rw_name": { "main": [ [ { "node": "get_msg_content", "type": "main", "index": 0 } ] ] }, "get_msg_content": { "main": [ [ { "node": "send_msg", "type": "main", "index": 0 } ] ] }, "send_msg": { "main": [ [ { "node": "update_warn_info", "type": "main", "index": 0 } ] ] }, "insert_fail_log": { "main": [ [ { "node": "is_exists_warn_by_retry", "type": "main", "index": 0 }, { "node": "is_exists_warn_other", "type": "main", "index": 0 } ] ] }, "Webhook": { "main": [ [ { "node": "insert_fail_log", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "meta": { "templateCredsSetupCompleted": true }, "pinData": {}, "versionId": "bb3cd391-1dcf-4ce8-aa73-34920085c440", "triggerCount": 0, "shared": [ { "createdAt": "2025-03-25T01:49:14.746Z", "updatedAt": "2025-03-25T01:49:14.746Z", "role": "workflow:owner", "workflowId": "AIoFxcSiFngLarts", "projectId": "C7zKoCDdmGgzUqSW", "project": { "createdAt": "2024-08-23T06:31:21.275Z", "updatedAt": "2024-08-23T06:41:43.608Z", "id": "C7zKoCDdmGgzUqSW", "name": "周 卫 ", "type": "personal", "projectRelations": [ { "createdAt": "2024-08-23T06:31:21.275Z", "updatedAt": "2024-08-23T06:31:21.275Z", "role": "project:personalOwner", "userId": "3f0021b4-d0a7-4db6-af21-5ef829c47882", "projectId": "C7zKoCDdmGgzUqSW", "user": { "createdAt": "2024-08-23T06:31:16.119Z", "updatedAt": "2025-03-19T06:19:26.514Z", "id": "3f0021b4-d0a7-4db6-af21-5ef829c47882", "email": "zhouwei@ssish.com", "firstName": "周", "lastName": "卫", "personalizationAnswers": { "companyType": "education", "role": "business-owner", "automationBeneficiary": "my-team", "companySize": "20-99", "reportedSource": "friend", "version": "v4", "personalization_survey_submitted_at": "2024-08-23T06:57:52.856Z", "personalization_survey_n8n_version": "1.55.3" }, "settings": { "userActivated": true, "firstSuccessfulWorkflowId": "s6zsznwVs6N4L2Hx", "userActivatedAt": 1725957335278, "npsSurvey": { "responded": true, "lastShownAt": 1742365155724 }, "isOnboarded": true }, "role": "global:owner", "disabled": false, "mfaEnabled": false, "isPending": false, "isOwner": true } } ] } } ], "tags": [] }