Google Markup not seen in e-mail - google-schemas

I test send markups with Google scripts and works find,
if send the same template via Google SMTP from my Gmail account to my Gmail account the ld+json don't see.
My template is:
<!DOCTYPE html>
<html>
<head>
<title>Prenotazine TiPrenota</title>
<meta charset="UTF-8">
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "EventReservation",
"reservationNumber": "5aa46b79-140d-491e-a1db-568ec1c423bd",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "Savio Capannini"
},
"reservationFor": {
"#type": "Event",
"name": "SAN MARINO ADVENTURES SRL - COE 21269",
"startDate": "2017-03-27T12:30:00",
"location": {
"#type": "Place",
"name": "SAN MARINO ADVENTURES SRL - COE 21269",
"address": {
"#type": "PostalAddress",
"streetAddress": "San Marino Adventure Parco Montecerreto, San Marino (RSM)"
},
"geo": {
"#type": "GeoCoordinates",
"latitude": "44,490501",
"longitude": "12,281881"
}
},
"performer":"Reservation"
},
"modifyReservationUrl": "https://www.mysite.it/?token=5aa46b79-140d-491e-a1db-568ec1c423bd"
}
</script>
</head>
<body>
Testo emeil
</body>
</html>
Do I need a G Suite account to try this?
Why the markup is not seen?
Where is the problem?
Pleas help!
Thks.

You may refer with this SO post. Make sure that you registered with Google before you send emails to other users properly. Also, be noted that Emails must be authenticated via DKIM or SPF. If you're using Google SMTP relay, you have to use an SPF record looking like this: v=spf1 include:_spf.google.com ~all.
Here's another thread which might help: Gmail Email Markup not Working

Related

Azure Logic App: Read telemetry data as dynamic content from IoT hub message

I'm routing telemetry messages via IoT Events and event Grid to Logic Apps using a webhook. The logic app lets you input a sample JSON message and then use dynamic content to add information to an email alert I'm sending(O365: Send an Email V2)
I can include System Properties like "iothub-connection-device-id" But when I try to pick temeletry data I get the following error:
InvalidTemplate. Unable to process template language expressions in action 'Send_an_email_(V2)' inputs at line '1' and column '1680': 'The template language expression 'items('For_each')?['data']?['body']?['windingTemp1']' cannot be evaluated because property 'windingTemp1' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'.
When I look at the raw output of the webhook connector it shows the following message but the telemetry points are cleary not there. I'd expect to see them in the "body" property but instead there is just the string: "eyJ3aW5kaW5nVGVtcDEiOjg2LjYzOTYxNzk4MjYxODMzLCJ3aW5kaW5nVGVtcDIiOjc4LjQ1MDc4NTgwMjQyMTUyLCJ3aW5kaW5nVGVtcDMiOjg1LjUzMDYxMDY5OTQ1MzY1LCJMb2FkQSI6MjAyOS44NDgyMTg4ODYxMTEsIkxvYWRCIjoyMDQwLjgxMDk4OTg0MDMzMzgsIkxvYWRWIjoyMDA0LjYxMTkzMjMyNTQ2MTgsIk9pbFRlbXAiOjk5LjA2MjMyNjU2MTY4ODU4fQ=="
Looking for help to determine what could be causing this and how to get the telemetry data passed through correctly so that I can inculde it dynamically in the email alert.
Thanks!
{
"headers": {
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip,deflate",
"Host": "prod-24.northeurope.logic.azure.com",
"aeg-subscription-name": "TEMPALERT",
"aeg-delivery-count": "1",
"aeg-data-version": "",
"aeg-metadata-version": "1",
"aeg-event-type": "Notification",
"Content-Length": "1017",
"Content-Type": "application/json; charset=utf-8"
},
"body": [
{
"id": "c767fb91-3806-324c-ec3c-XXXXXXXXXX",
"topic": "/SUBSCRIPTIONS/XXXXXXXXXXXX",
"subject": "devices/Device-001",
"eventType": "Microsoft.Devices.DeviceTelemetry",
"data": {
"properties": {
"TempAlarm": "true"
},
"systemProperties": {
"iothub-connection-device-id": "Device-001",
"iothub-connection-auth-method": "{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}",
"iothub-connection-auth-generation-id": "637264713410XXXX",
"iothub-enqueuedtime": "2020-06-01T23:05:58.3130000Z",
"iothub-message-source": "Telemetry"
},
"body": "eyJ3aW5kaW5nVGVtcDEiOjg2LjYzOTYxNzk4MjYxODMzLCJ3aW5kaW5nVGVtcDIiOjc4LjQ1MDc4NTgwMjQyMTUyLCJ3aW5kaW5nVGVtcDMiOjg1LjUzMDYxMDY5OTQ1MzY1LCJMb2FkQSI6MjAyOS44NDgyMTg4ODYxMTEsIkxvYWRCIjoyMDQwLjgxMDk4OTg0MDMzMzgsIkxvYWRWIjoyMDA0LjYxMTkzMjMyNTQ2MTgsIk9pbFRlbXAiOjk5LjA2MjMyNjU2MTY4ODU4fQ=="
},
"dataVersion": "",
"metadataVersion": "1",
"eventTime": "2020-06-01T23:05:58.313Z"
}
]
}
Here is the sample input I am using with the trigger:
[{
"id": "9af86784-8d40-fe2g-8b2a-bab65e106785",
"topic": "/SUBSCRIPTIONS/<subscription ID>/RESOURCEGROUPS/<resource group name>/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/<hub name>",
"subject": "devices/LogicAppTestDevice",
"eventType": "Microsoft.Devices.DeviceTelemetry",
"eventTime": "2019-01-07T20:58:30.48Z",
"data": {
"body": {
"windingTemp1": 95.62818310718433
},
"properties": {
"Status": "Active"
},
"systemProperties": {
"iothub-content-type": "application/json",
"iothub-content-encoding": "utf-8",
"iothub-connection-device-id": "d1",
"iothub-connection-auth-method": "{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}",
"iothub-connection-auth-generation-id": "123455432199234570",
"iothub-enqueuedtime": "2019-01-07T20:58:30.48Z",
"iothub-message-source": "Telemetry"
}
},
"dataVersion": "",
"metadataVersion": "1"
}]
Summary comment to answer to help others who have same problem.
The body you provided is Base64 encoded, you can decode it with Convert.FromBase64String(String) Method.
byte[] newBytes = Convert.FromBase64String(body);
For more details, you could refer to this issue.
Update:
Add the following code in my application will solve the problem.
message.ContentEncoding = "utf-8";
message.ContentType = "application/json";

