CARD-ACTION-STATUS response header fails to parse in Microsoft Teams Private Channels - http-post

When we send a MessageCard to a Microsoft Teams channel via an "Incoming Webhook" connector, when that card contains an HttpPOST potentialAction and the target of the POST returns a CARD-ACTION-STATUS header in the reply, on public channels the content of that header is displayed as a new message. However, if the same MessageCard is sent to a private channel the CARD-ACTION-STATUS header fails to parse and the error message "There was a problem submitting your changes. Try again in a minute" appears.
This worked perfectly fine until around Dec 8th, 2020. I have also verified that the target of the HttpPOST did receive the request and did reply with the CARD-ACTION-STATUS header for both public and private channels.
This is the message card I posted to the Teams channel via an Incoming Webhook Connector :
{
"#type": "MessageCard",
"#context": "https://schema.org/extensions",
"expectedActors": [],
"themeColor": "993399",
"hideOriginalBody": true,
"title": "Simple Teams MessageCard",
"text": "Card Action Status",
"potentialAction": [
{
"#type": "HttpPOST",
"name": "Test HttpPOST",
"target": "https://mydummyapi.execute-api.us-east-1.amazonaws.com/sandbox/teams",
"bodyContentType": "application/json",
"body": "{'message': 'Anybody There'}"
}
]
}
This is the result from a public channel :
public channel result
This is the result from a private channel :
private channel result
One last thing of note. The response header "CARD-UPDATE-IN-BODY" works on both private and public channels when you pass a new message card in the body of the response. So it is only with the "CARD-ACTION-STATUS" header, and only in private channels.

For better visibility coping answer from #nikitha comments
We are not able to repro the issue at our end. When we use http post request we are receiving the http post to the target URL.

Related

Plaid - Error with Sandbox `set_verification_status` request when simulating expired verification

While trying to test the VERIFICATION_EXPIRED error state in sandbox for an item which is pending_automatic_verification, I attempted to make a request to https://plaid.com/docs/api/sandbox/#sandboxitemset_verification_status. I have used this endpoint before to simulate a successful verification when including "verification_status": "automatically_verified" in the request body.
According to the documentation, it is also possible to send the status "verification_status": "verification_expired", but when I made that request, the webhook which ultimately gets sent is the "success" event, with the code
AUTOMATICALLY_VERIFIED. I am including the webhook request body (minus account/item ids) which I logged below:
{
"account_id": "[the account id]",
"item_id": "[the item id]",
"webhook_code": "AUTOMATICALLY_VERIFIED",
"webhook_type": "AUTH"
}
The request body I sent to the endpoint was (via the postman collection):
{
"client_id": "{{client_id}}",
"secret": "{{secret_key}}",
"access_token": "{{access_token}}",
"account_id": "{{account_id}}",
"verification_status": "verification_expired"
}
Is there something else needed in the request body to coerce the "VERIFICATION_EXPIRED" webhook?
Thanks for bringing this up! This is a bug on Plaid's side, and the owning team has been informed and is investigating. I don't think there's anything you can do at this point to coerce the webhook.

Is there a clean way to have Bots reply to email threads using the Azure BotFramework?

I am developing a bot which uses the email channel to communicate and is replying to email threads.
I could not find any documentation about automatic reply formatting or replying to threads at all. It seems like most of the use cases are just one shot emails out to users.
The way the currently implementation is working is that it casts the incoming message to a model (which has all of the relevant info, ToRecipients, Body [html of the email], Text body[plain text of email], ect).
Using that, the header is split from the Body, add the bots reply with a manually created header, and attach the rest of the email to the end of it. The code then either replaces of removes text artifacts from the html response. And then down the line calls SendActivityAsync to send the message.
There are multiple problems with this approach. Some of which include, text artifacts like carriage returns (\r\n) others like (><o:p>&nbsp) which are added to the response automatically through some blackbox formatting function and not removed. Outlook formatting like having emails addresses encased in < and > in the incoming message but not formatting them properly for out going.
Is there any way to make replying to threads easier, or any official support for it?
If not is there at least any documentation about how emails are parsed in or out that could help make parsing these responses a little easier/clearner?
The Bot Framework has an email channel that can be used like any other channel. The JSON format for the emails is this:
{
"type": "message",
"locale": "en-Us",
"channelID": "email",
"from": { "id": "mybot#mydomain.com", "name": "My bot"},
"recipient": { "id": "joe#otherdomain.com", "name": "Joe Doe"},
"conversation": { "id": "123123123123", "topic": "awesome chat" },
"channelData":
{
"htmlBody": "<html><body style = /"font-family: Calibri; font-size: 11pt;/" >This is more than awesome.</body></html>",
"subject": "Super awesome message subject",
"importance": "high",
"ccRecipients": "Yasemin#adatum.com;Temel#adventure-works.com"
}
}
This is changed in the channelData, accessed through turnContext.Activity.ChannelData
The official doc for this is here, and an example implementation of how to work with channelData (though it's Facebook channel, not email) is here.

Bot is not responding to #Mention when sending message using Graph API

I have created and deployed a bot in Microsoft Teams. Bot Works properly and responds when user talks to the bot using #Mention (e.g. #mybot) in a channel. I just tried to send message to the bot using graph API call:
https://graph.microsoft.com/beta/teams/{group-id-for-teams}/channels/{channel-id}/messages
Method: POST
Content-type: application/json
Body:
"body": {
"contentType": "html",
"content": "Hello World <at id=\"0\">standupbot</at>"
},
"mentions": [
{
"id": 0,
"mentionText": "StandupBot",
"mentioned": {
"application": {
"id": "[my-bot-id]",
"displayName": "StandupBot",
"applicationIdentityType": "bot"
}
}
}
]
}
The Post request goes well, message is posted in my team and bot gets mentioned. But bot is not responding to the mention. However, if user manually mentions the bot in team then bot responds.
What is wrong here, Am i missing something or is it a bug? Please guide.
P.S: I am using Graph Explorer.

