This topic was automatically generated from Slack. You can find the original thread here.
Gmail → Create Draft is not working with the BCC field
This topic was automatically generated from Slack. You can find the original thread here.
Gmail → Create Draft is not working with the BCC field
It sounds like you’re having trouble using the BCC field with the Gmail → Create Draft action in Pipedream. Currently, based on the Create Draft action documentation, the action only mentions support for the “To”, “Subject”, and “Email Body” fields. There is no mention of a BCC (blind carbon copy) field in the available configuration for this action. What this means: - The built-in “Create Draft” action does not support specifying BCC recipients at this time. - If you need to include BCC recipients, you would need to use a custom code step to call the Gmail API directly and specify the BCC field in the message payload. Next steps: - If you want to request BCC support in the built-in action, you can submit a feature request to Pipedream at New Pipedream Integration Request. - If you’d like, I can help you write a custom code step that creates a draft with BCC recipients using the Gmail API. Would you like a code example for creating a Gmail draft with BCC using a custom code step? Let me know!
It is an optional field.
It’s correct that the BCC field is optional when creating a Gmail draft, but the built-in Gmail → Create Draft action in Pipedream may not expose a BCC field in its UI. If you need to include BCC recipients, you’ll need to create the draft using a custom code step that calls the Gmail API directly. Below is a Pipedream component example that creates a Gmail draft with optional BCC support: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { gmail: { type: "app", app: "gmail", }, to: { type: "string", label: "To", description: "Recipient email address(es), comma-separated", }, subject: { type: "string", label: "Subject", }, body: { type: "string", label: "Email Body", }, bcc: { type: "string", label: "BCC", description: "BCC email address(es), comma-separated (optional)", optional: true, }, }, async run({ steps, $ }) { // Build the raw email message let email = `To: ${[this.to](http://this.to)}\r\n`; if (this.bcc) { email += `Bcc: ${this.bcc}\r\n`; } email += `Subject: ${this.subject}\r\n`; email += `Content-Type: text/plain; charset="UTF-8"\r\n\r\n`; email += this.body; // Base64 encode the email (URL-safe) const encodedMessage = Buffer.from(email) .toString("base64") .replace(/\+/g, "-") .replace(/\//g, "_") .replace(/=+$/, ""); const data = { message: { raw: encodedMessage, }, }; const resp = await axios($, { method: "POST", url: "https://gmail.googleapis.com/gmail/v1/users/me/drafts", headers: { Authorization: `Bearer ${this.gmail.$auth.oauth_access_token}`, "Content-Type": "application/json", }, data, }); return resp; }, }); How to use: 1. Add this code as a Node.js code step in your workflow. 2. Fill in the to, subject, body, and (optionally) bcc fields. 3. The draft will be created with the BCC field included if provided. If you continue to have issues or need more help, please visit Support - Pipedream for more support options.