How do I determine which contact a timeline item was shared to? - google-mirror-api

I am writing an app using the mirror api and I need to be able to share an image that gets associated on the server side with a specific user. I inserted two contacts via my glassware and I can share images to each contact. On the server end I get something back like this but there is no reference to the contact id that it was shared to?
{
u'itemId': u'e2de58b4-e281-4518-8312-948159167be8', # id to image?
u'userToken': u'6b037418-9a7d-4137-943e-2b857f960a80', # user who shared?
u'operation': u'INSERT',
u'collection': u'timeline',
u'userActions': [{u'type': u'SHARE'}]
}

When you request the timeline item with the specified itemId with a timeline.get request, the item will have a recipients property that includes information about which contact it has been shared with, and an attachments property with information about the shared photo itself.
See the according documentation here: https://developers.google.com/glass/subscriptions#shared_picture

Related

How to write a complex reference to objects in email templates for Salesforce

I need to create a reference in an email template. for that I need to reffer a standard Contact objecect. For that I have a Custom Object Email Info, that has a lokup to standard Accounts.
So in the email I have to have value of the custom field Email_info__c from the custom object Email_info__c(the object and it's field have the same API names) while entering the Contact.
In the end both Contacts and my custom object have the lookups to Account, but not to each other, and there is no lookup from Acount, for now.
My first guess was to refer to the first child object Email info in the header of the VF template
relatedToType="Email_Info__c"
and then refer to it in the body as
{!RelatedTo.Account_r}
but then I would need a lookup from Accounts to Email Info to be able to refer deeper
{!RelatedTo.Account_r.Email_Info__r.Email_Info__c}
but, I don't think that it'll work that way or that it meets the needed criteria. Can someone share if there is an option at all to get the Email Info to Contacts through Accounts without creating a lookup on Accounts?
The task is to have a middle referred object, not a direct lookup:
It depends a bit how you are going to use this email template. What will the send be triggered from. Account? Contact? Email Info record? Will it be fired from a workflow or user will be instructed to navigate to account record and start composing the message?
If your relatedTo is really Email_Info__c then you don't have to do anything, you have all the data hidden in {!relatedTo.Id}, {!relatedTo.Name}, {!relatedTo.Email_Info__c} (you said the field name is same as object's name)
If your email starts from "Account" and you can guarantee accounts will have 1 email info record on related list - something like this might work:
<messaging:emailTemplate subject="hi stack" recipientType="Contact" relatedToType="Account">
<messaging:plainTextEmailBody >
{!relatedTo.Opportunities[0].Id} {!relatedTo.Opportunities[0].Name} {!relatedTo.Opportunities[0].StageName} {!relatedTo.Opportunities[0].CloseDate}
</messaging:plainTextEmailBody>
</messaging:emailTemplate>
from Account (relatedTo) I'm going down to the related list of Opportunities, I'm picking 1st one (at random... but if you have just 1 record it'll be fine) and display whatever I want.
If your relatedTo and recipient both have to be Contact it starts to get bit messier, normal visualforce syntax will not allow you to go "up" (from Contact to Account) and then "down" (from Account to related list of email infos)
You'd need to start with something like https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_email_templates_with_apex.htm and then figure out how to pass the Id of account to it and run a query for email infos related to this account. https://salesforce.stackexchange.com/questions/245930/pass-id-from-visualforce-email-template-to-controller might be a good start, poke me if you're stuck.

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 ]%%

Different views for different users in reactJS

I am having a problem in ReactJS. I want to create a text editor ( with ReactQuill). So, I want different accounts for each user, such that, if one person creates a note and edits it in his account, the other person should not see this.for example this is my current stage - https://wright-text.web.app. After you create your account and login you would see a note called first note because that's the note I created. What should I do so that when you login you see no notes because you have not created a note, but when I login, I should see the note I had already created. How would I do this ??
You need to add a scope to notes endpoint so that user could only GET notes, which they have created.
You need to add query parameters in the API you are fetching. For example, if you are fetching data via a GET request, add in some specific user id that you assign to your user upon validation and then fetch data of a particular user using that id as a query parameter on your API.

Redrawing endpoints using jsPlumb

I have been stuck with this a few days and want your help to know how to tackle this problem.
I created this application something like a flowchart to draw different types of plumb items with different endpoints attached to them. After it is being created as an element the endpoints are added dynamically according to the type of plumb item. is it like the following.
This is how I create the plumb items.
var element = document.createElement("div");
element.setAttribute("id",schema_id);
element.setAttribute("class","item " +control.Type);
element.setAttribute("style","left:" +posX + "px ; top: "+posY+"px");
var output = document.getElementById('container');
output.appendChild(element);
And then I add the endpoints according to its type.
jsPlumb.addEndpoint(element,<the style goes here>,{ anchor:<the location of the endpoint goes here>, uuid: <a new ID is created for this>});
And this is what it looks like
Screen One
I managed to grabbed the data from the method "GetConnections" and get it saved in the DB as a JSON. This JSON includes all the IDs which are for plumb items and all the endpoints.
But when I try to retrieve it back again to the UI, it appears like this. Everything appears great except the endpoints.
Screen Two
On redraw, the endpoints are created in the same way mentioned above. To reconnect the endpoints I am using this code.
jsPlumb.connect({ source:<source id>, target:<target id>,anchors:<location of the endpoint>,<style>);
The problem :
For the above code, Although I give the UUID of the endpoint to the source and target, it doesn't identify it as endpoints to connect from and to.
Is there a way to find the ID and get them connected? What I found out was that only the plumb items could be searched with "getElementById" with the UUID but not the endpoints.
The problem is how to make these endpoints get connected as originally drawn. How can connect each endpoint back again? I have all the IDs and when they are redrawn they are having the same IDs as it had when it was saved. But I couldn't find a way to connect the endpoints back again separately since this has different types of endpoints specific to each plumb item.
Any suggestions?
Sorry for the long post
Thank you in advance!!
Please see the connect method
If you connect ids, or elements, or Endpoints use
jsPlumb.connect({source:<source id>, target:<target id>});
but if you connect array of UUIDs of the two Endpoints use
jsPlumb.connect({uuids:<array of uuids>});

How to get Google Glass location change notification inside my Glassware

Could you please guide me how doing this. I have to get used location changes and have to send some information depend on that location.
See https://developers.google.com/glass/location and https://developers.google.com/glass/v1/reference/locations for complete information about using Locations with Google Glass.
Keep in mind that you need to request the additional scope https://www.googleapis.com/auth/glass.location in order to get any location information.
Once you have done this, Glass will attach the most recently known location (usually where you have been sometime in the past 10 minutes) to any timeline items reported to you.
At any time you can get a list of location updates available, or the "latest" location available from Glass. Additionally, you can subscribe to the "locations" collection (see https://developers.google.com/glass/v1/reference/subscriptions) and you will receive a location change notice roughly every 10 minutes which includes an ID to fetch the associated location.
We can insert subscription for location changes when a user subscribes our Glassware application. After that mirror API will notifies location changes to given url.
Like this
//create a Subscription for location changes
Subscription subscriptionLocation = new Subscription()
{
Collection = "locations",
UserToken = userId,
CallbackUrl = Url.Action("Notify", "Notify", null, Request.Url.Scheme)
};
//insert a Subscription
mirrorService.Subscriptions.Insert(subscriptionLocation).Fetch();

Resources