How to Create a Scoring Automation in Notion?

This topic was automatically generated from Slack. You can find the original thread here.

I need to create a scoring automation in Notion

To create a scoring automation in Notion using Pipedream, you’ll need to set up a workflow with the appropriate triggers and actions. Here’s a general outline of how you can achieve this: 1. Determine the Trigger: Decide what event in Notion should trigger the scoring automation. For example, you might want to trigger the automation when a new page is added to a database. You can use the “New Page in Database” trigger for this purpose. 2. Set Up the Trigger: - In Pipedream, search for the Notion app in the trigger menu. - Select the “New Page in Database” trigger. - Connect your Notion account. - Choose the relevant database or pass a string from a previous step to specify the database. 3. Define the Scoring Logic: After the trigger, you’ll need to define the logic for scoring. This could involve evaluating certain properties of the Notion page and assigning a score based on your criteria. 4. Update the Notion Page: Once the score is calculated, you can update the Notion page with the score. This can be done using a Pipedream action that interacts with the Notion API to update the page. 5. Test the Workflow: Make sure to test your workflow by generating test events in Notion to ensure that the scoring automation works as expected. If you need help with specific code or further details on setting up the actions, please provide more information about your scoring criteria and how you want the score to be reflected in Notion.

I’m looking to automate a step in our CRM database in Notion where we score individuals based on the domains of their email addresses using Pipedream. I would like to know if there’s a feasible way to accomplish this, and if so, how to implement it. Here are the specifics of what I’m looking for:

  1. CRM Database in Notion: We have a database in Notion where each person’s information includes their email address.
  2. Domain List: I have a predefined list of email domains, and each domain is associated with a specific score. For example:
    example.com: 10
    sample.org: 20
    test.net: 5
  3. Scoring Mechanism: The score of each person should be based on the domain part of their email addresses. For instance, if a person’s email is john.doe@example.com, they should be given a score of 10 based on the domain example.com.
  4. Integration Tool – Pipedream: I wish to utilize Pipedream to automate this process. Pipedream should automatically update the score in the Notion database whenever a new entry is added or an existing entry is updated.
    Can you provide step-by-step guidance on how to set this up using Pipedream? Specifically, I would need:
    • Detailed steps on configuring Pipedream to fetch data from the Notion database.
    • Instructions on setting up the scoring mechanism based on email domains.
    • Steps to update the Notion database with the calculated scores.
    • Any best practices or potential pitfalls to watch out for.
    Additionally, if there are any particular tools or API endpoints I should be aware of when setting up this automation in Pipedream, please include that information.
    Thank you for your assistance!

To automate scoring individuals based on their email domains in a Notion CRM database using Pipedream, follow these steps: ### Step 1: Configure Pipedream to Fetch Data from Notion 1. Create a New Workflow: Start by creating a new workflow in Pipedream. 2. Trigger Setup: Use a Notion trigger to detect when a new entry is added or an existing entry is updated in your Notion database. You can search for the Notion app in the Pipedream UI and select a trigger like “New Database Item” or “Updated Database Item”. 3. Connect Notion: Connect your Notion account to Pipedream. This will allow Pipedream to access your Notion database. You will need to authorize Pipedream to access your Notion workspace. ### Step 2: Set Up the Scoring Mechanism 1. Define the Domain List: In your Pipedream workflow, define a JavaScript object that maps email domains to scores. For example: const domainScores = { "[example.com](http://example.com)": 10, "[sample.org](http://sample.org)": 20, "[test.net](http://test.net)": 5, }; 2. Extract Domain and Calculate Score: Add a code step in your workflow to extract the domain from the email address and calculate the score. Here’s an example code snippet: ```
export default defineComponent({ async run({ steps, $ }) { const email = steps.trigger.event.email; // Replace with the correct path to the email field const domain = email.split(‘@’)[1]; const score = domainScores[domain] || 0; // Default to 0 if domain not found return { score }; }, });