logo-darkPipe0
Examples

Qualify & Email

Enrich a LinkedIn profile, decide if the person is an ICP fit, and email the ones that are

This example takes a list of LinkedIn profile URLs and, in a single request:

  1. Enriches the full LinkedIn profile for each person (person:profile:waterfall@1).
  2. Uses an AI prompt to decide whether they are an ICP fit (prompt:run@1).
  3. For matches only, resolves a work email (person:workemail:profileurl:waterfall@1), drafts a personalised email (email:write@1), and sends it (email:send:gmail@1).

Steps 3–5 are gated with run_if, so non-matches never trigger an enrichment, a draft, or a send.

import { Pipe0 } from "@pipe0/client";

const pipe0 = new Pipe0({ apiKey: process.env.PIPE0_API_KEY });

const result = await pipe0.pipes.pipe({
  config: {
    environment: "production",
  },
  pipes: [
    {
      pipe_id: "person:profile:waterfall@1",
    },
    {
      pipe_id: "prompt:run@1",
      config: {
        model: "gemini-flash-latest",
        prompt: {
          template: `
You are qualifying a person against our Ideal Customer Profile (ICP).

[Our ICP]
Go-to-market, RevOps, or founder/leadership roles at B2B software companies that would
benefit from data enrichment (sales intelligence, prospecting, lead generation).

[The person]
{{ profile }}

[Output]
{% output is_icp_fit, type: "boolean", description: "true only if this person matches the ICP" %}
{% output reason, type: "string", description: "one short sentence justifying the decision" %}
          `,
        },
      },
    },
    {
      pipe_id: "person:workemail:profileurl:waterfall@1",
      run_if: {
        action: "run",
        when: {
          logic: "and",
          conditions: [
            {
              field_name: "is_icp_fit",
              property: "value",
              operator: "eq",
              value: true,
            },
          ],
        },
      },
    },
    {
      pipe_id: "email:write@1",
      run_if: {
        action: "run",
        when: {
          logic: "and",
          conditions: [
            {
              field_name: "is_icp_fit",
              property: "value",
              operator: "eq",
              value: true,
            },
          ],
        },
      },
      config: {
        model: "gemini-flash-latest",
        persona: "sales",
        template: `
Write a short, friendly outbound email introducing pipe0, an enrichment framework that helps
teams add data enrichment into their own products and go-to-market workflows.

Personalise it using what we know about the person:
{{ profile }}

Reason they are a good fit: {{ reason | default: "" }}

Keep it under 120 words and end with a soft call to action to book a quick call.
        `,
      },
    },
    {
      pipe_id: "email:send:gmail@1",
      run_if: {
        action: "run",
        when: {
          logic: "and",
          conditions: [
            {
              field_name: "is_icp_fit",
              property: "value",
              operator: "eq",
              value: true,
            },
            {
              field_name: "work_email",
              property: "status",
              operator: "eq",
              value: "completed",
            },
          ],
        },
      },
      connector: {
        strategy: "first",
        connections: [
          {
            type: "vault",
            connection: "<ADD_YOUR_GMAIL_CONNECTION>",
          },
        ],
      },
      config: {
        to: "{{ work_email }}",
        subject: "{{ email_subject }}",
        body: "{{ email_body }}",
      },
    },
  ],
  input: [
    {
      id: 1,
      profile_url: "https://www.linkedin.com/in/<HANDLE>",
    },
  ],
});
console.log(result);
import requests