clear google spreadsheet data using http

I have try to clear spreadsheet using http request.
Below is my http request
https://sheets.googleapis.com/v4/spreadsheets/spresheetId/values/B2:B10?key=APIKEY
but json return below error
{
"error": {
"code": 403,
"message": "Requests from referer \u003cempty\u003e are blocked.",
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API key",
"url": "https://console.developers.google.com/project/562822880211/apiui/credential"
}
]
}
]
}
}
so how can i clear my spreadsheet using http
When you deploy as a webapp you'll get a url that looks something like this: https://script.google.com/macros/s/.../exec add a querystring to it so it looks like this: https://script.google.com/macros/s/.../exec?ssid=spreadsheetid only replace spreadsheetid for the real spreadsheet id.
This is the gs file:
function clearSpreadSheet()
{
var ssid=PropertiesService.getScriptProperties().getProperty('SSID');
var ss=SpreadsheetApp.openById(ssid);
var allSheets=ss.getSheets();
for(var i=0;i<allSheets.length;i++)
{
allSheets[i].clear();//clear all
//allSheets[i].getRange(2,1,sheet.getLastRow(),sheet.getLastColumn()).clear();//everything but first row.
}
return{'clearMessage':'Spreadsheet has been cleared.','ssid':ssid}
}
function doGet(e)
{
PropertiesService.getScriptProperties().setProperty('SSID', e.parameter.ssid)
var html = HtmlService.createHtmlOutputFromFile('clearss');
return html.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
}
This is the clearss.html file:
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(function() {
google.script.run
.withSuccessHandler(dispCleared)
.clearSpreadSheet();//runs when DOM is loaded
});
function dispCleared(data)//runs after spreadsheet is cleared via the SuccessHandler
{
$('#clrd').text(data.clearMessage);
$('#ssid').text('SpreadSheet ID is ' + data.ssid);
}
console.log('My Code');
</script>
</head>
<body>
<h1 id="clrd"></h1>
<h2 id="ssid"></h2>
</body>
</html>
This is a contained web app. So load these files into the script editor of a spreadsheet.

Custom menu in TFS web access (TFS 15)

