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

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.

Related

Is there a way to start conversation when teams tab is created using graph api

I am creating a teams app where there is an option to create a new tab for collaboration for individual/group by providing details like tab display title, url etc
After the tab is created, I would want to send some supporting message to describe about the tab.
Right now there is button to start conversation. And when you click on button some prefilled text loads along with tab title.
Is there a way I can achieve this using graph api, so instead of clicking on start conversation button and getting the pre-filled message, I should be able to pass the supporting message via the graph api ?
Or Can we customize the message shown once you click the start conversation?
once you create a Tab in Team's channel via graph api you should get 201 as success with ID of new tab.
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "794f0e4e-4d10-4bb5-9079-3a465a629eff",
"displayName": "My Contoso Tab",
"configuration": {
"entityId": "2DCA2E6C7A10415CAF6B8AB6661B3154",
"contentUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154/tabView",
"websiteUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154",
"removeUrl": "https://www.contoso.com/Orders/2DCA2E6C7A10415CAF6B8AB6661B3154/uninstallTab"
},
"sortOrderIndex": "20",
"webUrl": "https://teams.microsoft.com/l/channel/19%3ac2e36757ee744c569e70b385e6dd79b6%40thread.skype/tab%3a%3afd736d46-51ed-4c0b-9b23-e67ca354bb24?label=my%20%contoso%to%tab"
}
Then you can create conversation like below
POST https://graph.microsoft.com/v1.0/groups/29981b6a-0e57-42dc-94c9-cd24f5306196/conversations
Content-type: application/json
{
"topic": "Take your wellness days and rest",
"threads": [
{
"posts": [
{
"body": {
"contentType": "html",
"content": "Contoso cares about you: Rest and Recharge"
},
"newParticipants": [
{
"emailAddress": {
"name": "Adele Vance",
"address": "AdeleV#contoso.onmicrosoft.com"
}
}
]
}
]
}
]
}
Ref articles

graph-api: Adaptive card with mention doesn't render date properly

It seams that msteams object doesn't allow to render date, when card pushed through graph api in private msteams channel.
Example is like this:
POST https://graph.microsoft.com/v1.0/teams/{team_id}/channels/{channel_id}/messages
{
"body": {
"contentType": "html",
"content": "<attachment id=\"1\"/>"
},
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"id":"1",
"content":"{\"type\":\"AdaptiveCard\",\"body\":[{\"text\":\"<at>Lev</at> hello {{ DATE(2021-04-28T00:00:00Z, SHORT) }}\",\"wrap\":true,\"type\":\"TextBlock\"}],\"version\":\"1.3\",\"msteams\":{\"entities\":[{\"type\":\"mention\",\"text\":\"<at>Lev</at>\",\"mentioned\":{\"id\":\"29:131...Rg\",\"name\":\"Lev\"}}]}}"
}
]
}
Example in teams
Is there some workaround?
msteams object is not allowed through Graph API. Only Bots have access to the msteams object. This is by design.
The at mention object when you send from bot, the user will get notify in teams activity and the card will display as shown in below image
and the at mention in adaptive card using graph api post request, the user will not get notify in teams activity and the card will display as shown in below image
Please check the below request body
{
"body": {
"contentType": "html",
"content": "<attachment id=\"1\"/>"
},
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"id": "1",
"content": "{ \"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\", \"type\": \"AdaptiveCard\", \"version\": \"1.0\", \"body\": [ { \"type\": \"TextBlock\", \"text\": \"Your package will arrive on {{DATE(2017-02-14T06:00:00Z, SHORT)}} at {{TIME(2017-02-14T06:00:00Z)}}\", \"wrap\": true } ]}"
}
]
}

Unable to add Teams/SharePoint file attachment in a task to ' Tasks by Planner and To Do '

I have a fully built API, that creates tasks into MS Teams "Tasks by Planner and To Do".
MS actual graph API used POST https://graph.microsoft.com/v1.0/planner/tasks
Sample API:
{
"routeId": "7fcxxxxx-xxxx-xxxx-xxxx-5d35838xxxxx",
"userId": "77cxxxxx-xxxx-xxxx-xxxx-5f09858xxxxx",
"tenantId": "dcdxxxxx-xxxx-xxxx-xxxx-31002a1xxxxx",
"title": "Task: Add you task title",
"hospitalAssignment": null,
"percentComplete": 0,
"createdTimestamp": "2021-04-20T01:51:49Z",
"startDateTimestamp": "2021-04-20T18:10:15Z",
"dueDate": "2021-11-20T11:47:33.000Z",
"Notes": "Add some useful notes here",
"checklistItems": [
{
"title": "itema"
},
{
"title": "itemb"
}
],
"attachments": [
{
"url": "https://www.google.com",
"alias": "link"
},
{
"url": "https://teams.microsoft.com/file/....",
"alias": "Test Document 1"
},
{
"url": "https://random.sharepoint.com/sites/...",
"alias": "Test Document 2"
},
],
"comments": "null,",
"priority": null
}
Hitting the above API creates a task in the planner as seen below
So, here is an issue - when I try to click on link it took me to the browser and opens up google which is fine. Now, when I click on Test Document 1 or Test Document 2 it throws an unknown error and Sorry, something went wrong respectively.
After that, I created the task manually and adding the attachments from Add Attachment and paste the links to the file there, then click the files works and opens up the documents.
Assuming you are referring to adding / updating the Planner Task Details for a PlannerTask;
there is a sample provided of adding (PATCH) a pptx file using a 'teams path' as you referred to it.
Note that the path must be (url)encoded.
Tasks - plannerTaskDetail < references
https://learn.microsoft.com/en-us/graph/api/resources/plannerexternalreferences?view=graph-rest-1.0
{
"https%3A//contoso%2Esharepoint%2Ecom/teams/agile/documents/AnnualReport%2Epptx":
{
"#odata.type": "microsoft.graph.externalReference", // required in PATCH requests to edit the references on a task
"alias": "Agile Team Annual Report",
"lastModifiedBy": {
"user": {
"id": "ebf3b108-5234-4e22-b93d-656d7dae5874"
}
},
"lastModifiedDateTime": "2015-09-21T17:45:12.039Z",
"previewPriority": "0009005756397228702",
"type": "PowerPoint"
}
}

Create OnlineMeeting in MS Graph with Call-in Info

I am building some utilities to automate aspects of Microsoft Teams at my company. One thing we are trying is automating scheduling/creation of Online Meetings under various circumstances. Overall this is working fine, but I can't figure out how to get / attach telephone call-in information for the calls we're creating.
Here's an example POST /app/onlineMeetings:
{
"meetingType": "meetNow",
"participants": {
"organizer": {
"identity": {
"user": {
"id": "<user-id>"
}
}
}
},
"subject": "Personal Room"
}
And here's what a typical response looks like:
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#app/onlineMeetings/$entity",
"joinUrl": "<join-url>",
"subject": "Personal Room",
"isCancelled": false,
"meetingType": "MeetNow",
"accessLevel": "SameEnterprise",
"id": "<meeting-id>",
"audioConferencing": null,
"meetingInfo": null,
"participants": {
"organizer": {
"upn": "<user-name>",
"sipProxyAddress": "<user-name>",
"identity": {
}
},
"attendees": []
},
"chatInfo": {}
}
As you can see, the audioConferencing key is null. If a user accesses the joinUrl, they can join the call and audio conferencing information is displayed at that time -- but I can't figure out how to get it out in advance (e.g. to send in an email).
Also note that since this is not a VTC-enabled meeting, the id can't be used to issue a new GET request for additional information, as discussed here

Google Markup not seen in e-mail

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

Resources