{
  "schema_version": "1.0.0",
  "id": "vip-email-sms-alert",
  "title": "Text the owner when a VIP emails",
  "category": "email",
  "difficulty": "beginner",
  "featured": false,
  "description": "Mail from a short list of key clients is summarised in one line and texted to the owner, so it is seen even away from the inbox.",
  "tags": [
    "email",
    "gmail",
    "vip",
    "twilio",
    "sms"
  ],
  "apps": [
    "Gmail",
    "AI by Zapier",
    "Code by Zapier",
    "Twilio"
  ],
  "plan": {
    "minimum": "Professional",
    "reasons": [
      "multi-step Zap: 3 steps after the trigger",
      "AI by Zapier"
    ]
  },
  "tasks": {
    "typical": 3,
    "max": 3
  },
  "trigger": {
    "app": "Gmail",
    "event": "New Email Matching Search",
    "kind": "polling",
    "title": "New email from a VIP",
    "why": "The search is the VIP list. Domains catch everyone at the client; single addresses catch one person.",
    "config": {
      "Search String": "from:(globex.example OR initech.example OR ceo@harbor-goods.example) -label:sent"
    },
    "outputs": [
      "message_id",
      "thread_id",
      "from_email",
      "from_name",
      "to",
      "subject",
      "date",
      "body_plain",
      "snippet",
      "labels",
      "attachment_count",
      "attachment_names"
    ],
    "sample": "sample-trigger.json"
  },
  "steps": [
    {
      "key": "gist",
      "kind": "ai",
      "app": "AI by Zapier",
      "event": "Analyze and Return Data",
      "title": "Summarise in one line",
      "why": "The text has room for one sentence, so the AI writes exactly one.",
      "fields": {
        "Model": "Default (fast)",
        "Instructions": "Summarise this email in one plain sentence of at most 15 words, saying what the sender wants and by when if stated. No greeting, no emoji.",
        "Input data": "From: {{trigger.from_name}}\nSubject: {{trigger.subject}}\n\n{{trigger.body_plain}}",
        "Output fields": "summary"
      },
      "outputs": [
        "summary"
      ]
    },
    {
      "key": "sms",
      "kind": "code",
      "app": "Code by Zapier",
      "event": "Run JavaScript",
      "title": "Fit it into one text",
      "why": "Keeps the alert to one GSM segment even if the summary runs long or includes curly quotes.",
      "code": {
        "language": "javascript",
        "module": "fit-sms",
        "file": "code/fit-sms.js"
      },
      "input_data": {
        "template": "VIP mail from {first_name} ({business}): {{gist.summary}}",
        "first_name": "{{trigger.from_name}}",
        "business": "{{trigger.from_email}}",
        "link": ""
      },
      "outputs": [
        "message",
        "encoding",
        "length",
        "segments",
        "trimmed"
      ]
    },
    {
      "key": "text",
      "kind": "action",
      "app": "Twilio",
      "event": "Send SMS",
      "title": "Text the owner",
      "why": "Sent to the owner's mobile from the business Twilio number.",
      "fields": {
        "From Number": "YOUR_TWILIO_NUMBER",
        "To Number": "YOUR_MOBILE_NUMBER",
        "Message": "{{sms.message}}",
        "Send Large Messages?": "No"
      },
      "outputs": [
        "sid",
        "status"
      ]
    }
  ]
}
