Is there a way to get the current label name/id of a selected Mail? - google-apps-script

I was wondering if its possible to get the current label name/id of the label the user selected in gmail.
I can get all labels a mail thread has, but I want to figure out which label the user currently looks at.
Maybe there is also a posiibility to parse the url of gmail in google app script? I know there is server side and client side but I dont have any other idea...
Thanks for your help
Anne

Google Workspace doesn't have a feature to retrieve what email or label a user is currently looking at in their Gmail. This request can be promoted for future development through the Google Workspace Feature Ideas Community.
What you can do with the Gmail API is list the messages in the user's mailbox and list all labels in the user's mailbox.

Related

Finding Gmail Snooze dates in API

Is it possible to access the date of a Gmail snooze through the API? I came accross a hack in stackoverflow that allows users to search for which emails are snoozed via a secret label search “label:snoozed”, but lables dont normally have an associated date, especially one that will return to the inbox in the future.
Im trying to create a web routine that syncs a todo list with emails and want to the due date to automatically update with when the snoozed email will re-appear.
Is this possible with any API or developer resources google offers?
No, you can’t retrieve the date of a Gmail snooze using the API.
There is a Feature Request already reported for this behavior on Issue tracker:
https://issuetracker.google.com/issues/109952618
At the moment you can only list them and retrieve the messages that has this label ‘snoozed’ active on them:
GET https://www.googleapis.com/gmail/v1/users/me/messages?q=label%3Asnoozed

How to send a custom email when google form is submitted?

I have a google form, what I want is everytime a user submits form it will email to everyone#company.com, with the content let's say:
<img src="image.jpg" />
<p>Hi everyone, I am {{form_field1}}</p>
I found an add-on "Email Notifications for Forms", and it's working, the problem is, its only limited 20 email notifications per day.
Does anyone knows here how to send email notification for free? I think its possible to use the "Script editor", but I don't know the syntax how to do this.
let's try cross platform.
if you use a Line app, you can create a BOT with an Apps Script based webhook.
Use that Messaging API, push to your id or group and feel free to get notif

In a Gmail add-on is there a reliable way to work with an individually selected message within the conversation?

We're looking into building a Gmail add-on to replace our Gmail contextual gadget and trying to work out a way to provide equivalent features.
Because a contextual gadget is displayed underneath each message in a conversation we used this to display contact details and allow storing a copy of specific messages within a conversation.
For Gmail add-ons the add-on is passed a messsageId in the event object and sometimes the add-on will refresh with a new messageId when clicking or expanding messages in the conversation. However, this does not appear to be consistent and there doesn't appear a clearly explicit action to select a "current" message in a conversation that the add-on should act upon.
In the documentation messageId is described as as the "message ID of the thread open in the Gmail UI so it's not clear if this is meant to refer to a specific message or the overall conversation.
We also took a look at the Android Gmail app and the add-ons only appear to be accessible when scrolling down to the end of the conversation, so similarly I'm unsure if an add-on can be triggered for specific messages in the mobile UI?
We looked at the Trello add-on as an example. This allows creating a Trello card using the first few words from an email message as the description for the card and we noted that the description would sometimes update to reflect a different message in the conversation when clicking the headings or body of messages in the conversation, but again not consistently.
Can anyone from the Gmail add-ons team advise if what we're seeing are just some quirks that are being worked on, or if we're approaching the add-on design with the wrong model in mind and shouldn't be developing around the concept of individual messages in the conversation?

Programmatically Share Editing Rights of Google Site using a Google Form (Semi-Public Wiki)

I have an existing (classic) Google Site that I would like to be a semi-public wiki. Google seems to have explicitly disallowed public wikis in the new version of sites, so I'm trying to find a work-around of sorts.
Here's my ideal flow:
1. Guest visits my Google site "Foo Wiki" and clicks a link to become a contributor.
2. Link goes to my Google Form "Registration Form" that just asks for
a name and email address.
3. Form submission creates a new line in a google sheet "Registration List".
4. "Registration List" has a script that emails the user's given email address
giving them editing rights to "Foo Wiki"
Is this possible?
I have the easy parts (1-3) done, but not sure how to go about step 4.
I think you can easily get this done using the addEditor() api.
Kindly check this out https://developers.google.com/apps-script/reference/sites/site#addEditor(User)
Actually it was even easier than I thought! I sent a second edit invite by email to another email address I had and copied the invite acceptance link to be on my site.

user email in About service

I need to get the user email when I get document permissions. I have seen this problem here
value attribute for Permissions Resource not populated in responses
but in about service does not appear my email. I need it because I have a service account and my application need know the user email. I want to avoid call to profile service.
Is this possible? from where I can get the user email?
Thanks.
As you rightly say, you will have to make a call to the profile service. In some ways it is better like this, because it separates the concerns of the Drive API and the Profile API, and can use specific scoping to let the user know exactly what they are authorizing your app to do.