這次的任務,是讓 n8n 自動抓取每日星座運勢(例如金牛座、雙魚座等),
再透過 Gmail 節點自動寄信通知。
最棒的是:這次不需要任何金鑰!Aztro API 是免費且直接開放的。
Schedule Trigger → HTTP Request (Aztro API) → Dify (生成漂亮內容) → Gmail
在 n8n 新增節點,選擇 Schedule Trigger。
設定參數:
小技巧:如果你要測試,可先設為 1 分鐘(Minutes),確認郵件運作正常。
| 設定項目 | 值 |
|---|---|
| Method | POST |
| URL | https://aztro.sameerkumar.website/?sign=taurus&day=today |
| Response Format | JSON |
| Authentication | None |
sign可以改成你的星座(aries, taurus, gemini, cancer, leo, virgo, libra, scorpio, sagittarius, capricorn, aquarius, pisces)day可以是today、tomorrow或yesterday。
執行一次,看看結果。
回傳內容會像這樣:
{
"date_range": "Apr 20 - May 20",
"current_date": "October 27, 2025",
"description": "Today is a great day to focus on your goals...",
"compatibility": "Cancer",
"mood": "Focused",
"color": "Blue",
"lucky_number": "8",
"lucky_time": "10am"
}
新增一個新的 HTTP Request 節點,接在上一步後面。
用來呼叫 Dify Chat API。
Method:POST
URL:https://api.dify.ai/v1/chat-messages
Header:
Authorization: Bearer 你的Dify金鑰
Content-Type: application/json
Body(JSON):
{
"inputs": {},
"query": "幫我根據以下星座資料,寫一封早安信給使用者:{{$json[\"description\"]}}。今天的幸運顏色是{{$json[\"color\"]}},幸運數字是{{$json[\"lucky_number\"]}}。",
"response_mode": "blocking",
"user": "api-user"
}
這樣 Dify 就會幫你把星座資料變成一封自然、有語氣的信件。
新增 Gmail 節點,連到上一步的 Dify 節點。
設定:
你的今日星座運勢
{{$json["answer"]}}執行一次,確認郵件有寄出。
當流程運作時,你的信箱會收到這樣的內容:
早安!今天金牛座的運勢相當順利,
適合整理思緒、調整目標。
幸運顏色是藍色,幸運數字是 8,
記得保持專注的心情迎接每個挑戰!