{
  "id": "jLFqleUuCkC0qRwj",
  "meta": {
    "aiBuilderAssisted": true,
    "templateCredsSetupCompleted": true
  },
  "name": "Email \u2194 iMessage Bridge (Blooio)",
  "tags": [
    {
      "id": "ApCZ67ZDQCOdgYND",
      "name": "submitted",
      "createdAt": "2026-05-18T04:04:59.119Z",
      "updatedAt": "2026-05-18T04:04:59.119Z"
    },
    {
      "id": "R25L37BmoyeSobRc",
      "name": "Review!",
      "createdAt": "2026-05-16T03:28:28.602Z",
      "updatedAt": "2026-05-16T03:28:28.602Z"
    }
  ],
  "nodes": [
    {
      "id": "011811a2-183f-463c-b234-97156fe7d4be",
      "name": "When Email Received",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        5200,
        2608
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4d49e783-b2e8-43ff-9b16-8d067d0b2c43",
      "name": "If Phone in Subject",
      "type": "n8n-nodes-base.if",
      "position": [
        5424,
        2608
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cond-phone-regex",
              "operator": {
                "type": "string",
                "operation": "regex"
              },
              "leftValue": "={{ $json.subject || $json.headers?.subject || \"\" }}",
              "rightValue": "\\+?\\d{10,15}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7ec6a16c-f07b-456b-96ee-01cedddb6f0c",
      "name": "Prepare iMessage Data",
      "type": "n8n-nodes-base.set",
      "position": [
        5648,
        2608
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f-phone",
              "name": "phoneNumber",
              "type": "string",
              "value": "={{ (($json.subject || '').match(/\\+?\\d{10,15}/)?.[0] || '').replace(/^(?!\\+)/, '+') }}"
            },
            {
              "id": "f-message",
              "name": "messageBody",
              "type": "string",
              "value": "={{ ($json.text || $json.body || $json.snippet || '').split(/\\n(?:On .+wrote:|---+ ?Original Message ?---+|>.+)/m)[0].replace(/<[^>]+>/g, '').trim() }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "6d924b82-2b94-4d21-9836-640043f58d74",
      "name": "Send iMessage via Blooio",
      "type": "n8n-nodes-blooio.blooioMessaging",
      "position": [
        5872,
        2608
      ],
      "parameters": {
        "to": "={{ $json.phoneNumber }}",
        "text": "={{ $json.messageBody }}",
        "attachments": [],
        "requestOptions": {}
      },
      "typeVersion": 1
    },
    {
      "id": "71b4647c-03ab-4018-b1cd-99e45b86da79",
      "name": "When iMessage Received",
      "type": "n8n-nodes-base.webhook",
      "position": [
        4976,
        3232
      ],
      "parameters": {
        "path": "imessage-email-inbound",
        "options": {
          "responseCode": {
            "values": {}
          },
          "noResponseBody": true
        },
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "fef5c5e1-03ca-4d95-88f1-2a169e641e23",
      "name": "If Inbound Message Event",
      "type": "n8n-nodes-base.if",
      "position": [
        5184,
        3232
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cond-event-received",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.body.event }}",
              "rightValue": "message.received"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0bd4bff1-d268-4aac-aaa7-e7ebefae5be6",
      "name": "Build Email From iMessage",
      "type": "n8n-nodes-base.set",
      "position": [
        5376,
        3232
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f-subject",
              "name": "subject",
              "type": "string",
              "value": "={{ \"iMessage from \" + ($json.body.from || $json.body.sender || $json.body.fromNumber || \"unknown\") }}"
            },
            {
              "id": "f-bodytext",
              "name": "bodyText",
              "type": "string",
              "value": "={{ $json.body.text || $json.body.message || $json.body.body || \"\" }}"
            },
            {
              "id": "f-fromnumber",
              "name": "fromNumber",
              "type": "string",
              "value": "={{ $json.body.from || $json.body.sender || $json.body.fromNumber || \"\" }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "b82b1a3a-c219-4182-acb8-efa3bd21844d",
      "name": "Send Email to Inbox",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5824,
        3056
      ],
      "parameters": {
        "sendTo": "<__USER_MAIN_INBOX__where iMessage notifications should land__>",
        "message": "={{ $json.bodyText }}",
        "options": {
          "replyTo": "<__BRIDGE_GMAIL_ADDRESS__bridge inbox e.g. bridge@yourgmail.com__>",
          "appendAttribution": false
        },
        "subject": "={{ $json.subject }}",
        "emailType": "text"
      },
      "typeVersion": 2.2
    },
    {
      "id": "93077b03-0bf6-43d1-91d2-4d7d78ec3ebf",
      "name": "Find Lead in Close by Phone",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        5664,
        3504
      ],
      "parameters": {
        "url": "={{ \"https://api.close.com/api/v1/lead/?query=phone:%22\" + encodeURIComponent($json.fromNumber) + \"%22&_fields=id,display_name,contacts\" }}",
        "options": {
          "timeout": 10000,
          "response": {
            "response": {}
          }
        },
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "e19f152f-5a68-4908-977e-3a3addbc2716",
      "name": "If Lead Found",
      "type": "n8n-nodes-base.if",
      "position": [
        5840,
        3504
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cond-lead-found",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data && $json.data.length > 0 ? \"yes\" : \"no\" }}",
              "rightValue": "yes"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f1cdd8b3-4c2b-4964-810e-6ca029a1fafd",
      "name": "Log iMessage to Close",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        6064,
        3504
      ],
      "parameters": {
        "url": "https://api.close.com/api/v1/activity/email/",
        "method": "POST",
        "options": {
          "timeout": 10000
        },
        "jsonBody": "={{ JSON.stringify({ lead_id: $json.data[0].id, direction: \"incoming\", status: \"inbox\", from: \"<__BRIDGE_GMAIL_ADDRESS__bridge inbox e.g. bridge@yourgmail.com__>\", to: [\"<__USER_MAIN_INBOX__where iMessage notifications should land__>\"], subject: $('Build Email From iMessage').item.json.subject, body_text: $('Build Email From iMessage').item.json.bodyText }) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "c5892b5f-a222-4f01-9a37-043e1802de18",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4192,
        2784
      ],
      "parameters": {
        "color": "#F7FDCE",
        "width": 672,
        "height": 528,
        "content": "## Email \u2194 iMessage Bridge (Blooio)\n\n### How it works\n\n1. Polls a bridge Gmail inbox for emails with a phone number in the subject.\n2. Sends the cleaned body as iMessage to that phone via Blooio.\n3. Forwards inbound iMessages back to the user's inbox, with Reply-To set so replies loop back.\n4. Logs the iMessage to the matching Close lead's timeline.\n\n### Setup steps\n\n- [ ] Connect a bridge Gmail credential to \"When Email Received\" and \"Send Email to Inbox\".\n- [ ] Connect a Blooio credential to \"Send iMessage via Blooio\" and register the webhook URL for message.received.\n- [ ] Connect a Close API credential to \"Find Lead in Close by Phone\" and \"Log iMessage to Close\".\n- [ ] Fill the inbox + bridge placeholders, send a test, then toggle Active.\n\n### Customization\n\n- Swap Close for any CRM by replacing the two HTTP Request nodes.\n- Add HMAC verification on the inbound webhook for production hardening\n\n\n## Learn more at [SMB Excel](https://www.smbexcel.com)"
      },
      "typeVersion": 1
    },
    {
      "id": "7afc7d76-0222-420f-acaa-4db173258691",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4912,
        2432
      ],
      "parameters": {
        "color": 7,
        "width": 1360,
        "height": 448,
        "content": "## Send outbound iMessage\n\nPolls the bridge Gmail inbox, validates the subject contains a phone number, cleans the message body, and sends it as iMessage via Blooio."
      },
      "typeVersion": 1
    },
    {
      "id": "6538885b-5783-481c-b8c0-96b6676f1339",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4912,
        2912
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 848,
        "content": "## Receive inbound iMessage\n\nReceives the Blooio webhook, filters to inbound message events, and builds an email payload from the iMessage."
      },
      "typeVersion": 1
    },
    {
      "id": "beb6e4b2-36b6-418e-b68e-8b2f1fde792b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5584,
        2912
      ],
      "parameters": {
        "color": 7,
        "width": 688,
        "height": 400,
        "content": "## Forward to email inbox\n\nSends the iMessage to the user's main inbox with Reply-To set back to the bridge \u2014 closing the bidirectional loop."
      },
      "typeVersion": 1
    },
    {
      "id": "f302de68-d931-4607-9338-1b0701625295",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5584,
        3328
      ],
      "parameters": {
        "color": 7,
        "width": 688,
        "height": 432,
        "content": "## Log to Close CRM\n\nLooks up the lead by phone in Close and logs the iMessage as an email activity on the lead's timeline."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": true,
    "executionOrder": "v1"
  },
  "versionId": "7848e526-ffb0-4e33-a32f-b1982946eb82",
  "connections": {
    "If Lead Found": {
      "main": [
        [
          {
            "node": "Log iMessage to Close",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Phone in Subject": {
      "main": [
        [
          {
            "node": "Prepare iMessage Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Email Received": {
      "main": [
        [
          {
            "node": "If Phone in Subject",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare iMessage Data": {
      "main": [
        [
          {
            "node": "Send iMessage via Blooio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When iMessage Received": {
      "main": [
        [
          {
            "node": "If Inbound Message Event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Inbound Message Event": {
      "main": [
        [
          {
            "node": "Build Email From iMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Email From iMessage": {
      "main": [
        [
          {
            "node": "Send Email to Inbox",
            "type": "main",
            "index": 0
          },
          {
            "node": "Find Lead in Close by Phone",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Lead in Close by Phone": {
      "main": [
        [
          {
            "node": "If Lead Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}