{
  "id": "u4rtMIxYZRWJxXIf",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Freebie: Daily Reminders Template",
  "tags": [
    {
      "id": "C61r5OM5FTpiJdHt",
      "name": "Anne",
      "createdAt": "2025-04-30T20:06:56.698Z",
      "updatedAt": "2025-04-30T20:06:56.698Z"
    },
    {
      "id": "MucILRyltryNYlLg",
      "name": "family",
      "createdAt": "2025-04-25T19:19:21.461Z",
      "updatedAt": "2025-04-25T19:19:21.461Z"
    }
  ],
  "nodes": [
    {
      "id": "9d081baa-1b7d-4e82-b5c9-03a3ea75fa2b",
      "name": "Twilio",
      "type": "n8n-nodes-base.twilio",
      "position": [
        1616,
        240
      ],
      "parameters": {
        "to": "={{ $('Persist schema').item.json.to }}",
        "from": "=YOUR TWILIO NUMBER HERE",
        "message": "={{ $json.text }}",
        "options": {}
      },
      "credentials": {
        "twilioApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a7da51ea-5540-4902-a119-ddd95106530a",
      "name": "Basic LLM Chain",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1168,
        240
      ],
      "parameters": {
        "text": "=Today\u2019s calendar items for {{ $json[\"calendar\"] }}: \n<daily_events>\n{{ $json[\"eventsList\"] }}\n</daily_events>\n\nNow, generate an SMS summary following the guidelines.",
        "messages": {
          "messageValues": [
            {
              "message": "=You are Riley, an AI personal assistant designed to send daily SMS summaries to {{$json.calendar}}. Your task is to create a concise, informative, and friendly message summarizing the day's events for the family.\n\nThe list of the day's events is enclosed in <daily_events />, which may include appointments, activities, reminders, or other important information.  When summarizing the daily events, follow these guidelines:\n\n1. Prioritize the most important events\n2. Group similar events together\n3. Use concise language to keep the message brief\n4. Include specific times for scheduled events\n5. Mention which family members are involved in each event, if specified.\n\nFormat the SMS in a friendly, conversational tone. Feel free to use emojis. Start with a greeting and end with a positive closing remark, signed in a new line \"-Riley from RalleyReminders.com\".\n\nKeep the entire message under 200 characters to ensure it fits in a single SMS. Format it with line breaks. If there is more than one event, number the events to make it easily readable. Here's an example of how your output should be structured:\n\n<example_sms_one_event>\nHello {{$json.calendar}}! Today: Dentist appointment @2pm\nRemember to brush your teeth before you go. Have a great day! \ud83d\ude0a\n-Riley from RalleyReminders.com\n</example_sms_one_event> \n\n<example_sms_many_events>\nHello {{$json.calendar}}! Today:\n1. Dentist appointment @2pm\n2. Yoga @4pm\n\nRemember to thank God for this day. Have a great day! \ud83d\ude0a\n-Riley from RalleyReminders.com\n</example_sms_many_events>"
            }
          ]
        },
        "promptType": "define"
      },
      "retryOnFail": true,
      "typeVersion": 1.6,
      "alwaysOutputData": false,
      "waitBetweenTries": 5000
    },
    {
      "id": "bb9f40db-1ab1-4bf1-988f-c6316751785d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        64
      ],
      "parameters": {
        "width": 960,
        "height": 440,
        "content": "## Gets events from your Google Calendar\nSends daily reminders summarizing the day's events to your phone at 7AM"
      },
      "typeVersion": 1
    },
    {
      "id": "a38b73d3-e1f3-42e7-9380-b45dc096c0d3",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        1184,
        464
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-3-7-sonnet-20250219",
          "cachedResultName": "Claude 3.7 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "d8d7effb-589f-41e2-96e3-c0003f66b3df",
      "name": "Trigger workflow at 7AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "Runs everyday at 7AM",
      "position": [
        48,
        240
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 7
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "23cb246a-2380-49a2-ae73-749960b42537",
      "name": "Get events from Events Calendar",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        272,
        240
      ],
      "parameters": {
        "options": {},
        "timeMax": "={{ $today.plus(1, 'day')}}",
        "timeMin": "={{ $today }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": ""
        },
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "10fb1e56-335b-4486-b501-1bdf16076088",
      "name": "Check if there are any events",
      "type": "n8n-nodes-base.if",
      "position": [
        496,
        240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bbfb1109-0619-4b6f-a3f4-f36ad7ac2b89",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $items(\"Get events from Events Calendar\").length }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0377e81f-4ede-491c-acb2-960d57c884bf",
      "name": "Format list of events and sender mobile num",
      "type": "n8n-nodes-base.code",
      "position": [
        720,
        240
      ],
      "parameters": {
        "jsCode": "// Pull in *all* today's events and build your string:\nconst events = $input.all();\nconst list = events\n  .map(evt => {\n    const time = new Date(evt.json.start.dateTime)\n  .toLocaleTimeString('en-US', {\n    timeZone: evt.json.start.timeZone,\n    hour:     '2-digit',\n    minute:   '2-digit'\n  });\n    return `\u2022 ${evt.json.summary} at ${time}`;\n  })\n  .join(\"\\n\");\n\nconst output = {\n  json: {\n    // send to this user's number\n    to: \"+1234567890\",\n    eventsList: list || \"No events today.\",\n    // name of user\n    calendar: \"Anne\"\n  }\n}\n\nreturn output;"
      },
      "typeVersion": 2
    },
    {
      "id": "0c44dba7-6e1d-4943-8b9a-964a8844aaa0",
      "name": "Persist schema",
      "type": "n8n-nodes-base.set",
      "position": [
        960,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3fa4303d-b6cc-45fb-ae63-b1a84b394656",
              "name": "to",
              "type": "string",
              "value": "={{ $json.to }}"
            },
            {
              "id": "f0075929-e6fd-4e29-ae56-b6d2200eb933",
              "name": "eventsList",
              "type": "string",
              "value": "={{ $json.eventsList }}"
            },
            {
              "id": "11adeb19-db56-464f-9c49-f736ed3290f3",
              "name": "calendar",
              "type": "string",
              "value": "={{ $json.calendar }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "retryOnFail": true,
      "typeVersion": 3.4,
      "alwaysOutputData": false
    },
    {
      "id": "b0f0540e-5f28-452f-a905-a62f65b806f2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 336,
        "height": 240,
        "content": "## Requirements\nCreate an account for each of these:\n- [**Twilio account**](https://www.twilio.com/console) (buy a phone number & load it with a few bucks. This will be your assistant's number.)\n- [**Google Cloud**](https://cloud.google.com/cloud-console?hl=en) (activate the Calendar API so you can get an API key to access your calendar)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0792fd00-8a38-48ca-b453-3f2bb0dde2bf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        64
      ],
      "parameters": {
        "width": 400,
        "height": 560,
        "content": "## Personal Assistant\nLet's add personality! This is where your events get formatted into a friendly message by the AI."
      },
      "typeVersion": 1
    },
    {
      "id": "5d99cdee-5172-42e6-8a66-b4403fd67f44",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        64
      ],
      "parameters": {
        "width": 384,
        "height": 352,
        "content": "## Send via SMS\nDon't forget to replace the sender number with the number you just bought from Twilio here!"
      },
      "typeVersion": 1
    },
    {
      "id": "135861a1-6e7d-4588-bdd7-fafa505f00ba",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -208
      ],
      "parameters": {
        "color": 4,
        "width": 368,
        "height": 240,
        "content": "## What does this do?\nThe goal of this automation is for you to receive a daily SMS of the day's calendar events in a summarized form first thing in the morning.\n\nThis is like a personal assistant giving you a heads up of the day ahead! \ud83c\udf1e\n\n-Anne, [**ralleyreminders.com**](https://www.ralleyreminders.com/)\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "timezone": "America/Edmonton",
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1"
  },
  "versionId": "7cb03257-ca69-4713-b880-4e7caf952be8",
  "connections": {
    "Persist schema": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Twilio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Trigger workflow at 7AM": {
      "main": [
        [
          {
            "node": "Get events from Events Calendar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if there are any events": {
      "main": [
        [
          {
            "node": "Format list of events and sender mobile num",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get events from Events Calendar": {
      "main": [
        [
          {
            "node": "Check if there are any events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format list of events and sender mobile num": {
      "main": [
        [
          {
            "node": "Persist schema",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}