response = requests.post(
    "https://api.pipe0.com/v1/pipes/run/sync",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "config": {
            "environment": "production",
        },
        "pipes": [
            {
                "pipe_id": "person:profile:waterfall@1",
            },
            {
                "pipe_id": "prompt:run@1",
                "config": {
                    "model": "gemini-flash-latest",
                    "prompt": {
                        "template": """
You are qualifying a person against our Ideal Customer Profile (ICP).

[Our ICP]
Go-to-market, RevOps, or founder/leadership roles at B2B software companies that would
benefit from data enrichment (sales intelligence, prospecting, lead generation).

[The person]
{{ profile }}

[Output]
{% output is_icp_fit, type: "boolean", description: "true only if this person matches the ICP" %}
{% output reason, type: "string", description: "one short sentence justifying the decision" %}
          """,
                    },
                },
            },
            {
                "pipe_id": "person:workemail:profileurl:waterfall@1",
                "run_if": {
                    "action": "run",
                    "when": {
                        "logic": "and",
                        "conditions": [
                            {
                                "field_name": "is_icp_fit",
                                "property": "value",
                                "operator": "eq",
                                "value": True,
                            },
                        ],
                    },
                },
            },
            {
                "pipe_id": "email:write@1",
                "run_if": {
                    "action": "run",
                    "when": {
                        "logic": "and",
                        "conditions": [
                            {
                                "field_name": "is_icp_fit",
                                "property": "value",
                                "operator": "eq",
                                "value": True,
                            },
                        ],
                    },
                },
                "config": {
                    "model": "gemini-flash-latest",
                    "persona": "sales",
                    "template": """
Write a short, friendly outbound email introducing pipe0, an enrichment framework that helps
teams add data enrichment into their own products and go-to-market workflows.

Personalise it using what we know about the person:
{{ profile }}

Reason they are a good fit: {{ reason | default: "" }}

Keep it under 120 words and end with a soft call to action to book a quick call.
        """,
                },
            },
            {
                "pipe_id": "email:send:gmail@1",
                "run_if": {
                    "action": "run",
                    "when": {
                        "logic": "and",
                        "conditions": [
                            {
                                "field_name": "is_icp_fit",
                                "property": "value",
                                "operator": "eq",
                                "value": True,
                            },
                            {
                                "field_name": "work_email",
                                "property": "status",
                                "operator": "eq",
                                "value": "completed",
                            },
                        ],
                    },
                },
                "connector": {
                    "strategy": "first",
                    "connections": [
                        {
                            "type": "vault",
                            "connection": "<ADD_YOUR_GMAIL_CONNECTION>",
                        },
                    ],
                },
                "config": {
                    "to": "{{ work_email }}",
                    "subject": "{{ email_subject }}",
                    "body": "{{ email_body }}",
                },
            },
        ],
        "input": [
            {
                "id": 1,
                "profile_url": "https://www.linkedin.com/in/<HANDLE>",
            },
        ],
    },
)
print(response.json())
curl -X POST "https://api.pipe0.com/v1/pipes/run/sync" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "config": {
    "environment": "production"
  },
  "pipes": [
    {
      "pipe_id": "person:profile:waterfall@1"
    },
    {
      "pipe_id": "prompt:run@1",
      "config": {
        "model": "gemini-flash-latest",
        "prompt": {
          "template": "\nYou are qualifying a person against our Ideal Customer Profile (ICP).\n\n[Our ICP]\nGo-to-market, RevOps, or founder/leadership roles at B2B software companies that would\nbenefit from data enrichment (sales intelligence, prospecting, lead generation).\n\n[The person]\n{{ profile }}\n\n[Output]\n{% output is_icp_fit, type: \"boolean\", description: \"true only if this person matches the ICP\" %}\n{% output reason, type: \"string\", description: \"one short sentence justifying the decision\" %}\n          "
        }
      }
    },
    {
      "pipe_id": "person:workemail:profileurl:waterfall@1",
      "run_if": {
        "action": "run",
        "when": {
          "logic": "and",
          "conditions": [
            {
              "field_name": "is_icp_fit",
              "property": "value",
              "operator": "eq",
              "value": true
            }
          ]
        }
      }
    },
    {
      "pipe_id": "email:write@1",
      "run_if": {
        "action": "run",
        "when": {
          "logic": "and",
          "conditions": [
            {
              "field_name": "is_icp_fit",
              "property": "value",
              "operator": "eq",
              "value": true
            }
          ]
        }
      },
      "config": {
        "model": "gemini-flash-latest",
        "persona": "sales",
        "template": "\nWrite a short, friendly outbound email introducing pipe0, an enrichment framework that helps\nteams add data enrichment into their own products and go-to-market workflows.\n\nPersonalise it using what we know about the person:\n{{ profile }}\n\nReason they are a good fit: {{ reason | default: \"\" }}\n\nKeep it under 120 words and end with a soft call to action to book a quick call.\n        "
      }
    },
    {
      "pipe_id": "email:send:gmail@1",
      "run_if": {
        "action": "run",
        "when": {
          "logic": "and",
          "conditions": [
            {
              "field_name": "is_icp_fit",
              "property": "value",
              "operator": "eq",
              "value": true
            },
            {
              "field_name": "work_email",
              "property": "status",
              "operator": "eq",
              "value": "completed"
            }
          ]
        }
      },
      "connector": {
        "strategy": "first",
        "connections": [
          {
            "type": "vault",
            "connection": "<ADD_YOUR_GMAIL_CONNECTION>"
          }
        ]
      },
      "config": {
        "to": "{{ work_email }}",
        "subject": "{{ email_subject }}",
        "body": "{{ email_body }}"
      }
    }
  ],
  "input": [
    {
      "id": 1,
      "profile_url": "https://www.linkedin.com/in/<HANDLE>"
    }
  ]
}'

A few things worth calling out:

  • person:profile:waterfall@1 outputs a profile object — the AI prompt and the email writer both reference it with {{ profile }}.
  • email:write@1 produces email_subject and email_body; the send pipe wires them into its templated subject and body config fields.
  • email:send:gmail@1 needs a Gmail connection from your vault. Replace <ADD_YOUR_GMAIL_CONNECTION> with your connection ID (see Connections).
  • Swap email:send:gmail@1 for email:send:resend@1 if you send through Resend instead — that pipe also takes a from address.