Getting the Contact Email from a Website

When you have a bunch of URLs from which you need to extract email addresses (especially when sending product introductions to potential customers).

Using a webhook, accept two parameters: name (company name) and url (company website). Retrieve the contact email from the website (if available) and record it in Notion. If there are multiple emails, create multiple rows.

Template Url: https://cloud.activepieces.com/zh/flows/zSSfc7XrH9mEkIBlzNxLc

1 Like

Hey Johnny,
I tried viewing your flow, but for some reason it brings me to a blank screen.

Why did you delete?
Come on Johnny

Sorry, I just find that the JSON contains my database ID and other information. I have removed it.

{
  "created": "1718761861858",
  "updated": "1718761861858",
  "name": "Get email by url",
  "description": "",
  "tags": [],
  "pieces": [
    "@activepieces/piece-webhook",
    "@activepieces/piece-notion",
    "@activepieces/piece-http",
    "@activepieces/piece-text-helper"
  ],
  "template": {
    "displayName": "Get email by url",
    "trigger": {
      "name": "trigger",
      "valid": true,
      "displayName": "Catch Webhook",
      "type": "PIECE_TRIGGER",
      "settings": {
        "pieceName": "@activepieces/piece-webhook",
        "pieceVersion": "~0.1.4",
        "pieceType": "OFFICIAL",
        "packageType": "REGISTRY",
        "triggerName": "catch_webhook",
        "input": {
          "authType": "none",
          "authFields": {}
        },
        "inputUiInfo": {}
      },
      "nextAction": {
        "name": "step_2",
        "type": "PIECE",
        "valid": true,
        "settings": {
          "input": {
            "auth": "{{connections['notion']}}",
            "database_id": "",
            "filterDatabaseFields": {
              "URL": "{{trigger['body']['payload'][0]['url']}}"
            }
          },
          "pieceName": "@activepieces/piece-notion",
          "pieceType": "OFFICIAL",
          "actionName": "notion-find-database-item",
          "inputUiInfo": {},
          "packageType": "REGISTRY",
          "pieceVersion": "~0.2.15",
          "errorHandlingOptions": {
            "retryOnFailure": {
              "value": false
            },
            "continueOnFailure": {
              "value": false
            }
          }
        },
        "nextAction": {
          "name": "step_3",
          "type": "BRANCH",
          "valid": true,
          "settings": {
            "conditions": [
              [
                {
                  "operator": "BOOLEAN_IS_FALSE",
                  "firstValue": "{{step_2['success']}}"
                }
              ]
            ],
            "inputUiInfo": {}
          },
          "displayName": "No duplicates",
          "onSuccessAction": {
            "name": "step_4",
            "type": "PIECE",
            "valid": true,
            "settings": {
              "input": {
                "url": "{{trigger['body']['payload'][0]['url']}}",
                "body": {},
                "method": "GET",
                "headers": {},
                "failsafe": true,
                "body_type": "none",
                "use_proxy": false,
                "queryParams": {},
                "proxy_settings": {}
              },
              "pieceName": "@activepieces/piece-http",
              "pieceType": "OFFICIAL",
              "actionName": "send_request",
              "inputUiInfo": {},
              "packageType": "REGISTRY",
              "pieceVersion": "~0.4.4",
              "errorHandlingOptions": {
                "retryOnFailure": {
                  "value": true
                }
              }
            },
            "nextAction": {
              "name": "step_5",
              "type": "PIECE",
              "valid": true,
              "settings": {
                "input": {
                  "text": "{{step_4['body']}}",
                  "expression": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}"
                },
                "pieceName": "@activepieces/piece-text-helper",
                "pieceType": "OFFICIAL",
                "actionName": "find",
                "inputUiInfo": {},
                "packageType": "REGISTRY",
                "pieceVersion": "~0.2.0",
                "errorHandlingOptions": {
                  "retryOnFailure": {
                    "value": false
                  },
                  "continueOnFailure": {
                    "value": false
                  }
                }
              },
              "nextAction": {
                "name": "step_9",
                "type": "BRANCH",
                "valid": true,
                "settings": {
                  "conditions": [
                    [
                      {
                        "operator": "EXISTS",
                        "firstValue": "{{step_5}}"
                      }
                    ]
                  ],
                  "inputUiInfo": {}
                },
                "displayName": "Determine if there is an email",
                "onFailureAction": {
                  "name": "step_8",
                  "type": "PIECE",
                  "valid": true,
                  "settings": {
                    "input": {
                      "auth": "{{connections['notion']}}",
                      "database_id": "",
                      "databaseFields": {
                        "URL": "{{trigger['body']['payload'][0]['url']}}",
                        "Name": "{{trigger['body']['payload'][0]['name']}}"
                      }
                    },
                    "pieceName": "@activepieces/piece-notion",
                    "pieceType": "OFFICIAL",
                    "actionName": "create_database_item",
                    "inputUiInfo": {},
                    "packageType": "REGISTRY",
                    "pieceVersion": "~0.2.15",
                    "errorHandlingOptions": {
                      "retryOnFailure": {
                        "value": false
                      },
                      "continueOnFailure": {
                        "value": false
                      }
                    }
                  },
                  "displayName": "Create Database Item Copy"
                },
                "onSuccessAction": {
                  "name": "step_6",
                  "type": "LOOP_ON_ITEMS",
                  "valid": true,
                  "settings": {
                    "items": "{{step_5}}",
                    "inputUiInfo": {}
                  },
                  "displayName": "Loop through emails",
                  "firstLoopAction": {
                    "name": "step_1",
                    "type": "PIECE",
                    "valid": true,
                    "settings": {
                      "input": {
                        "auth": "{{connections['notion']}}",
                        "database_id": "",
                        "databaseFields": {
                          "URL": "{{trigger['body']['payload'][0]['url']}}",
                          "Name": "{{trigger['body']['payload'][0]['name']}}",
                          "Email": "{{step_6['item']}}"
                        }
                      },
                      "pieceName": "@activepieces/piece-notion",
                      "pieceType": "OFFICIAL",
                      "actionName": "create_database_item",
                      "inputUiInfo": {},
                      "packageType": "REGISTRY",
                      "pieceVersion": "~0.2.15",
                      "errorHandlingOptions": {
                        "retryOnFailure": {
                          "value": false
                        },
                        "continueOnFailure": {
                          "value": false
                        }
                      }
                    },
                    "displayName": "Create Database Item"
                  }
                }
              },
              "displayName": "Get email"
            },
            "displayName": "Access webpage"
          }
        },
        "displayName": "Confirm no duplicate rows through URL"
      }
    },
    "valid": true
  },
  "blogUrl": ""
}

Oh!
I completely understand
Can you explain the flow?
Sorry, Iā€™m a newbie
Am I to understand that this scrapes URLs inside a Notion file for exposed emails on the websites?

It can be understood this way, but I trigger this process through a webhook. You need to pass two parameters: url and name. You can change it to periodically fetch the URL and obtain the email from Notion.