I'm trying out adaptive cards in an attempt to integrate warnings through logic apps with teams. the question i'm about to ask is related to having the connector in Logic app wait for an response from the adaptive card in Teams after being sent from the Logic app.
I've managed to create my adaptive card and in that card i have the necessary information and two actions at the bottom that i want my logic app to react on so to speak.
My Adaptive card looks something like this:
{
"type": "AdaptiveCard",
"version": "1.0",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"body": [
{
"type": "TextBlock",
"text": "Alert - Employee email differences found:",
"weight": "Bolder",
"size": "Medium",
"horizontalAlignment": "Left",
"spacing": "Medium",
"maxLines": 0
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "New Email",
"weight": "Bolder"
},
{
"type": "TextBlock",
"text": "Test.Person21#mail.com"
},
{
"type": "TextBlock",
"text": "Test.Person22#mail.com"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Old Email",
"weight": "Bolder"
},
{
"type": "TextBlock",
"text": "Test.Person11#mail.com"
},
{
"type": "TextBlock",
"text": "Test.Person12#mail.com"
}
]
}
],
"separator": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Update Now",
"style": "positive",
"data": true
},
{
"type": "Action.Submit",
"title": "Dismiss",
"style": "destructive",
"data": false
}
]
}
As you can se when i push on "update now" i get the error message saying "there is no backend/app to connect to" (in swedish - "Can't reach application, try again") basically.
So again what i'm trying to do is for the Logic app to wait for the respons.
After the logic app has sen the message it "completes".
So is this possible? If so, how do i get this to work?
while logic apps can send cards to MS Teams they can not listen on actions performed on those cards.
To be able to use card actions you need to have a custom service made that listens and acts on those activities.
Related
I'm currently working on an Alexa Smarthome skill which can handle a multitude of device types, one of which type is an HVAC device. The server handling Skill requests is unable to handle multiple requests at a time, so instead of letting Alexa call "ReportState", I instead give it a "ChangeReport" when values change.
I'm using an Alexa.ThermostatController interface v3 capability as well as a PowerController, a TemperatureSensor, and an EndpointHealth capability to build the device. An example Discovery response looks like the following:
{
"endpointId": "12-34",
"manufacturerName": "Sample Manufacturer",
"description": "HVAC Control",
"friendlyName": "Office Test HVAC",
"additionalAttributes": {
"manufacturer": "Sample Manufacturer",
"model": "unknown",
"serialNumber": "unknown",
"firmwareVersion": "unknown",
"softwareVersion": "unknown",
"customIdentifier": "12-34"
},
"displayCategories": [
"THERMOSTAT",
"TEMPERATURE_SENSOR"
],
"cookie": {},
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
},
{
"type": "AlexaInterface",
"interface": "Alexa.EndpointHealth",
"version": "3",
"properties": {
"supported": [
{
"name": "connectivity"
}
],
"proactivelyReported": true,
"retrievable": false
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.ThermostatController",
"version": "3.1",
"properties": {
"supported": [
{
"name": "upperSetpoint"
},
{
"name": "lowerSetpoint"
},
{
"name": "thermostatMode"
}
],
"proactivelyReported": true,
"retrievable": false
},
"configuration": {
"supportedModes": [
"OFF",
"HEAT",
"COOL",
"AUTO"
]
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.TemperatureSensor",
"version": "3",
"properties": {
"supported": [
{
"name": "temperature"
}
],
"proactivelyReported": true,
"retrievable": false
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.PowerController",
"version": "3",
"properties": {
"supported": [
{
"name": "powerState"
}
],
"proactivelyReported": true,
"retrievable": false
}
}
]
}
Discovery will find the device and add it to the Alexa Home. However, when I go to the device in the app, it will not display the interface and instead say something along the lines of "Waiting for " and show a loading icon. When I go to set the thermostat by voice, such as "Set Office Test HVAC to 74 Degrees Fahrenheit", it says that the device "doesn't support that".
Does anyone know what's going on or how to fix this?
I checked the Cloudwatch logs to see if there was anything being sent from Alexa such as a ReportState directive, but could not find anything. I also tried setting a value on the thermostat to force a ChangeReport, and the ChangeReport seems to have been sent, but there's no update in the app. I have also been unable to find any errors in the Cloudwatch logs. I've checked over the responses and the Discovery message several times just to be sure, and I'm still not sure what the problem is.
I'm trying to get the HVAC device to show up in the app with the proper interface and allow users to control the device.
I had this issue with the version 3.1. I would suggest to change the version of Alexa.ThermostatController capability from 3.1 to 3.0. Also remember that the smart home capabilities used for your skill should mimic and map to physical buttons on your device.
I'm trying to use the Alexa Smart Home Skill ToggleController v3 interface to build a skill that will open and close my gate. I read the docs, and successfully implemented the sample light bulb tutorial from end to end. https://developer.amazon.com/en-US/docs/alexa/smarthome/smart-home-skill-tutorial.html
Everything worked fine. Then I created a new skill and tried to implement the ToggleController interface, mapping ON and OFF to Open and Close using semantics.
Account linking works fine
Lambda gets called with discover directive when I enable the skill on
my Alexa app
There are no errors in CloudWatch
Alexa Simulator calls the right directives and receives responses with no errors
Schema validates successfully
When I click discover devices, I get "No new devices found".
I checked all devices in the Alexa app and my device is not there.
Below is the discovery response message that my lambda returns - (from CloudWatch).
Does anyone know what I'm doing wrong?
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"messageId": "fedfbae4-0ec8-4b4e-81d1-c998bc0ee860",
"payloadVersion": "3"
},
"payload": {
"endpoints": [
{
"endpointId": "pleasant-view-gate",
"manufacturerName": "Ancient Geeks",
"description": "Smart Gate at Pleasant View Cottage",
"friendlyName": "Pleasant Gate",
"displayCategories": [
"OTHER"
],
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.ToggleController",
"instance": "PleasantView.Gate",
"version": "3",
"properties": {
"supported": [
{
"name": "toggleState"
}
],
"proactivelyReported": false,
"retrievable": true
},
"capabilityResources": {
"friendlyNames": [
{
"#type": "text",
"value": {
"text": "Gate",
"locale": "en-US"
}
}
]
},
"semantics": {
"actionMappings": [
{
"#type": "ActionsToDirective",
"actions": [
"Alexa.Actions.Close"
],
"directive": {
"name": "TurnOff",
"payload": {}
}
},
{
"#type": "ActionsToDirective",
"actions": [
"Alexa.Actions.Open"
],
"directive": {
"name": "TurnOn",
"payload": {}
}
}
],
"stateMappings": [
{
"#type": "StatesToValue",
"states": [
"Alexa.States.Closed"
],
"value": "OFF"
},
{
"#type": "StatesToValue",
"states": [
"Alexa.States.Open"
],
"value": "ON"
}
]
}
},
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
},
{
"type": "AlexaInterface",
"interface": "Alexa.EndpointHealth",
"version": "3",
"properties": {
"supported": [
{
"name": "connectivity"
}
],
"proactivelyReported": false,
"retrievable": true
}
}
]
}
]
}
}
}
I'm trying to create a custom connector for my API in Microsoft Flow so users can trigger flows based on a webhook implementation.
The authentication part seems to be working properly (I'm able to create connections). After creating a flow using my custom trigger, it never gets triggered. When checking the data on my end it seems that Flow was never able to register the subscription properly.
If I navigate to the management page for the flow, I get the following error message.
When I click on fix the trigger I get the following details where the Id parameter matches the id of the resource we're trying to subscribe to.
Here is the trigger definition:
{
"/AlertRules/{id}/webhooks": {
"x-ms-notification-content": {
"schema": {
"type": "object",
"properties": {
"Title": {
"type": "string",
"description": "Title"
},
"Text": {
"type": "string",
"description": "Text"
},
"Data": {
"type": "array",
"items": {
"$ref": "#/definitions/DataApi.Models.AlertEvent"
},
"description": "Data"
}
}
},
"description": ""
},
"post": {
"responses": {
"201": {
"description": "Created",
"schema": {
"type": "string"
}
}
},
"x-ms-trigger": "single",
"operationId": "NewAlertEvent",
"summary": "When a new Alert Event is created or updated",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string",
"x-ms-visibility": "important",
"x-ms-dynamic-values": {
"operationId": "AlertRules.AlertRule.ListAlertRule",
"value-path": "Id",
"value-collection": "value",
"value-title": "Description"
}
},
{
"name": "body",
"in": "body",
"required": false,
"schema": {
"type": "string",
"x-ms-visibility": "internal",
"title": "",
"x-ms-notification-url": true
},
"x-ms-visibility": "internal"
}
]
}
}
The description of my delete operation
{
"/AlertRuleSubscriptions({Id})": {
"delete": {
"tags": [
"AlertRuleSubscriptions.AlertRuleSubscription"
],
"summary": "Delete entity from AlertRuleSubscriptions",
"operationId": "AlertRuleSubscriptions.AlertRuleSubscription.DeleteAlertRuleSubscription",
"parameters": [
{
"in": "path",
"name": "Id",
"description": "key: Id",
"required": true,
"type": "string",
"format": "uuid",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
"x-ms-docs-key-type": "AlertRuleSubscription"
},
{
"in": "header",
"name": "If-Match",
"description": "ETag",
"type": "string"
}
],
"responses": {
"204": {
"description": "Success"
},
"default": {
"$ref": "#/responses/error"
}
},
"x-ms-docs-operation-type": "operation"
}
}
}
And my post operation does reply with a Location header which matches the format of the delete operation described above.
My questions are:
What is missing in my trigger declaration?
How can I get more details on the subscription creation and the error Microsoft Flow is generating?
After some internal discussions with Microsoft we found two main issues.
First I updated the body parameter of the POST request to create the subscription to this.
{
"name": "body",
"in": "body",
"required": false,
"schema": {
"type": "object",
"properties": {
"callbackUrl": {
"type": "string",
"required": true,
"description": "callbackUrl",
"x-ms-notification-url": true,
"x-ms-visibility": "internal"
}
}
}
}
That is because the connector definitions don't support sending the callback URL in the body without using JSON formatting and because Flow was implemented using the Open API callback specification.
Second I updated my API to support the specification mentioned above.
This is my first time using Discord embeds, let alone, making a webhook. Having a little bit of trouble trying to figure out what I'm doing wrong. Hopefully someone can help!
When I try to send an embed with a message with this code:
{
"username": "Official Discord Servers",
"avatar_url": "https://imgur.com/a/Cl3zspb",
"embeds": [{
"description": "Here is a list of official Discord servers maintained by our State. Note that most of these servers may restrict full access to those who are members of their respective departments:",
"color": 16007990,
"fields": [
{
"name": "State of Atoll",
"value": "[Discord Server](https://discord.gg/5KKgb2z)"
},
{
"name": "Atoll Law Enforcement Training Academy",
"value": "[Discord Server](https://discord.gg/GJnbavz)"
},
{
"name": "Atoll Department of Homeland Security",
"value": "[Discord Server](https://discord.gg/acnPFa7)"
},
{
"name": "Palm County Sheriff's Office",
"value": "[Discord Server](https://discord.gg/uYFANDs)"
},
{
"name": "Atoll State Police",
"value": "[Discord Server](https://discord.gg/WNHKtra)"
},
{
"name": "Atoll Department of Corrections",
"value": "[Discord Server](https://discord.gg/VbFew9s)"
},
{
"name": "Atoll National Guard",
"value": "[Discord Server](https://discord.gg/6zE9HyW)"
}]
}
I get this error:
{
"code": 50006,
"message": "Cannot send an empty message"
}
You need to send "content" as a key value pair containing the content of the message being sent.
"content": "Just testing webhooks"
It requires header Content-Type with value application/json. Also try setting content field.
Your issue is invalid JSON, so try using JSON validator
The JSON referred in the question cannot be parsed, it is not properly formed, it is missing closing brackets. Please find last set of }] brackets in my answer below, try this,
{
"username": "Official Discord Servers",
"avatar_url": "https://imgur.com/a/Cl3zspb",
"embeds": [{
"description": "Here is a list of official Discord servers maintained by our State. Note that most of these servers may restrict full access to those who are members of their respective departments:",
"color": 16007990,
"fields": [
{
"name": "State of Atoll",
"value": "[Discord Server](https://discord.gg/5KKgb2z)"
},
{
"name": "Atoll Law Enforcement Training Academy",
"value": "[Discord Server](https://discord.gg/GJnbavz)"
},
{
"name": "Atoll Department of Homeland Security",
"value": "[Discord Server](https://discord.gg/acnPFa7)"
},
{
"name": "Palm County Sheriff's Office",
"value": "[Discord Server](https://discord.gg/uYFANDs)"
},
{
"name": "Atoll State Police",
"value": "[Discord Server](https://discord.gg/WNHKtra)"
},
{
"name": "Atoll Department of Corrections",
"value": "[Discord Server](https://discord.gg/VbFew9s)"
},
{
"name": "Atoll National Guard",
"value": "[Discord Server](https://discord.gg/6zE9HyW)"
}]
}]
}
In my case, I was sending a plain text directly instead of JSON in the request. Then when I changed the message to the below it worked.
{content: "This is the message"}
If you are sending embeds, you can still keep the content set to null.
Hopefully someone can help me with this because I've been stumped for a week.
I am creating a simple Alexa skill from one of the samples. It's the color picker skill - you tell Alexa your favorite color, and then you ask her your favorite color. I'm using Custom Slots, and the Skill Service doesn't want to return a value for the color. It launches successfully, and then loads the correct intent, however it doesn't send the correct value. Instead, there's not even a value parameter in the output, just name and confirmation status.
Here's my skill's JSON, followed by the request JSON output after I tell the skill: "My color is red." I want the skill to pass "red" into the value parameter.
{
"interactionModel": {
"languageModel": {
"invocationName": "color picker",
"intents": [
{
"name": "MyColorIsIntent",
"slots": [
{
"name": "color",
"type": "LIST_OF_COLORS"
}
],
"samples": [
"my color is {color}",
"{color} is my color"
]
},
{
"name": "WhatsMyColorIntent",
"slots": [],
"samples": [
"what's my color",
"what's my favorite color"
]
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
}
],
"types": [
{
"name": "LIST_OF_COLORS",
"values": [
{
"name": {
"value": "green"
}
},
{
"name": {
"value": "red"
}
},
{
"name": {
"value": "yellow"
}
},
{
"name": {
"value": "orange"
}
},
{
"name": {
"value": "black"
}
},
{
"name": {
"value": "blue"
}
}
]
}
]
}
}
}
Down below is the request:
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.918d6da6-cd7e-4bb8-a2a9-41fb1af8a354",
"timestamp": "2018-10-01T01:53:56Z",
"locale": "en-US",
"intent": {
"name": "MyColorIsIntent",
"confirmationStatus": "NONE",
"slots": {
"Color": {
"name": "Color",
"confirmationStatus": "NONE"
}
}
}
}
Your issue is that slot "color" should be named "Color" and your sample references changed to reflect this so "my color is {Color}", and "{Color} is my color", It is not picking up the slot because the name is identical.
Be sure to also complete the skill with the required Intents for stop and help, currently, this will just continue asking for color choices until you kill the program.
This is what happened:
I was working on different versions of the same skill, each with the same invocation name. When I typed in the invocation name, it actually opened an outdated version of the skill (I hadn't deleted the old skills - I had like 3 different ones - I like to start over). I didn't realize that when you click "test" you can test any of your saved skills, not just the one you have open.