I'm working with the O365ConnectorCard capabilities in Teams for bots and I'm trying to recreate the scrolling list of people the new Who bot can produce when you say something like who works with jim#contoso.com?.
You can see what it looks like here.
If it is using the connector card functionality, I'm assuming that is a Section but maybe using undocumented syntax? Additionally, the sections are clickable from the Who bot, but no matter what combination of PotentialAction added, I cannot get the row to have a hover and click of type imBack.
The MessageCard Playground as well doesn't have any examples that match what that Who bot can produce.
Anyone know how this was done? Any MS folks want to post some sample JSON of what's possible but not available yet from the Microsoft.Bot.Connector.Teams NuGet package :)? I'm currently up to v0.8.0.
Thanks!
I believe the Who bot is using the List Layout. The list layout is used to display a collection of cards in a stacked list.
We haven't documented these new card formats yet - we were waiting for Who bot to ship, but there are actually two new card formats, PersonCard and ListCard. You can see some commented-out examples of how to use them here: https://github.com/OfficeDev/BotBuilder-MicrosoftTeams/blob/3c6f07b7600bb20713626cbf79acf5e114e57d0d/CSharp/Tests/Microsoft.Bot.Connector.Teams.Tests.Shared/CardTests.cs.
ListCard is different from List, and there are supports for three kinds of objects in a list: Person, File, and a generic one called "resultitem" - that latter one may not render properly on Android. There's also a way to add a separator line.
This may or may not be enough to get you going, but in case you find it useful:
{
"content":{
"title":"Test List Card",
"items":[
{
"type":"section",
"title":"List Card section"
},
{
"type":"person",
"id":"shmayura#microsoft.com",
"title":"Shanmathi Mayuram Krithivasan",
"subtitle":"SOFTWARE ENGINEER",
"tap":{
"type":"invoke",
"title":"Details?",
"value":"{\"intentName\":\"WhoIs\",\"employeeName\":null,\"employeeEmail\":\"shmayura#microsoft.com\",\"topic\":null}"
}
},
{
"type":"file",
"id":"https://microsoft.sharepoint.com/teams/skypespacesteamnew/Shared%20Documents/Design/FinancialReport.xlsx",
"title":"FinancialReport",
"subtitle":"teams > skypespacesteamnew > design",
"tap":{
"type":"openUrl",
"title":"Open url",
"value":"https://microsoft.sharepoint.com/teams/skypespacesteamnew/Shared%20Documents/Design/FinancialReport.xlsx"
}
},
{
"type":"resultItem",
"title":"Seattle to Chicago",
"subtitle":"$500 July 4 - July 8",
"icon":"https://skypeteamsbotstorage.blob.core.windows.net/bottestartifacts/sandwich_thumbnail.png",
"tap":{
"type":"imBack",
"title":"Reply",
"value":"flightto Chicago"
}
}
],
"buttons":[
{
"type":"imBack",
"title":"Open Online",
"value":"editOnline"
}
]
},
"contentType":"application/vnd.microsoft.teams.card.list"
}
Related
Currently I work in a bank where it has a Watson bot and I need to capture and save the intention prior to a specific intention that generates the derivation with a human. I need to do this to know the last topic the user talked about before the referral with a human
Your dialog that recognises the previous intent should save that intent in a context variable. You can set it to any arbitrary value that makes sense to your dialog.
If you did want it to match an intent, you can set it to the intent eg. where abc is the intent you are capturing
#abc
If the intent is abc then #abc is true, else it is false.
You can save the intents in a context variable using <? intents ?>
intents is an array of objects that have this structure and is sorted in descending order of confidence.
[
{
"intent":"greeting",
"confidence":1
},
{
"intent":"yes",
"confidence":0
},
{
"intent":"pizza-order",
"confidence":0
}
]
You can find more info about this built-in variable here
When you post an query with syntax errors graphql/graphene makes suggestions to you. By example, sending "i", it suggest "ID".
query{
users{
i
}
}
{
"errors": [
{
"message": "Cannot query field \"i\" on type \"User\". Did you mean \"id\"?",
"locations": [
{
"line": 5,
"column": 9
}
]
}
]
}
Can suggestions be disabled?
More info:
Syntax analysis who add suggestions is executed before the middlewares.
Apparently suggestions are made by ScalarLeafsRule class.
Ok, people in graphql-core github repo is awesome, they helped to me to solve this.
So graphql-core has two relevant versions, 3 (current) and 2.3.2 (legacy).
For graphql-core 3, quoting to Cito
Ok, if you want to keep it closed and also disable introspection it makes a little more sense. I suggest you simply set graphql.pyutils.did_you_mean.MAX_LENGTH = 0. I just commited a small change ffdf1b3 that makes this work a bit better.
You can also ask over at https://github.com/graphql/graphql-js/issues if they want to add some functionality to support your use case. From there it would be ported back here.
For legacy version:
from graphql.validation import rules
def get_empty_suggested_field_names(schema, graphql_type, field_name):
return []
def get_empty_suggested_type_names(schema, output_type, field_name):
return []
rules.fields_on_correct_type.get_suggested_field_names = get_empty_suggested_field_names
rules.fields_on_correct_type.get_suggested_type_names = get_empty_suggested_type_n
You can place it on django settings file.
Please follow all the thread on https://github.com/graphql-python/graphql-core/issues/97
I'm not sure how to deal with rich content. Some examples that I want to return are a list of hyperlinks or a/some image thumbnails. How do I do this? I tried formatting my text as HTML and that crashed the Bot Emulator and caused the Web Chat client to just display encoded HTML.
Is there a secret to this or some documentation explaining this?
Markdown. Bot Framework converts Markdown to the rich native formats for each channel.
Some channels support even richer content via the ChannelData field (for example, you can send Slack Cards through our Slack channel in the ChannelData field) but all of our channels do the right thing for that channel if you send Markdown.
Edit: docs here: http://docs.botframework.com/connector/message-content/#the-text-property-is-markdown
You may find github's link helpful:
https://guides.github.com/features/mastering-markdown/
Style Markdown Description Example
Bold **text** make the text bold
Italic *text* make the text italic
Header1-5 # H1 Mark a line as a header
Strikethrough ~~text~~ make the text strikethrough
Hr --- insert a horizontal rule
Unordered list * Make an unordered list item
Ordered list 1. Make an ordered list item starting at 1
Pre `text` Preformatted text(can be inline)
Block quote > text quote a section of text
link [bing](http://bing.com)
image link ![duck](http://aka.ms/Fo983c)
Note the channels will vary as to what subset of markdown they support.
You may find this thread useful with some examples and Yes MD is the answer.
https://github.com/microsoft/BotFramework-WebChat/issues/2289
so say if you want to do an unordered list.
Unordered list\r\n\r\n* An item\r\n* Another item\r\n* Yet another item\r\n* And there\'s more...\r\n\r\n
Unordered list
An item
Another item
And there\'s more...
https://docs.botframework.com/en-us/core-concepts/channeldata
example attachment https://api.slack.com/docs/message-attachments
you have to change source and twist attachment in below code.
I am able to deal with rich document in slack
refer this slack example with rich content with Microsoft bot framework
enter code here
bot.dialog('/', function (session) {
session.send('Looking into your upcoming flights to see if you check-in on any of those...');
var card = {
slack: {
"attachments": [
{
"fallback": "Required plain-text summary of the attachment.",
"color": "#36a64f",
"pretext": "Optional text that appears above the attachment block",
"author_name": "Bobby Tables",
"author_link": "http://flickr.com/bobby/",
"author_icon": "http://flickr.com/icons/bobby.jpg",
"title": "Slack API Documentation",
"title_link": "https://api.slack.com/",
"text": "Optional text that appears within the attachment",
"fields": [
{
"title": "Priority",
"value": "High",
"short": false
}
],
"image_url": "http://my-website.com/path/to/image.jpg",
"thumb_url": "http://example.com/path/to/thumb.png",
"footer": "Slack API",
"footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
"ts": 123456789
}
]
}
}
var msg = new builder.Message(session).sourceEvent(card);
session.send(msg);
});
Pretty straight forward question, as soon as i use setseries data the visibility my pie chart is no longer visible. I have checked the plot object and the series were updated correctly, however since I do not find a visibility attribute anywhere in the plot object, i am at a loss.
The lack of zingcharts documentation and proper examples does not aid either. Im fairly certain this is a simple scenario to solve, but I've been unable to do so.
zingchart.exec('organismplot', 'setseriesdata', {
"data": [
{
"values":data_update.organisms,
"text":"active",
"background-color":"#2d4962",
"border-width":"1px",
"shadow":0,
"visible":1
},
{
"values":(data_update.totalorganism-data_update.organisms),
"text":"passive",
"background-color":"#2d4962",
"border-width":"1px",
"shadow":0,
"visible":0
}]
I'm a member of the ZingChart team, and I'm happy to help you out!
What is the type of data_update.organisms and data_update.totalorganism-data_update.organisms? Make sure that you are passing a single element array, or if those are simply single values, wrap the variables in brackets to create a single value array for the "values" attribute. E.G.:
"data": [
{
"values":[data_update.organisms], // If data_update.organisms is a single value.
"text":"active",
"background-color":"#2d4962",
"border-width":"1px",
"shadow":0,
"visible":1
},
{
"values":[data_update.totalorganism-data_update.organisms], // Again, single value array.
"text":"passive",
"background-color":"#2d4962",
"border-width":"1px",
"shadow":0,
"visible":0
}
]
I've created a demo using your exact method call, except I've changed the "values" attributes to use a single value array, which are needed for pie charts. Check out the demo here.
I hope that helps. Let me know if you need some more help!
How can I get the optional result data values from the Steam Web API?
For example, from GetPlayerAchievements I also want the name and description.
So far I use this URL: http://api.steampowered.com/ISteamUserStats/GetPlayerAchievements/v0001/?appid=MYAPPID&key=MYKEY&steamid=MYSTEAMID
You need to add &l=en to the end of your URL. This adds the language dependent fields of name and description to the results.
en can be substituted for other supported languages
Example for a player's Team Fortress 2 stats:
URL: http://api.steampowered.com/ISteamUserStats/GetPlayerAchievements/v0001/?appid=MYAPPID&key=MYKEY&steamid=MYSTEAMID&l=en
Returns a JSON result that has this block in the ['playerstats']['achievements'] array
{
"apiname": "TF_PLAY_GAME_EVERYCLASS",
"achieved": 1,
"name": "Head of the Class",
"description": "Play a complete round with every class."
}