How to send a proactive message from a bot to a user

I am trying to send a message from a bot to a teams user who hasn't already installed the bot and doesn't need to install the bot via REST API.
I have tried following this document.
It clearly states:
"Sending a message to start a new conversation thread is different than sending a message in response to an existing conversation: when your bot starts a new a conversation, there is no pre-existing conversation to post the message to. In order to send a proactive message you need to:"
As far as I understand, this means that what I am trying to do is possible. I have tried to run this sample.
However, as far as I can tell it needs a conversation id. Without a conversation id it doesn't work.
I have tried to send a request like this with a bot network token ( which is normally used to respond to an activity request by the user):
POST /v3/conversations
{
"bot": {
"id": "28:10j12ou0d812-2o1098-c1mjojzldxcj-1098028n ",
"name": "The Bot"
},
"members": [
{
"id": "29:012d20j1cjo20211"
}
],
"channelData": {
"tenant": {
"id": "197231joe-1209j01821-012kdjoj"
}
}
}
However, it fails with the following message:
Send Message to https://graph.microsoft.com/v3/conversations failed: (401) {
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure. Invalid audience.",
"innerError": {
"request-id": "92922235-8c87-47ed-92bc-4ba17469611a",
"date": "2019-09-24T14:43:59"
}
}
}
I am guessing that this maybe because I didn't send MicrosoftAppCredentials.TrustServiceUrl first. But this is a c# call. How do I make the same call in REST API?
Please take a look at Bot Framework REST APIs documentation.
Here are steps to generate the access token which you could use to call Create Conversation APIs.
POST https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=MICROSOFT-APP-ID&client_secret=MICROSOFT-APP-PASSWORD&scope=https%3A%2F%2Fapi.botframework.com%2F.default

Send message from Postman to Microsoft Bot

I am trying to send a message to a bot I created and published to azure services so that the bot can then start messaging some of its users.
I am trying to make the requests on Postman first so that then I can build a controller for that interaction.
I am doing the following request:
POST https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
Body:
grant_type:client_credentials
client_id: my_ms_app_id
client_secret: my_ms_app_secret
scope: https://api.botframework.com/.default
from this I get in the response the Bearer Authorization:
{
"token_type": "Bearer",
"expires_in": 3599,
"ext_expires_in": 0,
"access_token": "eyJ0eXA..."
}
Then I proceed with the following request:
POST https://skype.botframework.com/v3/conversations
Content-Type: application/json
Authorization: Bearer eyJ0eXAi....
{
"bot": {
"id": "i don't have this id so i pass some string",
"name": "connector controller"
},
"isGroup": false,
"members": [
{
"id": "28:...", //ID of the bot I want to send the message to
"name": "Sp Bot"//Name of the bot I want to talk to
},
{
"id": "i don't have this id so i pass some string",
"name": "connector controller"
}
],
"topicName": "News Alert"
}
in response i get the conversation id which matches "id": "i don't have this id so i pass some string":
{
"id": "i don't have this id so i pass some string"
}
Then I proceed with the following POST request:
POST. https://skype.botframework.com/v3/conversations/i don't have this id so i pass some string/activities
Authorization: Bearer eyJ0...
Content-Type:application/json
I get the following response:
400 Bad Request
{
"error": {
"code": "ServiceError",
"message": "The conversationId 29... and bot .... doesn't match a known conversation"
}
}
It looks like the problem occurs between the second and the 3 post method. It looks like that the https://skype.botframework.com/v3/conversations does not generate a conversation with the bot with Id I entered.
So when I make the final call to the bot: https://skype.botframework.com/v3/conversations/.../activities I always get the serviceError message.
Based on your comments you are trying to create a custom "channel/client" to talk with the bot.
For doing that, I would recommend taking a look to Direct Line which seems the way to go for achieving your requirement.
I'm not sure which language are you using, so I will send you pointers to both C# and Node.
These are samples that will show you how to create custom client using Direct Line to interact with your bot:
C#
Basic Direct Line sample
Direct Line sample using Web Sockets
Node.js
Basic Direct Line sample
Direct Line sample using Web Sockets
All the samples are using a console app as the "custom channel".
Since you're going to make an app talk to your bot and most likely be using DirectLine after you and Ezequiel chatted, I created a series of screencaps on connecting to the DirectLine endpoint through Potsman. I'm going to assume that you know how to use environmental and global variables in Postman, here are Postman's documentation for other people's benefit. Also, the DirectLine v3.0 docs are here.
Below is a capture of the directline endpoint you would request a token from, {{DLsecret}}'s guts looks like this, Bearer <your-dl-secret>:
Here is an example of the response body you would receive on a valid call:
You may have noticed that I have some test results, in the screenshow below it has five (vs four) tests because I added the test verifying that the conversationId was set in the environment variables:
Here's the second query sent, which contains an actual message:
This is the request body which has the message:
And here is the response body:

Resources