Adding subscription for Custom Objects - Commercetool - commercetools

I am trying to add a subscription for custom objects in commerce tool. I am using the following definition:
{
"destination": {
"type": "AzureServiceBus",
"connectionString": "**********************"
},
"messages": [
{
"resourceTypeId": "key-value-document",
"types": []
}
],
"key": "customeobj"
}
But I am getting this error:
The resource type ID 'key-value-document' is unknown or not supported by messages subscriptions. These resource type IDs are supported: review, cart, payment, order, customer, category, inventory-entry, product, customer-group, store, product-type, product-selection.
It would be great if someone knows what to do about this.

As the error suggests, message subscriptions are only supported for messages on order, product, category, payment, customer, review, inventory entry and store at the moment.
Change subscriptions support the resource type key-value-document if that is sufficient for your use case.

Related

Get member emails when using delta on group

I'm trying to use the graph API to get a list of users which have been added to a specific group using the delta feature so I reduce the amount of data that passes through.
However, when I $expand on the members property, I'm only getting the id, and not the specific properties I need (mail and some other details) - despite the fact I'm $selecting it.
The url I'm using for the query is
https://graph.microsoft.com/v1.0/groups/delta?$expand=members($select=id,mail)&$select=members&$filter=id eq '<myGroupId>'
And the data I'm getting returned is:
[...]
"value": [
{
"id": "xxxxx-xxxx-xxx-xxx-xxxxx",
"members#delta": [
{
"#odata.type": "#microsoft.graph.user",
"id": "xxxxxxxxxxxxxxxxxxxx"
},
{
"#odata.type": "#microsoft.graph.user",
"id": "xxxxxxxxxxxxxxxxxxxxx"
},
I want my members#delta to include the details of the member so I don't have to query for them seperately.
According this members#delta property contains only the ids of member objects in the group.

Owners not receiving email when added to a group in Graph

I create a group in graph with the following body:
{
"description": "<GroupDescription>",
"displayName": "<GroupTitle>",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "<SiteName>",
"owners#odata.bind": [
"https://graph.microsoft.com/v1.0/users/<userID>",
"https://graph.microsoft.com/v1.0/users/<userID>"
],
"securityEnabled": false,
"visibility": "private"
}
None of the owners added with the code:
"owners#odata.bind": [
"https://graph.microsoft.com/v1.0/users/<userID>",
"https://graph.microsoft.com/v1.0/users/<userID>"
]
receive an email. Users added to the group later will receive one. Is there a way to make the owners receive a welcome-email when added during the group creation?
The Unified Group Welcome Message is only sent to new members. If you would like to notify them that they've been added to a Group, you can add them to both owners and members.
This is also the guidance for Teams:
We recommend that when you add an owner, you also add that user as a member. If a team has an owner who is not also a member, ownership and membership changes might not show up immediately in Microsoft Teams. In addition, different apps and APIs will handle that differently. For example, Microsoft Teams will show teams that the user is either a member or an owner of, while the Microsoft Teams PowerShell cmdlets and the /me/joinedTeams API will only show teams the user is a member of. To avoid confusion, add all owners to the members list as well.

How to get Resource Group name from within Logic App

In an Azure Logic App, how can I get the name of the Resource Group containing the current logic app?
I want to include some tracking details in the JSON output that I am sending to another system.
I can get the run Identifier ( using #{workflow()['run']['name']} ),
and the current logic app name ( using #{workflow()['name']} )
However, I cant work out how to get the name of the resource group to which the logic app is deployed.
As a last resort, I will use the resource group name used by the deployment template, but that will be wrong if the logic app is moved later.
I could also use tags, but again that could get out of step if the logic app is moved.
Thanks
A simple formula may be:
split(workflow().id, "/")[4]
If you're deploying the Logic Apps using ARM templates (e.g. edit in Visual Studio, check into Azure DevOps git repo and deploy using release pipeline), you can create an ARM parameter:
"resGroup_ARM": {
"type": "string",
"defaultValue": "[resourceGroup().name]",
"metadata": {
"description": "Resouce group name"
}
}
Then, you can create a workflow parameter:
"resGroup_LA": {
"type": "string",
"defaultValue": "ResGroup LA default"
}
... and give it a value in the parameters initialisation section:
"resGroup_LA": {
"value": "[parameters('resGroup_ARM')]"
}
You can get all the other properties of resourceGroup() in a similar manner, see: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-resource?tabs=json#resourcegroup
First we can create a "Initialize variable" action to get all of the data in workflow, shown as below screenshot:
Then we can find the data in workflow is:
{
"id": "/subscriptions/*****/resourceGroups/huryTest/providers/Microsoft.Logic/workflows/hurylogicblob",
"name": "hurylogicblob",
"type": "Microsoft.Logic/workflows",
"location": "eastus",
"tags": {},
"run": {
"id": "/subscriptions/*****/resourceGroups/huryTest/providers/Microsoft.Logic/workflows/hurylogicblob/runs/*****",
"name": "*****",
"type": "Microsoft.Logic/workflows/runs"
}
}
It contains the resource group name, so we just need to get the property "id" and substring it to get resource group name. The length of "resourceGroups/" is 15, so in the expression below I use add(,15) and sub(,15).
You can use the expression as below:
substring(workflow()['id'],add(indexOf(workflow()['id'],'resourceGroups/'),15),sub(sub(indexOf(workflow()['id'],'/providers'),indexOf(workflow()['id'],'resourceGroups/')),15))
At last, I got the resource group name of the logic app:

Gmail API history request returning Drafts

I posted a question abt the api returning invalid history ids. I'm trying to figure this out. I think the ids are just not valid in a messages get request, since these are not real messages, rather drafts. I don't know why history list is returning drafts for a messagesAdded request. Can somebody tell me if this is the expected behavior?
{
"history": [
{
"id": "10946109",
"messages": [
{
"id": "15cc8cd840c2945a",
"threadId": "15cc5ccf65733c7f"
}
],
"messagesAdded": [
{
"message": {
...
"labelIds": [
"SENT"
]
}
}
]
},
{
"id": "10975146",
"messages": [
{
...
}
],
"messagesAdded": [
{
"message": {
...
"labelIds": [
"DRAFT"
]
}
}
]
}
If I need to filter for actual messages - not drafts, do I just do labelIds does not contain DRAFT?
Your first question:
Can somebody tell me if this is the expected behavior?
Yes this is expected behavior (replicated). Check this Document regarding History List:
Users.history: list
Lists the history of all changes to the given mailbox. History results
are returned in chronological order (increasing historyId).
Your second question:
If I need to filter for actual messages - not drafts, do I just do labelIds does not contain DRAFT?
Yes there is an actual filter. You can change the "labelId" parameter to anything except "DRAFT" so it would not return draft results in the history.
Below is a simple guide on how to properly filter your messages without returning Draft label types:
To check your list of labelId's, try this Label API Test Link to see your list of labels just to be sure that you will be using a valid "labelId" later in step 3 by executing the API.
Get the value of the "historyId" by executing the Message List API, retrieving a list of message then get one id then use the Message Get API
by entering the ID to retrieve the "historyId". Make sure that the labelId is not a "DRAFT" type or you have to get another id from the list just to avoid returning a "DRAFT" type.
Then execute History API Test Link. Enter your "userId" and the "startHistoryId"(make sure to subtract the value of the "startHistoryId" by 1) of your message and change the "labelId" by using one from the list of labels you retrieved from your GET API in step 2, change the "historyTypes" to "messagesAdded" then click execute.
It should return a list of message under the "labelId" being inputted and not a "DRAFT" type.

Use of "creator" property in timetime insert doesn't seem to work

The playground has an example card that includes a "creator" field with the name and an image representing "Google Glass". The JSON used to create this card is
{
"text": "Hello Explorers,\n\nWelcome to Glass!\n\n+Project Glass\n",
"creator": {
"displayName": "Project Glass",
"imageUrls": [
"https://lh3.googleusercontent.com/-quy9Ox8dQJI/T3xUHhub6PI/AAAAAAAAHAQ/YvjqA3Pw1sM/glass_photos.jpg?sz=360"
]
},
"notification": {
"level": "DEFAULT"
}
}
When this is sent to Glass, however, the imageUrl isn't displayed. The documentation at https://developers.google.com/glass/v1/reference/timeline/insert simply says that "creator" is a "nested object", but with no clear indication what this nested object should be. The example seems to indicate that this should be a Contact (see https://developers.google.com/glass/v1/reference/contacts), and the object returned by the insert seems to be of type "mirror#contact", confirming this.
Does the contact used in a creator need to be pre-created via the contacts API call first? Is there something else necessary to get the creator to display or work correctly?
The creator is currently displayed only if the REPLY menu item is provided along with the timeline item.
This seems like a bug, please file it on our issue tracker

Resources