https://linen.dev logo
Is there a way I can uniquely identify the request...
# 🖥│support-forum
d
I am using the
GMAIL_CREATE_EMAIL_DRAFT
tool. In the
before_execute
hook, I send data such as subject, to, and body to the frontend — essentially the input metadata for the draft. In the
after_execute
hook, I want to send back the draft_id and message_id, which are returned by the Gmail API after the draft is created. However, there’s a problem: if
GMAIL_CREATE_EMAIL_DRAFT
is called multiple times, there’s currently no reliable way to identify which
draft_id
and
message_id
belong to which specific draft request. In other words, there’s no persistent identifier connecting the
before_execute
and
after_execute
hooks for the same tool execution. So is there a way to handle this scenario?
a
Hey there, I can suggest a few ways to handle the Issue. You can use
GMAIL_FETCH_MESSAGE_BY_MESSAGE_ID
or
GMAIL_FETCH_MESSAGE_BY_THREAD_ID
to fetch the information regarding the thread and process it accordingly. —  Alternatively, you can modify the afterExecute to replace the keys with custom for each draft (renaming
threadId
to be something like
Draft1Id1
) or append custom value to each Id to identify the threadId(ex:
1Dftavsadvy243r
will be
D1_1Dftavsadvy243r
). — Let me know if this helps your query! I've attached an Image with both the suggested afterExecute options for your reference: https://cdn.discordapp.com/attachments/1425520026768642243/1425528215459594300/Screenshot_2025-10-08_at_22.22.59.png?ex=68e7ea1b&is=68e6989b&hm=aaf5aadf0defb3a58413ee4f497e70ad9cb29c8116085ee4ca57ba4b9316872a&
d
I guess first option will work as of now. But this is a workaround and I have to make extra api call to handle such scenarios. I hope composio allow developers to send unique identifier that we can receive in
after_execute
. Thank you
a
You can still go with the second option and add/append your own unique identifier.