This topic was automatically generated from Slack. You can find the original thread here.
Hey all,
This feels like a dumb question, but I just can’t figure it out.
I’ve created a Google Doc in my workflow, appended all the information to the doc and it works great.
Now I want to send an email that contains a share link to that doc, which I’m trying to do in a Gmail step.
But how do I get the share link for the Google Doc I created within the workflow?
It appears there was an issue with retrieving the specific question you wanted to ask. Could you please provide more details or clarify your question so I can assist you accordingly?
This feels like a dumb question, but I just can’t figure it out.
I’ve created a Google Doc in my workflow, appended all the information to the doc and it works great.
Now I want to send an email that contains a share link to that doc, which I’m trying to do in a Gmail step.
But how do I get the share link for the Google Doc I created within the workflow?
To share a Google Doc created within a Pipedream workflow and send the share link via Gmail, you’ll need to follow a two-step process. First, you’ll need to set the sharing settings for the Google Doc to generate a shareable link. Then, you can use the Gmail step to send an email containing this link. Unfortunately, the specific steps to programmatically set sharing settings for a Google Doc and retrieve its shareable link are not directly covered in the provided documentation. However, I can guide you through a general approach using Google Drive API and then sending the link via Gmail. ### Step 1: Set Sharing Settings and Get Share Link 1. Use the Google Drive API to update the permissions of the Google Doc to make it shareable. You’ll likely use the permissions.create method of the Drive API for this purpose. You’ll need to specify the file ID of the Google Doc and the desired permission settings (e.g., viewer, commenter, or editor) and the type of access (e.g., anyone with the link). 2. Once the permissions are set, you can generate a shareable link. The link format typically looks like this: https://docs.google.com/document/d/{documentId}/edit, where {documentId} is replaced with the ID of your Google Doc. ### Step 2: Send the Share Link via Gmail After obtaining the share link, you can use a Gmail step in your Pipedream workflow to send an email containing this link. Here’s a simplified example of how you might send an email with the Gmail component: ``` import { axios } from “@pipedream/platform” export default defineComponent({ props: { gmail: { type: “app”, app: “gmail”, }, }, async run({ steps, $ }) { const documentId = “YOUR_DOCUMENT_ID”; // Replace with your Google Doc ID const shareLink = https://docs.google.com/document/d/${documentId}/edit; const emailBody = Here is the link to the document: ${shareLink}; return await axios($, { method: “POST”, url: https://gmail.googleapis.com/gmail/v1/users/me/messages/send, headers: { Authorization: Bearer ${this.gmail.$auth.oauth_access_token}, }, data: { raw: btoa(`To: recipient@example.com\nSubject: Google Doc Share
To share a file using Google Drive on Pipedream, you can indeed use the pre-built action available in Pipedream’s Google Drive integration. The action you’re referring to, “Add File Sharing Preference,” allows you to modify the sharing settings of a specific file in your Google Drive. ### Using the Google Drive (action) To use this action in your Pipedream workflow: 1. Go to the Pipedream UI and create a new workflow. 2. In your workflow, click the + button to add a new step. 3. Search for Google Drive and select it. 4. From the list of available actions for Google Drive, search for and select Add File Sharing Preference. 5. You will need to connect your Google Drive account if you haven’t done so already. 6. Configure the action by specifying the File ID of the file you want to share and the sharing preferences you wish to apply. This action will modify the sharing settings of the specified file according to your configuration. For example, you can set the file to be viewable or editable by users with the link, or specific users you invite. Remember, for any specific configurations or options available in this action, you should refer to the action’s documentation directly in the Pipedream UI, as it will provide the most up-to-date and detailed information on how to use it effectively. If you need further assistance or have more detailed questions about configuring this action, please visit Pipedream’s support page.