Is there a way to start conversation when teams tab is created using graph api - microsoft-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

Related

Filter Mail by Custom InternetMessageHeaders

I am able to send mail and add custom internetMessageHeaders. But what I'm attempting to do now is return messages based on filtering to the custom headers I'm adding.
Example:
If I add a custom header to the message for "x-custom-header-productid = x123z" I want to filter and return all messages that have the custom header for x-custom-header-productid that equals x123z. Is this possible?
Thanks!
The header needs to be provisioned in the Mailbox you want to search for it on eg https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-provision-x-headers-by-using-ews-in-exchange
So in the Graph if you send a Message using that mailbox that would provision it for use in that Mailbox eg
{
"message": {
"subject": "Meet for lunch?",
"body": {
"contentType": "Text",
"content": "The new cafeteria is open."
},
"toRecipients": [
{
"emailAddress": {
"address": "youmailbox#domain.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "String {00020386-0000-0000-C000-000000000046} Name X-blah-blah",
"value": "Food"
}
]
}
}
You could then search for any messages that arrived (after you provisioned that header)eg which would mean the property would be promoted in the store.
https://graph.microsoft.com/v1.0/me/mailfolders/inbox/messages?$filter=singleValueExtendedProperties/any(ep:ep/id eq 'String {00020386-0000-0000-C000-000000000046} Name X-blah-blah' and ep/value eq 'Food')

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"
}
}

Update message in google chat from Jira

I am trying to create a notification in google chat whenever the status of a jira ticket changes. I have managed to sort the automation so that a message is sent to google chat every time the status changes but it creates a new thread each time. I would like to either update the original message with the new status or add a new message to the same thread.
I have the Automation configured to Send web request as follows has anyone managed to do this?
Webhook URL : https://chat.googleapis.com/v1/spaces/xxxx/messages?key=xxxx&token=xxxx
Header : Content-Type - application/json; charset=UTF-8
HTTP method : POST
Webhook body : Custom data
Custom data
"cards": [
{
"header": {
"title": "{{issue.key}}",
"subtitle": "{{issue.summary}}"
},
"sections": [
{
"widgets": [
{
"keyValue": {
"topLabel": "Reported by",
"content": "{{issue.reporter.displayName}}"
}
},
{
"keyValue": {
"topLabel": "Status",
"content": "{{issue.status.name}}"
}
}
]
},
{
"widgets": [
{
"buttons": [
{
"textButton": {
"text": "View Ticket",
"onClick": {
"openLink": {
"url": "{{issue.url.customer}}"
}
}
}
}
]
}
]
}
]
}
]
}
Example of what is happening
To create a new message under the same thread, you need to provide the thread as part of the message body
When you send the first message, the response contains a message resource that contains a thread resource
Include the thread name you obtain after sending the first message into the message body of the subsequent messages - this will enforce threading
To update an existing card, you need to follow the documentation:
Use the actionResponse.type UPDATE_MESSAGE instead of NEW_MESSAGE
I am not sure how you trigger an action response in your situation, but if you have a functionality that is able to trigger a new message, you can just as well trigger UPDATE_MESSAGE instead

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

Resources