Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attaching Gmail draft to a thread using the threadId parameter #8194

Closed
wants to merge 0 commits into from

Conversation

Nicolas-nwb
Copy link
Contributor

Summary

This pull request solves an issue where drafts created via the Gmail API were not properly attached to an existing thread. Previously, drafts were created independently, without any connection to ongoing conversations. With this update, by passing the thread ID (threadId) during the creation of the draft, the draft is now correctly attached to the specified thread.

Related tickets and issues

Add Thread ID to gMail node Draft Resource

To test

  1. Retrieve the ID of an existing thread in Gmail.
  2. Use this ID in your request to create a draft.
  3. Check if the draft appears in the specified thread in Gmail.

Tests

A pre-built image with this functionality is available here : neoroth/n8n:custom-base
The functionality has been tested manually.
n8n threadId
gmail draft

Review / Merge checklist

  • PR title and summary are descriptive. Remember, the title automatically goes into the changelog. Use (no-changelog) otherwise. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.

    A bug is not considered fixed, unless a test is added to prevent it from happening again.
    A feature is not complete without tests.

@CLAassistant
Copy link

CLAassistant commented Jan 1, 2024

CLA assistant check
All committers have signed the CLA.

@n8n-assistant n8n-assistant bot added community Authored by a community member node/improvement New feature or request labels Jan 1, 2024
@Joffcom
Copy link
Member

Joffcom commented Jan 2, 2024

Hey @Nicolas-nwb,

On it's own the initial PR looked to be great but the alias feature that has been added in as well will need some testing to work out if we need to change anything when it comes to using service accounts.

@Nicolas-nwb
Copy link
Contributor Author

@Joffcom Thank you for watching. Sorry, this is my first contribution to an open source project on Github.
I wanted to submit the Alias feature at a later time and I didn't think it would interfere with the first PR. I probably should have sent the changes directly to a branch to avoid this.

Indeed, I have not taken into account or tested the alias functionality with service accounts.
If there is something I can do, do not hesitate.

@zhengyishen0
Copy link

@Joffcom Thank you for watching. Sorry, this is my first contribution to an open source project on Github. I wanted to submit the Alias feature at a later time and I didn't think it would interfere with the first PR. I probably should have sent the changes directly to a branch to avoid this.

Indeed, I have not taken into account or tested the alias functionality with service accounts. If there is something I can do, do not hesitate.

Hey @Nicolas-nwb,

The thread draft feature you developed is amazing. Would you consider submitting this standalone feature again while you're working on the alias feature?

@Nicolas-nwb
Copy link
Contributor Author

The thread draft feature you developed is amazing. Would you consider submitting this standalone feature again while you're working on the alias feature?

Thank you @zhengyishen0.
I use these two draft and alias features daily and it's a real pleasure.

This is my first contribution on Github and I'm not sure if I understood how to submit the two features separately.

I thought my work was done and that the merge required a final approval from a community member.

Since I don't have a Gmail service account, I can't verify the functionality of the alias feature.

I would like my request to be merged, but I don't know what I need to do to move things forward.

@russkiimike
Copy link

russkiimike commented Feb 3, 2024

Oh man, the thread draft feature is a must! THANK YOU! Was surprised it's not available initially. Would love standalone to be added to the main soon so people don't have to fork :( @Nicolas-nwb P.S Is there anyway to do it through a code node in the meantime ?

@Nicolas-nwb
Copy link
Contributor Author

@russkiimike In the meantime, I am using this custom public image neoroth/n8n:base which integrates the functionality of drafts in Gmail threads as well as the ability to select the sender's address if you have multiple sending accounts. Custom neoroth/n8n:base image
I will continue to regularly update this image while waiting for the changes to be integrated.

@zhengyishen0
Copy link

zhengyishen0 commented Feb 3, 2024 via email

@russkiimike
Copy link

russkiimike commented Feb 4, 2024

@russkiimike In the meantime, I am using this custom public image neoroth/n8n:base which integrates the functionality of drafts in Gmail threads as well as the ability to select the sender's address if you have multiple sending accounts. Custom neoroth/n8n:base image I will continue to regularly update this image while waiting for the changes to be integrated.

@Nicolas-nwb Is there a way to access it as a node ? Cause reinstalling the whole system is tricky. OR via request node ? I am trying to figure out if it's enough to just POST the following to drafts ? Added the same subject to the email body and base64 encoded as per docs but it just seems to create a blank draft, not attached to threadID

{
"message": 
{
"raw": "{{ $json.emailRaw }}",
"threadId": "thread_id"
}
} 

@Joffcom
Copy link
Member

Joffcom commented Feb 5, 2024

This could be merged this week if the alias part was removed and added as a different PR, We like to keep the PRs specific to what they are doing to make it easier to track down where issues come from.

@russkiimike
Copy link

This could be merged this week if the alias part was removed and added as a different PR, We like to keep the PRs specific to what they are doing to make it easier to track down where issues come from.

@Nicolas-nwb Can you split the PR's please ?

@Nicolas-nwb
Copy link
Contributor Author

Hello,

I'm sorry, but unfortunately I still don't know how to split the PRs. I'm also very busy this week and won't have time to look into it. If someone is available to help me, that would be greatly appreciated. Otherwise, I will look into it next week as soon as I have a moment.

Thank you very much for your understanding.

Sincerely,

@russkiimike
Copy link

Hello,

I'm sorry, but unfortunately I still don't know how to split the PRs. I'm also very busy this week and won't have time to look into it. If someone is available to help me, that would be greatly appreciated. Otherwise, I will look into it next week as soon as I have a moment.

Thank you very much for your understanding.

Sincerely,

Oh Cool @Joffcom @Nicolas-nwb Does this mean it's been approved ? Just needs a docker update ?

@Nicolas-nwb
Copy link
Contributor Author

There, I believe I have managed to split the 2 PRs. I did it as quickly as possible and I hope it was not done at the expense of quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Authored by a community member node/improvement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants