I'd like to do the following with the Gmail-API.
Open a gmail message (Can do now)
Read the contents (Can do now)
Read the attachments (Can do now)
Update the message body (HOW TO DO?)
Remove the attachments and Update the existing email (HOW TO DO?)
My question is How to do the "HOW TO DO?" above.
The official documentation explains that you can only modify the labels of the message. You won't be able to update the message body. In any case, what you are required to do is to get the message data and save it, then delete the message and finally insert the message again with the attachments removed. I hope this information helps!
Related
I am looking for ways to slim my gmail account.
E.g. Is it possible to write a script that would do one of the following:
remove attachments from quoted text.
remove quoted text.
replace images in with links to high quality images on my G-drive.
perform an arbitrary text operation on previously received emai.
Note I don't want this to happen in the new email: I want do to this on whole folders (labels) of old mail. E.g. open the conversation thread from 2017 with the subject line, "Do you have swedish aspen" and replace each occurrence of 6 pix of SA with links?
You could use the API to get old messages, the thing is these messages if they contain attachments, or images, or whatever, they are base64encoded in your mail box.
Now what you are proposing is a kind of reconstruction of your mail box. A way to do something like that would be for example to:
Get all original messages using the Gmail API
Process them with your code
Use the insert method of Gmail API to insert the slimmed messages
Delete the originals using Gmail API
Note:
Using the insert message enables you to preserve the original dates of the messages.
References:
Users.messages: get
Users.messages: insert
Users.messages: delete
When using gmail API, history.list method we get "bare" message ids with no additional field from the fields in 'labelAdded', 'labelRemoved', 'messageAdded', 'messageRemoved'. Why is that? And is it possible that a new message has been added but when we use this method, the field messageAdded hasn't been used, so we receive it "bare" ?
According to the GMail history API, the list only contains the id and threadId fields.
It works this way because the objective of the history API is to provide you with the changes that happened in the mailbox, not its contents.
After you obtain the list from Users.history: list you need to call Users.messages: get or Users.messages: list to get the full messages.
If the messageAdded field is empty, it means that no new messages were added after the last historyId you examined. You might have skipped some. Make sure that every time you query the API you internally store the last historyId you processed so you can resume from that point in the future and not lose any changes.
I'd like to add a feature of adding a post to my blog-app that is built using React+Redux. Basically, I want a new post to consist of author's name, his text and a picture that you can attach to the post that you're going to create. I tried using input tag with type="file", but it returns a value with encrypted adress. How do I go about getting a picture from someone's device?
When trying to use the Dialog tool to get a feel for how the APIs work, I ran into a problem where a POST to /conversation creates a new conversation, instead of continuing an existing one. I am using the docs found at : http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/dialog/api/v1/
An initial POST returns a conversation and client id, but subsequent requests with those values added, along with an input value, just return information for a new conversation. Are these docs inaccurate?
Here is a screenshot from one of my many attempts at getting this to work. The client and connection IDs are from a previous POST to /conversation
http://imgur.com/4035dWe
Thanks for your help!
Your first call to Converse you should not specify the conversation ID. Dialog will return a conversation ID with the first response.
You then use that ID going forward to maintain the conversation. It is unclear if you are doing this in the example above.
It turns out I was using the incorrect encoding for the conversation / client ID's and input. Watson expects the form values to be URL encoded. Once I made that change, the problem was resolved.
Thanks to everyone who offered their time and help!
QBO raises the error code 2250 "You must fill out at least one split line". Why does it need to pass a line for deleting an invoice? Should it just require invoice.id?
For whatever bizarre reason, the Intuit v3 "delete" call requires that you pass the entire invoice object to the delete call in order to delete an invoice.
It's weird, yes. Unfortunately, it's also the way the API works and is required.
You can see this documented here:
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/010_calling_data_services/060_delete
Quoting:
The request body includes the full payload of the object as returned in a read response.
I figured a hack way without submitting the entire object. It accepts an empty line and sync token along with the invoice id.