Gmail Reply Error: Invalid thread_id value

Hello!

How is it possible to reply to a message on Gmail? I’m trying to enter the message-id in In Reply To but it’s not giving me the error: Invalid thread_id value

Does anyone have a solution for this, or something alternative to replying to a thread within Gmail?

Hi @marcos,

To reply to a message on Gmail using Pipedream, you can use the “Send Email” action and include the threadId parameter to ensure the email is sent as a reply within the thread. Here’s how you can do it:

  1. Search for the Gmail app from the step menu.
  2. Select the Send Email action.
  3. Connect your Gmail account.
  4. Select one or more To or pass an array of strings from a previous step.
  5. Select a Subject or pass a string from a previous step.
  6. Select an Email Body or pass any from a previous step.
  7. Add the threadId parameter to ensure the email is part of the existing thread.

Here is an example of how you can set up the Send Email action with the threadId:

import { axios } from "@pipedream/platform";

export default defineComponent({
  props: {
    gmail: {
      type: "app",
      app: "gmail",
    },
    to: {
      type: "string[]",
      label: "To",
    },
    subject: {
      type: "string",
      label: "Subject",
    },
    body: {
      type: "string",
      label: "Email Body",
    },
    threadId: {
      type: "string",
      label: "Thread ID",
      optional: true,
    },
  },
  async run({ steps, $ }) {
    const data = {
      to: this.to,
      subject: this.subject,
      body: this.body,
    };

    if (this.threadId) {
      data.threadId = this.threadId;
    }

    return await axios($, {
      method: "POST",
      url: "https://www.googleapis.com/gmail/v1/users/me/messages/send",
      headers: {
        Authorization: `Bearer ${this.gmail.$auth.oauth_access_token}`,
      },
      data,
    });
  },
});

Steps to use the component:

  1. Search for the Gmail app in the Pipedream UI.
  2. Select the “Send Email” action.
  3. Connect your Gmail account.
  4. Fill in the required fields (To, Subject, Email Body).
  5. Optionally, provide the threadId to reply within a thread.

I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double-check my answers and code! Learn how to build your own.

Same issue here.

No matter the input, the ‘in-reply-to’ functionality does not work.

Thanks for reporting, tracking here: [BUG] Gmail Invalid thread_id · Issue #15223 · PipedreamHQ/pipedream · GitHub