Android - Java mail - Gmail 'Mark as unread' & Inbox 'Snooze' - android

My homemade Android email client app, using Java mail, works fine with google mail service.
One use case for which I would like some piece of advice does concern the 'unread messages':
Whenever I 'Mark as unread' an email in mail.google.com, my mobile app update the email as 'unread' accordingly. Good.
Now I am using inbox.google.com and the 'Mark as unread' option is not present anymore.
As explained on the How Inbox works with Gmail page from Google, some actions are identical and other are similar.
About 'Mark As Unread' feature, it is not present anymore in 'Inbox'.
Instead, a 'snooze' option is replacing it:
In GMail (mail.google.com): 'Mark as Unread'
In Inbox (inbox.google.com): 'Snooze' (NOT identical to 'Mark as unread', but has 'similar' behavior)
Question:
How can I figure out, in my android java code, that a message is 'snoozed'?
I googled for it and checked GMail's extensions but could not find an answer.
Note:
I also checked Imap messages userFlags and systemFlags: nothing there :/
Thanks.

It looks like a lot of Inbox's features are implemented as a special kind of label: one that you can search for, but not one that appears as an actual Label or any sort of metadata in the Gmail API (or IMAP).
Try this (if you're an Inbox-by-Gmail user): open the Gmail web client, and enter label:snoozed in the search box. It should find all your snoozed messages. Also works for label:pinned, label:done, label:trips and label:purchases (Inbox smart bundles), label:lowpriority, etc. (Also try creating a new label with any of those names: they're all "reserved for system use.")
Even though they don't appear in the Gmail labels.list API, you can use these special Inbox label searches with the q (query) parameter in threads.list and messages.list.
So to figure out if a message is snoozed from your code, see if its message id appears in messages.list called with q=label:snoozed.
I don't see any way to add or remove these special Inbox labels on a message through the API, unless/until Google exposes them like other labels. (FWIW, the special Gmail Categories do appear in the API, e.g., "Updates" is a system label with id CATEGORY_UPDATES. So maybe there's hope things like "snoozed" make it into the API, too, as those Inbox features find their way into Gmail.)

Related

Create Message voice action for non en-us locales

I would like to know which are my posibilities as a developer to implements a send message voice action, in a messaging app (like a custom Telegram app), for spanish users. I want to implement the send new message action, I does not interested in replying to received messages (this is already implemented).
This is an example of I want to implements:
Create Message action
The user tells an utterance like "I would like to send a message with whatsapp".
A widget asks for a contact to send the message (if the user did not especificated one).
The app sends the message.
This is the same working example for spanish language: Create Message action (spanish)
I already know that there are built-in intents but the CREATE_MESSAGE built-in intent is only available for en-us locale. I also checked the custom intents but there are also only availables for en-us locale as I know. Which more options do I have?
PD: My final goal is to make the app compatible for Android Auto so I'm making it compatible with google assistant first.
Thanks in advance.
As you note, the actions.intent.CREATE_MESSAGE BII is only available in en-US right now. This is probably the best one, since it provides getting and sending a message without any additional work.
You may want to see if actions.intent.OPEN_APP_FEATURE will work for your needs. It has the downside that it does not have the fields available in CREATE_MESSAGE, but it might be a useful way to open the app.
However...
If you're planning on targeting Android Auto, that platform is even more restricted. If you're building an Android Auto app, you are limited to use only the actions.intent.GET_PARKING_FACILITY or actions.intent.GET_CHARGING_STATIONS BIIs. If you are willing to have it return a widget, you get a little more flexibility in what BIIs it accepts, but these don't let you send a message or open the app (even in en-US).

Does Facebook Messenger Bot provide information about the channel where the message was originated?

I'm having a problem with the lite version of messenger (android only)
This version of the application does not support bot messages with templates or buttons (including the get_started button)
In my case this is an example:
I could not find a parameter in the webhooks to provide the user's platform.
So I have to ask the user: do you use the lite version?
And then set a different flow.
But this means that I must also give the possibility to disable the lite mode when browsing from the web or from the non-lite application (to guarantee a better user experience)
Does Facebook Messenger Bot provide information about the channel where the message was originated ?
This information is not provided via webhook, currently. The closest you can get is detecting user agent in the webview.
A not ideal but doable option would be to have something like a 'Switch to Lite' button in the persistent menu
One way to identify where message event originates from is to use the payloads. You can specify a unique payload when setting up your bot and check what you receive to react on. get_started, persistent_menu, quick_replies have a payload field that you can set.
{
"get_started":{
"payload":"<GET_STARTED_PAYLOAD>"
}
}

HTML link for add contact to whatsapp