I tried these steps and i created a sample extension similar to this site https://www.visualstudio.com/en-us/docs/integrate/extensions/get-started/node .
But i need to pass parameter to the site which i am opening using this new extension. Is it possible ?
Parameters like : project name , environment(TFS URL) where the TFS is running.
And i am facing an error when trying to open a page in an MVC application hosted on IIS internally, the application uses Durandal ,Knockout and HTML 5 for the UI.
Not able attach the screen shot pasting the part of new extension script
"icons": {
},
"contributions": [
{
"id": "Fabrikam.HelloWorld",
"type": "ms.vss-web.hub",
"description": "Adds a 'Hello' hub to the Work hub group.",
"targets": [
"ms.vss-work-web.work-hub-group"
],
"properties": {
"name": "Hello Testing",
"order": 99,
"uri": "http://test-server/AdminConsole2015Beta/#/tfsreports/boc_projects/ALM/alm-beta-app1/0"
}
}
],
"scopes": [
"vso.work"
],
"files": [
{
"path": "tfsReports.html", "addressable": true
},
{
"path": "scripts", "addressable": true
},
{
"path": "sdk/scripts", "addressable": true
}
]
}
In the above script i want to open the URL in the URI property which opens the page tfsreports.html after routing using durandal. Is that possible here? See screen shot for refrence
Update your extension to below:
In the manifest file, update the "uri" of the "contributions" to "tfsReports.html".
"properties": {
"name": "Hello Testing",
"order": 99,
"uri": "tfsReports.html"
}
Add followings content in "tfsReports.html":
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello World</title>
<script src="sdk/scripts/VSS.SDK.js"></script>
</head>
<body>
<script type="text/javascript">VSS.init();</script>
<h1>Hello World</h1>
<script type="text/javascript">
VSS.init();
VSS.ready(function () {
var webContext = VSS.getWebContext();
var projectname = webContext.project.name;
var TFSUrl = webContext.collection.uri;
var reportFrame = document.getElementById("reportFrame");
var finalurl = "http://test-server/AdminConsole2015Beta/#/tfsreports/boc_projects/ALM/alm-beta-app1/0/" + projectname + "/" + TFSUrl;
reportFrame.src = finalurl;
VSS.notifyLoadSucceeded();
});
</script>
<div id="tfsreport">
<iframe id="reportFrame" style="width:100%" frameborder="0"></iframe>
</div>
</body>
</html>

How does google NOW parses E-Mail's, to generate NOW notifications - cards

How can I change the E-Mail header settings in the emails sent by a train company - e.g. Deutsche Bahn, so the mail receiver with Google now enabled would get a now card.
It works great with Amazon and flight bookings, but there seems no "Train or railway" Schema to exist so far?
I was testing out the TrainReservation schema the other day and I was able to generate a Now card using the sample below:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "TrainReservation",
"reservationNumber": "12345",
"reservationStatus": "http://schema.org/ReservationConfirmed",
"reservationFor": {
"#type": "TrainTrip",
"departureStation": {
"#type": "TrainStation",
"name": "Munich Central"
},
"departureTime": "2015-05-26T10:30:00+01:00",
"arrivalStation": {
"#type": "TrainStation",
"name": "Paris Gare De Lyon"
},
"arrivalTime": "2015-05-27T03:10:00+01:00"
},
"reservedTicket": {
"#type": "Ticket",
"underName": "Eva Green",
"ticketedSeat": {
"#type": "Seat",
"seatNumber": "27B",
"seatingType": "1st Class"
},
"ticketNumber": "123XYZ",
"ticketToken": "aztecCode:AB34",
"additionalTicketText": "We recommend that you arrive at the station at least 30 minutes prior to your scheduled departure. Allow additional time if you need help with baggage or tickets."
}
}
</script>
Here's a screenshot of the result on my HTC One Android device:
Note, that this will not appear in Gmail/Inbox like the FlightReservation. You will only be able to generate a Now card.

Triggering Google Now Cards using email schemas: Cards don't show up

I inserted schema into an email that confirms an event registration in JSON-LD format. I mailed this to myself using Google AppScript. But I'm unable to see the triggered card in Google Now. The markup has been verified by Google's markup tester and is valid.
<html>
<body>
<script type="application/ld+json">
{
"#context" : "http://schema.org",
"#type" : "EventReservation",
"reservationNumber" : "SDCC12345",
"reservationFor" : {
"#type" : "Event",
"name" : "San Diego Comic Con 2014",
"startDate" : "2014-07-29T08:30",
"location" : {
"#type" : "Place",
"name" : "San Diego Convention Center",
"address" : {
"#type" : "PostalAddress",
"streetAddress" : "111 West Harbor Drive",
"addressLocality" : "San Diego",
"addressRegion" : "California",
"addressCountry": "USA"
}
}
},
"underName" : {
"#type" : "Person",
"name" : "Jon Snow"
},
"reservationStatus": "confirmed"
}
</script>
<p>
Dear Jon, thanks for booking your San Diego Comic Con ticket with us.
</p>
<p>
BOOKING DETAILS<br/>
Order for: Jon Snow<br/>
Event: San Diego Comic Con 2014<br/>
When: July 27th 2014 8:30am PST<br/>
Venue: 111 West Harbor Drive, San Diego,California<br/>
Reservation number: SDCC12345<br/>
</p>
</body>
</html>
What could be the problem here?
Your code has a slightly different structure to mine, but mine has worked. The parts where there are obvious differences are:
The order of the elements
The reservation status value format
The start date value format
The order shouldn't matter, so skip that for now, and try changing your status value to be:
"reservationStatus": "http://schema.org/ReservationConfirmed",
Then change your Start Date value format to include a timezone, similar to:
"startDate": "2015-04-25T15:00:00-00:00",
If that doesn't make it work, try ordering your data to the following order:
Event type
Confirmed status
Under Name
Reservation For
Cheers,
Conor

Resources