Matrix.org Bot with UI/Cards and Clickable buttons - matrix

Tldr; Need to send messages into Matrix room, with message having UI and Clickable buttons.
First of, I am junior developer (1 month experience) working for an enterprise (xyz).
Matrix is one part of the big project. Basically, Company XYZ will generate some Json data, that I need to send in a Matrix room (with multiple users in room).
I have to make a readable UI/Card from that Json, and send it in room. This card will have some buttons that room users can click.
On user click, we get back an event about which button was clicked, and perform any corresponding action.
We are also making same thing for other chat apps like Teams and Slack. There, we have a bot for sending message. And Adaptive Cards for Teams UI and Block Kit for Slack UI. I am looking for something similar in Matrix.
I found inline widget and Room Widgets related to my requirement.
1.Has Inline Widgets been implemented yet?. Any documentation would help
2.Will Room Widgets work for my requirement?
3. Any other option, without using bot that can work for Matrix

Related

Is it possible to move the position of Action.ShowCard's new Adaptive Card?

I am using "Action.ShowCard" to show another card in adaptive cards - specifically spfx ACE in the Viva Connections Dashboard.
I cannot see a way to get the new card to appear anywhere other than the bottom of the parent card. Is it possible to get it to appear somewhere else? Ideally I would like some more content under the button that calls "Action.ShowCard".
For example, if you look at the simple examples here: https://adaptivecards.io/explorer/Action.ShowCard.html you will see that the new adaptive card that is shown to the user always appears at the bottom. This is OK when there is not much content on the parent card, but when the parent card has a lot of content then the user experience is not so good as they miss the new content at the bottomn of the card.
If you are in Preview mode, you would single click to expand the card. When editing, you need to double click the Action.ShowCard button to have it display its associated fields. Then, you can add the additional actions, etc., that you want.

My buttons don't align in Emulator, browser or any other channel

I'm writing a bot and making heavy use of HeroCards and Adaptive Cards.
When I use the Adaptive Card Builder, the buttons always line up horizontally which is what I need. Once deployed, they always end up stacking on top of each other vertically.
This creates a huge problem especially in cases where pressing the button launches an action like opening a set of radio buttons of a textbox that asks for user input: the box will appear at the bottom (or whatever controls).
Outside of looking bad, the functionality gets confusing b/c users may think they are answering the wrong item.
Here are two examples:
How it should look and does look in the designer:
Here's what they look like in the channel:
Also, I'm just curious, the purple buttons on the Q&A builder, are those just traditional buttons or are those called something special? I was using it at first, but then moved to LUIS which doesn't seem to drive the difference, but just as a FYI, I want the same buttons to line vertically, this is the result of what happens (compared to item 1):
I have the code, but I think it's something in the frame or was thinking it was the emulator, but even when I go to the bing channel (seems to render only in Edge but I think it's b/c of Ghostery with Chrome).
Is it the container, b/c the code in the builder always looks right?
And sorry to be redundant, but on the Q&A, if someone can tell me if the purple buttons have a equivalent in cards in Bot Framework and they are just styled or if it's specific to Q&A I'd be very grateful.
Glad to post the code is it'd be helpful, but I'm stumped.
In order to achieve the purple buttons, you'll have to style the WebChat component yourself. The BotFramework-WebChat README on Github describes how to achieve this. You can easily style the buttons with CSS, to achieve your own look and feel.
The vertically lined buttons look like a HeroCard with buttons, however I am not 100% sure. The look and feel of an Adaptive Card can differ between multiple channels at the moment, since it isn't really mature yet. However this can also be styled.

Track scroll in google universal analytics

I would like to know if "scroll" event can be added to the Google analytics universal code? i have the below
setTimeout("ga('send','event','engaged users','page visit 30 seconds or more')",30000);
I wanted to track visits over 30secs that the scrolls
You can use window.scroll which is available in the jQuery API.
$(window).scroll(function() {
ga('send','event', 'engaged users');
});
See https://api.jquery.com/scroll/
There are several plugins/libraries out there that add scroll tracking, but if you want to do it yourself make sure you don't send too many events.
You shouldn't send an event to GA directly on the window.onscroll event - this is fired dozens of times a second. It will chew through your hit allowance and it won't provide any useful data.
Even a sampled scroll event isn't much better (where you set a timeout every few hundred milliseconds to check if the user has scrolled) - it still sends potentially hundreds of events user page view.
You should either set it to fire on certain scroll "thresholds" (e.g. 20%, 50%), or, the better way in my opinion is to store a variable with the maximum scroll depth and then use the document.onbeforeunload event to fire just one event at the end of the user's page view. This gives way more accurate data and doesn't send too many events.
onbeforeunload has some browser inconsistencies though (especially on mobile), so you'll want a fallback for that. There's a full tutorial here on creating a cross-browser scroll tracking plugin with tons of code examples here: building a better scroll tracking plugin

Create multiple page form in Cocoa

I want to create a form with iOS like transitions (in a Cocoa desktop application) between the form input. For instance, the user would input information to the form and click next to continue to input the remainder of the information. On the last form, the user would click submit. Upon clicking next, the form would have an animated transition, like on the iPhone before displaying the next set of forms. Sort of like how Turbo Tax ask a ton of questions before allowing you to submit that grouped information.
What would be the best approach to achieve this goal?
This is commonly referred to as a wizard.
You basically have two options:
Use a tabless tab view, following Apple's sample code in AnimatingTabView from http://developer.apple.com/library/mac/#samplecode/Reducer/Introduction/Intro.html
Manually swap the views in and out yourself.
There are pros and cons to both approaches. Which you choose will probably depend on your requirements. One issue with Core Animation on the desktop is lack of subpixel rendering for layer-backed views. This is mostly an issue with text display but some people find it not to be an issue.
I've needed this functionality a few times. I used this tutorial to get started.

Best Bar Code Scanner for both Web Form/ Win Form input

I have an application that prints eTickets. Originally I used the cool 2-D bar code because it allowed me to use the GUID as the code. However scanners that can scan 2-D bar codes are way too expensive. So now I just use any of the codes that the Telerik Reporting too offers, like code39
http://demos.telerik.com/reporting/barcodes/demo.aspx
I want to allow people to scan the bar code with a scanner connected to the host computer via USB. The scanned code should automatically appears on the textbox of either the Web Form or win Form.
What USB Hand-held scanners do you recommend in the sub-$100 range?
I just got the "Adesso NuScan 1000U Bar Code Reader"
If you use it on a Web Form, it works like this:
You click in the textbox, when developing the page you may want to use a javascript focus to make sure that the textbox is pre-selected.
Then you scan the bar code.
The scanner will put the bar code directly into the textbox and hit the return key.
If you are using .net web forms I would recommend putting your form in a asp:panel and in the panal properties set the default button to the button id. This way the correct button will be hit on return.
Here's the details of my results: Bar Code Scanning for eTicketing software
As far as the USB scanners go, this isn't the site for that kind of question. However, you may want to look on Google Shopping.
Many of the barcode scanners turn the image into a numerical sequence based on the width of the bars. Given that they do that I've seen a few of these scanners act as a HID [keyboard/mouse input device]. I would instruct the user to put the cursor in a text box and scan, or type the bar code number in manually. After there is a text change, send a AJAX request or postback to handle the logic from there.
you could go through the trouble of implementing a webcam as a barcode scanner. Google returns lots of results. Here's one from sourceforge:
http://sourceforge.net/projects/zbar/
This has the benefit of being really cheap and available to many people, but it doesn't work as awesomely as does a real scanner.

Resources