I need to put a deep link in my HTML for adding a contact to the Phone and then begin a new conversation in whatsapp.
I found this code
Send text to whatsapp
And this one:
Send text to user
I need to open a conversation with a specific contact even if I don't have the contact. My first question is, where can I get the username for whatsapp?
Having the abid I can try if it works but I dont know where to get that data.
Thanks a lot
Send Message
Without "+" or "00" at the beginning, just start country code and the number.
Example USA is +12025599025 then in the code given, replace NUMBER with 12025599025
this was worked for me:
whatsapp://send?text=MESSAGE&phone=+NUMERO&abid=+NUMERO
Obviusly "+NUMERO" is the wsp number and "MESSAGE" the preloaded message put in inhref` attribute
Recent solution (July 2017)
Malki's answer does solves the issue, but recently there's been published an official Whatsapp API I mentioned in THIS OTHER ANSWER (because S.O. policies I had to put a link to the solution, no duplicates).
This doesn't directly add the contact but allows you to open a copnversation with a concrete number, it can be very usefull to use it in your web sites. I've just found that it is possible to open a conversation to a number Using Click to Chat
To create your own link with a pre-filled message that will
automatically appear in the text field of a chat, use
https://wa.me/whatsappphonenumber/?text=urlencodedtext where
whatsappphonenumber is a full phone number in international format and
URL-encodedtext is the URL-encoded pre-filled message.
Example:https://wa.me/15551234567?text=I'm%20interested%20in%20your%20car%20for%20sale
NOTE: It opens WhastApp application if you click the link using a mobile phone browser (at least from Android)
The ABID (address book ID) is for an ID, not a name on your contact list.
In Whatsapp URL Scheme Documentation There are not (yet) documentation to send message to a specific contact.
The best way i found is to add the contact using this html code:
add number
(this will open Contacts app from your phone)
This is how you can create a link to send a WhatsApp message to a particular number.
Notice that you don't need to add the '+' symbol before the country -code. Just start with the country-code followed by the WhatsApp number:
Link Icon

Email dialog HTML ignores some tags Titanium Moblie

I'm currently building an app that has Email sending capabilities. I'm trying to send an Email with the relevant information and includes a link to the original post that is being sent. the original post is created as an HTML code segment, so I have to send the Email as an HTML. i create the Email dialog like this:
var mail = Ti.UI.createEmailDialog({
subject:'FW:'+post.desc,
html:true,
messageBody: '<br><br>view original post<br><br><b style="font-size:1.5em;font-family:Arial">'+post.desc+'</b><br><br><i>'+metaData.text.toString().replace(/\n/g,'<br>')+' </i><br><br>'+post.htmlData
});
Ti.API.debug(mail.messageBody)
mail.open();
when I ran the app on my device, I got the option of sending via "mail" or via "Gmail". when sent via "mail", all the link tabs and and were ignored and striped so the Email didn't include them. however, the "Gmail" option left everything as suppose to.
any thoughts?
the question was asked also in Titanium Q&A
Apparently, the default Email client for Android doesn't have a HTML renderer and disregards it, and the Gmail Android client won't parse certain tags like .
it seems to me like the answer will be using temporary files and attachments.
if anybody comes up with a better answer I'll be very happy.
happy X-mas | Hanukah | festivus for the rest of us

MAILTO Link in email to start a new email

I have a contact form on a website for customers to contact my company. Upon completing this form a correspondence is sent to the appropriate sales associate for that region. In this email it captures the information provided in the contact form the customer provided. More often than not the customer is requesting more information than what is available on our website.
I would like to include a MAILTO link in the email sent to the sales associate that would allow them a one click option to send additional documents/information/webpages not open to public traffic to customers requesting the information. Something along the lines of:
<a href="mailto:customer#email.com&subject=Information
Requested&body=Here's more information.
http://www.website.com/info/info.pdf">Send More Info</a>
I've tested this link and found it works perfectly in Outlook, Thunderbird and even GMail. But on mobile devices such as Android, iPhone or iPad the entire portion of the MAILTO string is put in the recipient line. I've tried URL encoding the link to something like:
<a href="mailto:customer#email.com&subject=Information
Requested&body=Here's more information.%0A%0A
http:%3A%2F%2Fwww.website.com%2Finfo%2Finfo.pdf">Send More Info</a>
But this doesn't seem to change anything at all as the desired result is still not achieved. The second link still works properly in other email client just not mobile devices. My searching has led me to only find articles about creating the MAILTO link in code specific for Android or iOS devices.
Any way to make this solution work in a normal email or webpage? Thanks!
Monday morning mistake on a Friday.
<a href="mailto:customer#email.com?subject=Information
Requested&body=Here's more information.
http://www.website.com/info/info.pdf">Send More Info</a>
Note the change of the question mark before the subject instead of an ampersand.
Yes, it's the ampersand. This works when using desktop email but when you switch to a mobile device it just causes it to be dumped into the "to:" line. Changing the ampersand to a question mark will make it work in both desktop and mobile environments.

Categories

Resources