How to Update a Relation Type Notion Property Using the Title of a Related Notion Card?

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

How can I update a relation type Notion property based on the title of the notion card from the related notion database using the title of the card?

To update a relation type Notion property based on the title of a Notion card from the related Notion database, you’ll need to follow these steps: 1. Search for the Notion app from the step menu. 2. Select the Update Page action. 3. Connect your Notion account. 4. Select a Parent Database ID or pass a string from a previous step. 5. Select a Page ID or pass a string from a previous step. 6. At the bottom of the step, click Test to run the action and test the configuration. Here’s an example of how you can achieve this using a Pipedream component: ``` import { axios } from “@pipedream/platform”; export default defineComponent({ props: { notion: { type: “app”, app: “notion”, }, parentDatabaseId: { type: “string”, label: “Parent Database ID”, }, pageId: { type: “string”, label: “Page ID”, }, relationDatabaseId: { type: “string”, label: “Relation Database ID”, }, title: { type: “string”, label: “Title of the Related Card”, }, }, async run({ steps, $ }) { // Fetch the related page based on the title const searchResponse = await axios($, { url: https://api.notion.com/v1/databases/${this.relationDatabaseId}/query, method: “POST”, headers: { Authorization: Bearer ${this.notion.$auth.oauth_access_token}, “Notion-Version”: 2021-08-16, }, data: { filter: { property: “Name”, title: { equals: this.title, }, }, }, }); const relatedPageId = searchResponse.results[0]?.id; if (!relatedPageId) { throw new Error(No related page found with title: ${this.title}); } // Update the relation property of the target page const updateResponse = await axios($, { url: https://api.notion.com/v1/pages/${this.pageId}, method: “PATCH”, headers: { Authorization: Bearer ${this.notion.$auth.oauth_access_token},

how can I pull the Posthog profile link of a person using their email address

To pull the PostHog profile link of a person using their email address, you will need to use the PostHog API to search for the user by their email and then retrieve their profile link. Below is an example Pipedream component that demonstrates how to achieve this: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { posthog: { type: "app", app: "posthog", }, email: { type: "string", label: "Email Address", }, }, async run({ steps, $ }) { // Search for the user by email const response = await axios($, { url: `https://app.posthog.com/api/persons/`, headers: { Authorization: `Bearer ${this.posthog.$auth.api_key}`, }, params: { email: this.email, }, }); // Assuming the response contains the user data const user = response.results.find(person => person.properties.email === this.email); if (user) { // Construct the profile link const profileLink = `https://app.posthog.com/person/${user.id}`; return { profileLink }; } else { $.flow.exit("User not found"); } }, }); ### Explanation: 1. Props: - posthog: This allows the user to connect their PostHog account. - email: This is the email address of the person whose profile link you want to retrieve. 2. API Request: - The component makes a GET request to the PostHog API to search for users. - It includes the email address as a query parameter to filter the results. 3. Response Handling: - The code searches the response for a user with the matching email address. - If a user is found, it constructs the profile link using the user’s ID. - If no user is found, it exits the workflow with a message. ### Using the PostHog Action To use this component: 1. Search for the “PostHog” app in the Pipedream UI. 2. Search for the component you created or use the code above to create a new one. 3. Configure the component with your PostHog API key and the email address you want to search for. For more details

I want to get the UUID of a person on posthog using their email address

To get the UUID of a person on PostHog using their email address, you can use the PostHog API to search for the person by their email. Below is an example Pipedream component that performs this task: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { posthog: { type: "app", app: "posthog", }, email: { type: "string", label: "Email Address", }, }, async run({ steps, $ }) { const response = await axios($, { url: `https://app.posthog.com/api/person/`, headers: { Authorization: `Bearer ${this.posthog.$auth.api_key}`, }, params: { email: this.email, }, }); if (response.results && response.results.length > 0) { const person = response.results[0]; return { uuid: person.uuid, }; } else { return { message: "Person not found", }; } }, }); ### Explanation: 1. Props: The component takes two props: posthog for the PostHog app and email for the email address of the person you want to find. 2. Axios Request: The axios request is made to the PostHog API endpoint to search for a person by their email. 3. Response Handling: If the person is found, their UUID is returned. Otherwise, a message indicating that the person was not found is returned. You can use this component in your Pipedream workflow to get the UUID of a person on PostHog using their email address.

I want to get the ID of a person on posthog using their email address

To get the ID of a person on PostHog using their email address, you can use the PostHog API to search for the user by their email. Below is a Pipedream component that demonstrates how to achieve this: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { posthog: { type: "app", app: "posthog", }, email: { type: "string", label: "Email Address", }, }, async run({ steps, $ }) { const response = await axios($, { url: `https://app.posthog.com/api/projects/@current/persons/`, headers: { Authorization: `Bearer ${this.posthog.$auth.api_key}`, }, params: { email: this.email, }, }); const person = response.results.find(person => person.properties.email === this.email); if (person) { return person.id; } else { $.flow.exit("Person not found"); } }, }); ### Explanation: 1. Props: - posthog: This prop allows the user to connect their PostHog account. - email: This prop allows the user to input the email address of the person they want to find. 2. API Request: - The axios request is made to the PostHog API endpoint for retrieving persons. - The Authorization header includes the API key from the PostHog app connection. - The params object includes the email address to filter the persons. 3. Finding the Person: - The response is filtered to find the person with the matching email address. - If found, the person’s ID is returned. If not, the workflow exits with a message. You can use this component in your Pipedream workflow to get the ID of a person on PostHog using their email address.