Building Smart AI ChatBot with Line and Dialogflow: A Practical Approach for Cost-Efficient Interactions (利用 Dialogflow 建立 Line 智能回覆:成本效益互動的實踐方法)

Building Smart AI ChatBot with Line and Dialogflow: A Practical Approach for Cost-Efficient Interactions (利用 Dialogflow 建立 Line 智能回覆:成本效益互動的實踐方法)

In recent days, my focus has been on setting up a smart reply system for Line, and this is the perfect opportunity to introduce Dialogflow. Dialogflow is a simple yet powerful conversational AI platform that integrates seamlessly with Line, making it easy to set up and use, allowing us to interact with our users more effectively.

When using Dialogflow, two key concepts come into play: Intents and Entities. Intents are used to define the purpose of the user input, enabling the system to recognize the user’s needs and provide appropriate responses. For example, we created an Intent that allows the system to determine whether the user is asking about the issuance of souvenirs by a company, and we designed specific response logic around this question. This setup enables us to precisely identify and handle various user requests.

Entities, on the other hand, are used to extract crucial information. They allow us to pull out key terms from user conversations, which helps us deliver more accurate responses and further enhance the overall user experience.

A few months ago, I hastily set up the system in just one day before it first went live. However, the results were far from what I expected. After spending the past few days revisiting the documentation and optimizing our setup, we finally completed our first key feature: checking whether a company has issued souvenirs. This has significantly improved our ability to respond to user needs more accurately and quickly, leading to a noticeable enhancement in the overall user experience.

So, why not use Line API’s push notifications for user interactions? The main reason is cost. Although the Line API is convenient, its costs are prohibitively high, whether used for promotional notifications or direct user interactions. For a startup like ours, this economic burden is simply too heavy. To better control our expenses, we opted for more affordable alternatives: FCM (Firebase Cloud Messaging) and Email. These methods not only achieve the desired interaction with users but also save us a significant amount of money.

Conclusion:

In the journey of entrepreneurship, we constantly face challenges due to limited resources. Making the most effective decisions with restricted funds and time is something every entrepreneur must consider. This experience of building a smart reply system has taught me that the perfect solution isn't necessarily the most expensive or advanced; it's the one that best fits our current needs.

Entrepreneurship is an ongoing process of learning and adjusting, continuously finding a balance between reality and ideals. This experience has reinforced the idea that adaptability and rapid iteration are crucial to success in business. The road ahead is still long, but the willingness to learn from imperfections and keep moving forward will be the key to going further.

最近這幾天,我主要著重在為 Line 建立智能回覆系統,但這一定要來介紹下 Dialogflow。Dialogflow 是一個簡單而強大的對話式 AI 平台,能夠輕鬆地與 Line 串接,並快速設置和使用,讓我們能夠更好地與用戶進行互動。

在使用 Dialogflow 時,有兩個重要的概念:IntentEntitiesIntent 是用來定義使用者輸入的意圖,它讓系統能夠辨識出用戶的需求並給出相應的回應。例如,我們建立了一個 Intent,讓系統可以判斷出用戶是否在查詢公司有無發放紀念品,並針對這個問題設計了相應的回覆邏輯。這樣的設置使我們能夠精確地識別和處理用戶的各種需求。

Entities 則是用來提取關鍵資訊的部分,它能夠從用戶的話語中抓取重要的詞彙,這樣我們就能給出更為精準的回覆,進一步提升用戶體驗。

在這幾天之前,其實前幾個月第一次上線,我只花了一天時間匆忙搭建,但實際上線後,效果一直不如預期。經過這幾天重新閱讀文件並優化設置後,我們終於完成了第一個功能:查詢公司是否有發放紀念品。這讓我們在回覆用戶需求上更精準、更迅速,整體用戶體驗也有了顯著提升。

那為什麼不使用 Line API 功能來與用戶互動呢?主要原因在於成本考量。Line API 雖然方便,但它的費用實在太高,無論是用於促銷通知還是與用戶的互動,對我們這樣的初創來說,經濟壓力實在不小。為了更好地控制成本,我們選擇了更加經濟實惠的替代方案:FCM(Firebase Cloud Messaging) 和 Email。這些方式不僅能夠達到與用戶互動的效果,也能幫助我們節省一大筆費用。

結語:

在創業的路上,我們總是面臨資源有限的挑戰。如何在有限的資金和時間內做出最有效的決策,是每一位創業者都需要思考的問題。在這次的智能回覆建置過程中,我深刻體會到,完美的解決方案不一定是最昂貴或最先進的,而是最能符合現階段需求的。

創業本身就是一場持續學習和調整的過程,不斷在現實和理想之間找到平衡。這次的經驗提醒我,靈活應變、快速迭代才是創業中的制勝關鍵。未來的路還很長,願意從不完美中汲取經驗、持續前行,才能真正走得更遠。

Read more

Cloudflare WAF 心得

最近看一篇文章,作者說明他們因為 GCS 一直被reqeust 而導致的大量費用,就先讓我想到我的 GCP LB 一直都未有很好的保護措施,我開始意識這一個風險。為了避免這種情況,因此今天我來分享一下我的使用經驗。 1. Web Application Firewall (WAF) 的功能 首先要提到的是 Cloudflare 提供的 WAF 功能。即便是免費版,也能夠設定最多 5 個自訂規則,這對於小型網站或服務來說已經相當充足。最吸引我的是 WAF 內建的「威脅分數」功能,可以根據訪客 IP 的信譽來評估潛在風險,將威脅分數從 0(低風險)到 100(高風險)進行分類,這樣可以有效阻擋危險的 IP 地址。 根據 Cloudflare 的官方文檔,我們可以根據威脅分數設置防護規則,

By Tim Chiang