Button payload / callback? - hangouts-chat

I want to be able to reply to a user with my bot based on a button they pressed. So far, the only property I can find for button.onClick is "openUrl", but it doesn't seem possible to assign the button a value or a payload / callback URL. Additionally, there is no "Button Tapped" event.
How can I use buttons to allow my user to interact with my bot?

There are multiple ways to add a button response to Hangouts Chat. The primary one seems to be via using Cards with either KeyValue, or ActionResponse.
https://developers.google.com/hangouts/chat/how-tos/cards-onclick
You can use:
buttons.onClick.parameters.keyValue to pass unique Parameters
textButton.onClick.openLink to open a link with a text button
ActionResponse to update a card with a custom card when a Click event occurs.

Related

Telegram Bot api custom keyboard additional data values

Is there any way to pass additional data values from custom keyboard layout buttons?
I need to pass a value like ID that they are hidden from user:
{"Button1",{"id":1}} ...
You cannot do it with custom keyboards, but it is possible with callback_data param of InlineKeyboard
When user will press inline button with callback_data specified message received by bot will be type of CallbackQuery with data param containing your data from the button.
That's not currently possible. It would be a great addition to the API, though, in order to separate the text you see from the value you send back to the bot.

Durandal - Distinguishing entry from a 'back' button vs. navigate()

In my Durandal app, I have a search page - I'd like to:
Load a clean search page when it's loaded from the menu (router.navigate('#/search'))
When navigating to an item from the search page, then using the back button, this should return to the original search result & criteria.
I'm also storing my search criteria & results as a (app-wide) singleton, which is injected to the view model via RequireJS.
Am I able to: distinguish how the user entered the page? I can see that the activate() lifecycle call is triggered under both entry methods.
If you want to know if the user landed to the search page by clicking a link/button from your app or by visiting by entering a url/back button, what I would do is to raise an event when the user clicks on the link/button and on the search page check if the event has been raised or pass some parameter in router.navigate.
I have been recently doing some work on distinguishing a user click from within the application and a back or forward button from the browser. If you are using router.navigate() to navigate around the Durandal application the router.explicitNavigation flag is set to true. But you would want to capture this before the 'router:navigation:complete' event in 'router:route:activating' event as the flag gets set back to false on 'router:navigation:complete' event.
Bottom line is if you are using router.navigate to navigate around the application the router.explicitNavigation property will be set to true and if navigation is triggered using the back/forward button in the browser router.explicitNavigation will be set to false.
In actual case you might not even need to perform router.navigate() to distinguish between an in app navigation and a browser back/forward because Durandal's router module listens to all 'a' tag click on the document level and sets the explicitNavigation flag to true. However I haven't tested this fully.

How to override the service now's email notification onclick event

I have a requirement like, When I click the email notification link in service now, the system should check for particular field is not null or null, if it is not null then only the service now's email notification window should open, otherwise one alert box should come say like pls enter that field first
As long as you are ok w/ all this validation being done client side you could modify the onClick event on the email notification link and add an additional function to check the value of the field and if not null, then call the original email onClick function.
Prototype is available in ServiceNow Forms clients side and provides a method to update attributes on elements.
You would need to modify the onClick function on the element with id='email_client_open', add a new onClick function to check that the field in question is populated and if so call the original function 'emailClientOpen(this, 'incident')' with the appropriate parameters.

Changing CSS variables based on JavaScript events

We have a Facebook app here which has three boxes with three buttons. Each button, when clicked, should change state once an event (successfully) happens. The buttons are almost all working (a few minor bugs) but they have been done a rather long-winded and inefficient way.
My question is, what is the most efficient way to link events (i.e. page 'liked', personal information submitted, page 'shared') with the state of the buttons?
You can use jQuery and the .trigger() function to fire off events. Then you can use .bind() to listen to the events and do something. For example, when the user logs in, you can trigger a user_logged_in_event, and bind to it. In the function, you can then use JS to change the login button to logout...

Any component like "Reply to post/blog" in SenchaTouch 2?

Is there any component like reply to post/blog in sencha touch 2 for giving any reply?
(for clearing question: component like, if we click to reply button then it will show box with subject and data etc)
You would have to implement it yourself, but it wouldn't be too difficult.
You would simply create a view which has a textareafield in it. You would show this view when you tap on a button, and then call field.setValue() with the predefined value you want to add.