Skip to content
Poomiphat
← All posts
automation · · 4 min read

Slack Reaction + GPT-4o + n8n → สร้างระบบแจ้งบั๊กอัตโนมัติใน 5 วินาที

ใช้ Slack emoji เป็น trigger สร้าง JIRA ticket อัตโนมัติ + GPT-4o สรุปปัญหา + แจ้งกลับอัตโนมัติเมื่อแก้ไขเสร็จ — ทั้งหมดนี้ build ด้วย n8n ใน 2 วัน

เรื่องราวเริ่มจากว่า อยากลองใช้ n8n สร้าง automation ให้เป็นภายในเวลาที่มี 2 วัน และอยากรู้ด้วยตัวเองว่า “n8n มันเจ๋งแค่ไหน” เลยหยิบปัญหาที่เห็นในทีม มาลองทำเป็น automation เพื่อให้ทำงานง่ายขึ้น ไวขึ้นดู

Process ที่หยิบมาลองทำ automation คือ

“การจัดการบั๊กที่แจ้งเข้ามาทาง Slack และอัพเดทกลับไปที่ต้นทางอัตโนมัติ เมื่อแก้ไขเรียบร้อยแล้ว”

การทำงานในปัจจุบัน

ปัญหาที่เกิดขึ้น


ตัวอย่างการทำงาน (Solution Overview)

Slack emoji trigger สร้าง JIRA ticket

GPT-4o สรุปปัญหาเป็น JIRA ticket title

GPT-4o สรุป thread discussion

Auto-notify กลับ Slack thread เมื่อ ticket Done


n8n workflow สามารถ download ได้จากที่นี่


Step-by-Step Implementation

แยกออกเป็น 2 workflow ใน n8n โดยข้อ 1–5 ถูกจัดการด้วย workflow #1

Workflow #1

Workflow #1 overview

ส่วนที่ 1:

ส่วนที่ 1 — รับ Slack webhook

ส่วนที่ 2:

ส่วนที่ 2 — สร้าง JIRA ticket

Summarize following issue reported by users, this will be used as JIRA ticket title.
It should clearly summarize what's the issue, platform occured.
Summarize in Thai. Always return result in json with key "title"

Output should be in following format
[platform]: Issue title in Thai

Remark
- platform must be in following value "Web", "App", "Android App", "iOS App", "Web&App", "Undefined"

ส่วนที่ 3:

ส่วนที่ 3 — อัพเดท incident level

ส่วนที่ 4:

ส่วนที่ 4 — สรุป thread ด้วย GPT-4o

ส่วนนี้เป็นของแถม กรณีที่ issue report thread ใน slack มีการพูดคุย ขอข้อมูลเพิ่มเติมกันเป็นจำนวนมาก ถ้าตามมาอ่านทีหลังจะใช้เวลาทำความเข้าใจและสรุปนาน เราสามารถทำให้บอทของเรา สรุปเนื้อที่คุยกันทั้งหมด รวมถึงสถานะปัญหาปัจจุบันได้ โดยใช้ emoji พิเศษ

Summarize slack thread & all replies below.
Expected output
- Summarize in Thai language
- a json with only one key "summary" which combine all contents (problem, key discussion, current status) as single message, separate each topic with necessary \n line break & topic name
- include emoji in topic name for friendly & easier understanding
- don't include "PO acknowledgement" in any summary
- don't include the fact that JIRA ticket has been created

Topics expected in output

Problem
- summarize what's the problem. don't need to include repoter, team.
Key Discussion (ประเด็นสำคัญ)
- bullet list of key discussion
- include root cause (if any)
Current status
- latest status of this problem & solution (if any)
- in bullet format

Here's the message

Workflow #2

ส่วนนี้ทำหน้าที่รอรับ webhook การอัพเดทสถานะของ ticket ที่ถูกสร้างด้วย automation ของเรา และตอบกลับไปที่ thread ตั้งต้น ที่ report incident นี้มา

Workflow #2 — JIRA webhook → Slack notify


ส่วนที่ต้องเตรียมเพิ่มเติม

Slack App

Credentials


ไอเดียที่สามารถทำต่อเพิ่มเติมได้


สรุป

More in automation