Logic App HTTP Request JSON from Azure Application Insights Alerting Notifications - azure

I have a logic app setup following these directions to push it to a Teams Channel.
When the alert is notified it sends a message to my Teams channel successfully. However the objects are not parsing out like the example. I tried 2 things.
Copying step 4 (of the above documentation) into the sample payload to generate the schema.
After the Alert is triggered going into the Logic App run history and grabbing the raw outputs, copying those into the sample payload to generate the schema.
Used Common Alert Schema definitions for the payload and things still come in blank in Teams.
Neither of these options filled out the notification that was pushed to the teams channel.
I copied the raw outputs. Put them into PostMan. Sent the request to the endpoint. This worked when parsing the data into the message posted into the teams channel.
It's a simple logic app that is using the designer options:
"When an HTTP request is received" for the payload.
"Post a message with the flow bot to a channel" to post messages to a team channel.
What JSON payload or options should I be using for the ability to use a Logic App to push to a Teams Channel successfully?

I test it in my side, it works fine and I can reproduce your problem.
First I configure the alert to trigger the logic app, then go to "Runs history" of the logic app and find the outputs of the trigger(you mentioned you copied the raw into sample payload to generate the schema), copy the outputs body of raw but not all of the json content of raw (shown as below two screenshot)
After generate the schema, please select all of the parsed fields again because the expressions of the parsed fields which you selected before may not match the properties now (although it may not show error when you save the logic app if you don't select them again). Below screenshot is what I test, I selected all of the parsed fields again, then the logic app was executed as expected.

Related

Replying to Teams message in channel after a specific keyword posting

Trying to understand what would be the right configuration to reply to a message when someone posts a specific keywords in a Teams channel.
Scenario:
Keyword is messaged to Teams channel
Logic App sends out a specific information from Dynatrace as the reply
This should be sort of switch statement because I want to be able to implement different scenarios and send out different configuration information from Dynatrace upon a specific keyword
What has been done:
logic app configuration 1
logic app configuration 2
The error message I am getting when Logic App has been triggered:
logic app execution error
Figured this out by actually assigning the keyword to a variable as a string and then switch statement is checking that keyword, and it did well for me.

Zapier Zap for retrieving customer data from stripe

I have created a Zapier Zap with the following steps:
Catch Hook (Trigger): A webhook which catches post requests with a param customer_id
Find Customer (Action): Stripe integration which takes the customer_id parameter from (1) and retrieves the customer from Stripe
The setup works correctly in the Zapier setup flow, however, when I post to the endpoint from (1) I simply get a 200 return from step (1) alone. Instead I want to receive the data as returned by step (2).
Is this possible using Zapier?
You can't get data back directly when sending a webhook to Zapier. You can read this answer for more info, but the idea is that your zap steps happen asynchronously instead of right away.
You can either add a 3rd step to send the result somewhere (perhaps to the server that's making the initial request to Zapier?) or, run a little webserver yourself that can reply to your initial request with the response you expect.

Why doesn't the Azure Bot Service Slack connector forward Events and Interactive Messages?

Update: June 30, 2020
After more testing, I have details that might help someone recognize my problem.
The issue seems to be that Slack is sending data to Azure Bot Services, but that data isn't being forwarded to my code. Ive been able to use the Bot Emulator without any problems and the Azure Web Chat works fine.
I know that the Slack configuration for the OAuth Redirect URL is correct (I was able to add my bot to Slack) and the Request URL for Events is correct (they sent the 'challenge' and it's verified). I've subscribed to the exact Scopes and Events that are in the Microsoft documentation and I've verified that the Interactivity and Events options are enabled.
When a user types text in my bot's Slack channel, my app receives "message" activity and my code can send a response, so it looks like Microsoft can communicate end-to-end for normal messages. I do not receive any data when users first join my bot (like a ConversationUpdate) or if they click a button in a dialog. I can see Slack sending data when a button is pressed, it just never arrives.
As a test, I copied the Messaging Endpoint from my Azure bot settings and pasted it into Slack's Interactivity "Request URL" and when I click a button in Slack I can see the data that Slack is sending (sadly in a format that my code can't handle).
Original Post
I have a Bot Framework app (v4) that I've written in nodejs. It works well and I have an ActivityHandler that responds to people being added to a conversation and when they send messages. I was able to get pro-active messaging functioning and everything was great until I tried to get interactivity working.
I started off using some sample button code from Microsoft's documentation:
let reply = MessageFactory.suggestedActions(['Red', 'Yellow', 'Blue'], 'What is the best color?');
await turnContext.sendActivity(reply);
This works fine in the emulator, but in Slack it renders as a bulleted list. It looks like that's the way that "suggested actions" are handled in Slack.
I changed my code to use a "hero card":
let card = CardFactory.heroCard(
'What is the best color?',
undefined,
CardFactory.actions([
{
type: 'imBack',
title: 'Color Red',
value: 'Red Value'
}
])
);
let reply = MessageFactory.attachment(card);
await turnContext.sendActivity(reply);
This works okay in the emulator, except my app thinks the user typed "Red Value" and the button stays on-screen and is still clickable. I might be able to work around that, but the button doesn't work at all in Slack. It is rendered fine, but I don't get a notification in my app.
Clicking the button shows an HTTP request to:
https://{MY_SLACK}.slack.com/api/chat.attachmentAction?_x_id=f8d003c3-1592436018.632&_x_csid=NcWi3y50lFU&slack_route={OTHER_SLACK_STUFF}
And I can see that the request POSTs all sorts of data including:
payload: {"actions":[{"id":"1","name":"imBack","text":"Color Red","type":"button","value":"Red Value","style":"default"}],"attachment_id":"2","callback_id":"{MAGIC_NUMBER}:{TEAM_ID}","channel_id":"{CHANNEL_ID}","message_ts":"1592435983.056000","prompt_app_install":false,"team_id":"{TEAM_ID}"}
I'm not sure how to see anything useful in the Azure Portal - the analytics option for my bot doesn't seem to work and the activities option only says "Write a Bot Service". I don't see any sign of the message going from Slack to Azure.
I'm developing locally and configured ngrok so that my messaging endpoint in Azure could be set to https://69fe1382ce17.ngrok.io/api/messages On the Slack side of things, I've configured the Interactivity Request URL to be https://slack.botframework.com/api/Actions The Event Subscription Request URL is https://slack.botframework.com/api/Events/{MY_BOT_NAME}
What I would like is a set of buttons with different options and when the user clicks one, my bot gets some sort of "value" instead of message text. I'd also like for the button to go away so the user can't send repeated commands. It would be nice if the hero card collapsed with just the prompt being displayed.
Are there any interactive options that work for Slack and other channels?
Thanks!
Lee
I know linking to another site with no additional detail is frowned upon, but I don't have enough expertise to answer your question. I suspect the link here might move you in the right direction:
Choice Prompts are not translated over to Slack format #3974
Good luck!
Your question is multifaceted so I'll try to break it down into smaller pieces.
What's the deal with suggested actions in Slack?
Suggested actions are not supported in Slack, but the Bot Builder SDK thinks they are. This is a longstanding bug. I've just reported it again on the docs page you linked: https://github.com/MicrosoftDocs/bot-docs/issues/1742
This means you would encounter problems if you were trying to have the choice factory automatically generate the right kind of choices for your channel. You're not doing that, so you should be fine. Hero cards are supposed to work in Slack.
Why aren't hero cards working in Slack?
First I need to mention that hero cards only work with the Slack connector and not the Slack adapter. You seem to be using the connector so you should be fine.
I suspect your problem is related to how you've configured your bot's settings on the Slack side. There is a step in the Bot Framework doc that seems to be important if you want to get buttons to work. If you've followed the doc exactly and you still can't get buttons to work, it may be worthwhile to dig into the Slack API documentation.
How do I only allow a button to be clicked once?
You can update or delete the activity. There's no easy way to do this, but if you voice your support for my cards library then it can be done for you automatically.
The Slack connector actually puts a lot of relevant information in the incoming activity's channel data, and you can use that to figure out what activity the incoming activity came from. That would take some experimentation on your part.
There's another approach that works on more channels than just Slack. It's real complicated, but if you wanna tackle this then here are the basic steps:
You need to put an ID in the action data to help your bot identify the action.
You need to save the activity ID that gets returned when you send the action to Slack.
You need to associate the returned activity ID with the ID you put in the action data.
You need to retrieve the activity ID using the action data ID when the user clicks the button.
You need to use that activity ID to update or delete the activity.
Unfortunately there's no centralized guide to help you do this, but there are many examples explaining it scattered across Stack Overflow. Here is a good one: https://stackoverflow.com/a/55174866/2122672

No user messages on Chatbase transcripts

I've been trying to take advantage of the Transcripts feature in Chatbase, but whenever I open a transcript all the user messages are shown as (No content).
The messages sent by the bot are all shown properly and the order of the messages is correct as well (both user and bot). On the messages report tab I can see the user messages so they are being sent across properly.
I'm sending all the messages using the generic message API, with the original text on the message field.
This has been happening consistently for me on all projects, so I'm probably doing something wrong..any ideas?
I work on Chatbase and would be happy to look into your issue. If you could please contact chatbase-support#google.com and provide the api key, the name of the bot, or the email address you used to create the account I will be happy to look into the issue for you.

"Request a Web Hook" Form - Filters?

The Evernote documentation on web hooks states the following:
If your service only cares about some notes, we can configure a filter on your API key. Notifications will only be sent when the note matches the filter. For example, the filter resource:image/* causes notifications to be sent anytime a note containing at least one image attachment is created or updated. The filter is configured on your API key, so it is the same for all users. The filter string supports our full search grammar.
This is great, except that the Webhook Request form doesn't have any input to specify a filter.
How do we make a request with specific filters?
If we have multiple environments (dev, stage, prod), is it okay to make a request for the same API Consumer Key but for different URLs?
I got a response to my webhook request via email, at which point they asked if I needed the webhook to point to the sandbox or production environment. In my response, I also mentioned the filter I would like applied, and they proceeded to make the webhook the next day. Overall it took about a week and a half to get it setup.

Resources