Certainly! Here’s how you can configure props for a Gmail “New Email Received” trigger in a Pipedream workflow so that you can pass and utilize a custom token, external user ID, and workflow ID. — ## 1. Defining Custom Props in the Trigger When you create a custom trigger (or clone an existing one), you can add custom props to accept values like customToken
, externalUserId
, and workflowId
. Here’s an example of how you might define these props in a custom component: export default defineComponent({ props: { gmail: { type: "app", app: "gmail", }, customToken: { type: "string", label: "Custom Token", description: "A custom token to use in the workflow", }, externalUserId: { type: "string", label: "External User ID", description: "The external user ID to associate with this workflow", }, workflowId: { type: "string", label: "Workflow ID", description: "The workflow ID for tracking", }, }, async run({ steps, $ }) { // You can now use these props in your workflow $.export("customToken", this.customToken); $.export("externalUserId", this.externalUserId); $.export("workflowId", this.workflowId); // Example: Get Gmail user info const { axios } = require("@pipedream/platform"); const userInfo = await axios($, { url: `https://www.googleapis.com/oauth2/v1/userinfo`, headers: { Authorization: `Bearer ${this.gmail.$auth.oauth_access_token}`, }, }); return { userInfo, customToken: this.customToken, externalUserId: this.externalUserId, workflowId: this.workflowId, }; }, });
— ## 2. Passing Props When Deploying the Workflow When you deploy or instantiate the workflow (e.g., via API or UI), you can set these props. For example, via the REST API: on { "project_id": "proj_abc123", "org_id": "o_abc123", "template_id": "tch_abc123", "triggers": [ { "props": { "customToken": "my-secret-token", "externalUserId": "user-123", "workflowId": "wf-456" } } ] }
— ## 3. Using Props in Workflow Steps In subsequent steps of your workflow, you can reference these props via steps.trigger.event.customToken
, steps.trigger.event.externalUserId
, etc. Example code step: ```
export default defineComponent({ async run({ steps, $ }) { const customToken = steps.trigger.event.customToken; const externalUserId = steps.trigger.event.externalUserId; const workflowId = steps.trigger.event.workflowId; // Use these values as needed return { customToken, externalUserId, workflowId, }; }, });