Does the gmail api allow editing of existing email? - gmail-api

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

Related

Using ID's from previous request in new request

I have used Postman to extract a number of ID's from a request. Now I would like to use those ID's in a new series of requests using Postman. I can't figure out how to do this, does anyone know?
There are several hundreds of ID's and below are some examples that I can see in the console (but they do not appear in the request Body)
(100) [373894, 373893, 373467, 373459, 372712, …]
0: 373894
1: 373893
2: 373467
3: 373459
I would like to use postman to send new requests for all these ID's where I would like to fill the brackets with the ID's in the request URL that now looks like this:
https://app.rule.io/api/v2/campaigns/{{}}/statistics
I've tested the ID's one at a time and they work fine but I would like to run them all to then collect the data and send it to Google Data Studio. (background is that I'm trying to send campaign data from an e-mail marketing tool into Google Data Studio and combine it with website data)
Postman is able to run user-defined test scripts after the call performed. So you could define an array variable, add an ID each time you obtain it. And then, use that array variable to make a call with the whole bunch of IDs you have.
Take a look this blog: https://blog.postman.com/extracting-data-from-responses-and-chaining-requests/

Low resolution Email Preview in Salesforce for marketing cloud connect emails

Question about Marketing Cloud Connect - In case of Individual Email Result in Salesforce, an email preview is sent from MC to SF object along with a thumbnail preview of the email template (as base64 encoded image). This thumbnail has two problems.
a. isn’t clear enough for the sales agent to see what was sent to customer
b. can’t find what offer percentage was given to customer as the preview has ampscript value instead of actual value.
There is no way to change the default configs of MCC to increase the thumbnail size. To solve this and improve the image resolution, I’ve thought of below solutions. Is there any other possible way that you’ve done?
From customer send log, take ‘view_email_url’ and get the html using a visual force page and remove all the ‘https://click…xx.com/’ links to ensure click/ open counts aren’t impacted. Downside - # of api calls to make are higher
For every email, create a jpg preview of the email template and store it in MC and store this in SF in a custom object as ‘EmailName vs EmailPreviewUrl’. And, whenever a marketer creates a new email, they have to ensure that they create a jpg copy in MC and update associated record in Saleforce custom object. Downside - sales agent will not know what % of offer is given to customer (ps - % of offer is decided in MC automation based on raw order information we’ve about this customer). To manage this downside, we can send the offer details of each customer to SF using updateSingleSalesforceObject method everytime an email is sent. To do this, all the campaigns should be standardized to some extend.
Any other thoughts? is there any configs that I can flip to increase the image size?
To answer this question, we ended up creating a cloudpage code resource (similar to API) that returns the complete HTML of 'view_email_url' (aka view as web page) for a given email + Subscriber + datesent + BU. We used SSJS to query sendLog DE using these inputs to figure out the view_email_url value. To avoid counting view_email_url opens to tracking opens, we wrapped the open counter pixel inside a context variable - something like below.
%%[
IF _messagecontext != 'VAWP' THEN
]%%
<custom name="opencounter" type="tracking" />
%%[ ENDIF ]%%

Why does gmail API when using history.list method send message ids without the field what action has been preformed on them?

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.

How Remove Gmail Attachments In Place Without Deleting Email?

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!

Veeva Salesforce uploading presentation

maybe this is not a good quetion posted on this site, but I am trying to upload a presentation to SalesForce (https://test.salesforce.com/). I understand that at first I have to create "Key messages" which represent each slides in the presentation, then I create new CLM presentation and select presentation slides.
But then I am stucked. Is this everything to uploading the presentation or I have to migrate the presentation somewhere, upload somewhere else using FTP, etc.
I hope my question is understandable (because my English is not very good).
Thanks for help.
AFAIK, follow these steps to upload a presentation with single slide..
Create a Key message and upload the media (zip file). (Simply give key message name and upload proper well-formed zip)
Create a Presentation Slide (Just slide name)
Now, create a CLM Presentation, in which you need to browse and select the above 2 objects against their respective fields.
That's it on salesforce.
Now sync iRep app on device/iPad and it should come down in "Media".
Try this,
1.Create a new presentation
2.Go to CLM Key Messages tab and here, before creating a new key message you might need to create a new view("Create New View" link button) to group these key messages(at least that's how I do it).
Here you need to make sure that the filter method is set correctly otherwise I won't be able to see those key messages attached to this view.
So you can set sth like this(on step 2):
Field | Operator | Value
Message | contains | slide_prefix
On step 3 you need to add "Message" in "Selected fields" Tab
3.Now create a "New CLM Message" and make sure that it has "slide_prefix" on his name composition(Ex: if slide_prefix is "EXSlide" then clm message should be named like: EXSlide myslide01 or EXSlide_slide01)
4.After creating CLM key message you will be redirected to his info page where you need to upload the ".zip" file.
5.Last step is to create "New Presentation Slide"(On the bottom of the page). Here you need to input the Presentation(presentation name created on step 1), key message name(you can search for them) and a display order
Now sync the ipad and it should appear.
In addition to sTx answer, you can take a look at the "Veeva Content Creation Guidelines" (Link below). This will fit most of your developer needs.
Veeva Content Creation Guidelines
Keep in mind that often client groups have special region codes and labeling rules (see also: sTx answer to "Prefix" rules), that you have to follow, to match users and contents in a global account. If you dont, nothing will appear on the iPad. Example: yourID + Language + Country (YourID_ENG_UK.zip)
Also companys often split thier environment in two, a sandbox and a production section - Make sure you have the permission to see sandbox contents. For this purpose, activate the "Training Content" checkbox on the presentation object, to see your presentation without a migration.
All contents you create in the backend are by default visible to you on the iPad. Check the "Config" > "Media" list and look for your Zips files; if they get downloaded.

Resources