{ "createdAt": "2025-02-13T10:33:28.698Z", "updatedAt": "2025-03-25T01:55:32.000Z", "id": "OOzu6qnvABmNOA2k", "name": "send_twitter_wrong_msg", "active": true, "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": "39c485eb-21e6-4686-a529-f76bac5c33ed", "name": "is_exists_warn_by_retry", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ 80, 780 ], "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": "e3eea07a-dc56-41c7-8ac7-73ad763235ef", "name": "is_exists_warn_other", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ 80, 1040 ], "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": "07df41b0-7a65-44b1-891c-c97406fa6764", "leftValue": "={{JSON.parse($('Webhook').all()[0].json.body.info).error_info }}", "rightValue": "", "operator": { "type": "string", "operation": "notEmpty", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "id": "26823d37-d175-401b-9f17-28f500dd8a8e", "name": "is_send_msg_judge", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [ 280, 1040 ] }, { "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" } }, { "id": "e16adaf5-6fd5-4a12-b6b4-f3c55e643fae", "leftValue": "={{JSON.parse($('Webhook').all()[0].json.body.info).error_info }}", "rightValue": "", "operator": { "type": "string", "operation": "notEmpty", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "id": "6378e170-35cd-415b-91a5-0d06309104b3", "name": "is_send_msg", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [ 280, 780 ] }, { "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": "691dd49f-a745-409e-a94e-91924ab2a074", "name": "get_rw_name", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ 480, 900 ], "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:<font color=\\\"comment\\\">\"+schedule_id+\"</font>\\n>任务名称:<font color=\\\"comment\\\">\"+rw_name+\"</font>\\n>博主名称:<font color=\\\"comment\\\">\"+info_data.user_screen_name+\"</font>\\n>原因:<font color=\\\"comment\\\"> \"+info_data.error_info+\"</font>\\n>失败时间:<font color=\\\"warning\\\"> \"+info_data.occur_date+\"</font>\\n>详情页:<font color=\\\"comment\\\"> [http://16.162.124.172:8080/#/tasks](http://16.162.124.172:8080/#/tasks)</font>\";\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": "57ea2125-66ec-40f4-9c71-2ff8ea9d45db", "name": "get_msg_content", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 640, 900 ] }, { "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": "2bd4eb67-e56a-4150-bb95-f5263b73c398", "name": "send_msg", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 800, 900 ] }, { "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": "dcdfc88f-5a69-4cc3-83fd-4ea375e59aaa", "name": "update_warn_info", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ 960, 900 ], "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": "ca9e1a9f-fbda-49e9-bdf5-a171ee58ace2", "name": "insert_fail_log", "type": "n8n-nodes-base.mySql", "typeVersion": 2.4, "position": [ -140, 920 ], "credentials": { "mySql": { "id": "YpVIiGwzmmkf7vR7", "name": "SL-DB-PRD" } } }, { "parameters": { "httpMethod": "POST", "path": "twitter/fail", "authentication": "headerAuth", "options": { "allowedOrigins": "*", "rawBody": false } }, "id": "866b4051-927c-4258-8fd1-2371b0c1e1c1", "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ -300, 920 ], "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": "fece92de-ca06-4557-9984-0e3c65f4d4b0", "triggerCount": 1, "shared": [ { "createdAt": "2025-02-13T10:33:28.725Z", "updatedAt": "2025-02-13T10:33:28.725Z", "role": "workflow:owner", "workflowId": "OOzu6qnvABmNOA2k", "projectId": "C7zKoCDdmGgzUqSW", "project": { "createdAt": "2024-08-23T06:31:21.275Z", "updatedAt": "2024-08-23T06:41:43.608Z", "id": "C7zKoCDdmGgzUqSW", "name": "周 卫 <zhouwei@ssish.com>", "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": [] }