Google Chat API: Async Response to Dialog - google-chat

I use slash command with dialog option enabled.
My goal is to provide user ability to search some object. Since search is not a fast action, I want to print in Dialog something like 'Please await'. And when search will be over - update Dialogs content with results.
I found mention about similar action here: https://developers.google.com/chat/how-tos/dialogs#respond_to_a_dialog_with_a_text_message_or_a_card .
But I cannot understand what format of message should be defined.
Could someone provide example?
Problem is to update dialog asyncronously, updating by responses works well.

Related

Drupal: How to Figure Out the token for a Specific Field?

I would like to know how to 'construct' tokens. I have read many examples, but somehow I don't understand them. I am new to Drupal and at the moment I am testing how it works. I'm trying to hide the title of a content type I've created and automatically replace it with the content of another field. As far as I know, I have installed and enabled all the relevant modules including CCK and Automatic Entity Label. The only thing I don't know is what token I should use to make it happen. The field I would like to use as the source for the title field is called event (or possibly field_event) and is of type text. I'm visually impaired and either I'm doing something wrong, or the token browser is not too screen reader friendly. Either way, I can't access the list of all tokens to select the token, so I have to enter it manually. If I'm not mistaken, the token should include '[node:body]', right? But is it like '[node:event:body]' or '[field:event:body]' or something else?
Many thanks!
One Idea might be the devel module https://drupal.org/project/devel . Install it, activate it and visit some page of the node type you want to use the token on, and click on the devel tab and then on the token tab. et voila. or you navigate directly to e.g. yoursite.com/node/29/devel/token .
Hope it helps.

How to debug Google DFP?

The standard ?google_console=1 isn't working for us at the moment. We're using the Google Publisher Tag (asynchronous).
The Google publisher console is OK for spot checks, but I'd highly suggest moving away from that method. Sometimes the Google pub console will list partial data for ad units...and I have had rough experiences with using the Google pub console for debugging sync GPT.
If you're using Chrome, a stronger method would be the following:
Load the page.
Open the Chrome Developer Tools, and click on the Network tab.
In the filter field, enter "doubleclick" (minus the quotes).
Ctrl+R to refresh the page.
All the DFP ad calls will begin populating (typically have ads and gampad references in the name).
Click on an ad call. The info should display in the right panel.
For quick reference:
iu: (the ad unit portion of the string)
Cust_params or scp: typically most custom criteria targeting values should display in either of these two, depending on tag implementation
Additionally, in the Response tab, under Headers, the Google Line Item ID and Google Creative ID will be listed....this is extremely helpful for debug/troubleshooting. You can also see XML returns for video creatives.
Also, if you need to debug outside of Chrome, Charles/Fiddler are good debug alternatives. Keep am eye out for the Query String and Header tabs, but the same info should pass thru. Filtering is key.
Hope this helps.
Just try to run the following command in JS console:
googletag.openConsole();
Note: You can also specify ID of the div element containing the ad slot in the function argument.
Or paste the following code into the bookmark in Bookmark Manager:
javascript:googletag.openConsole();
then navigate to the website and click on newly created bookmark.
Or use the following HTML code to create a link on your content page, e.g.:
Open console
See also:
Enable the Google Publisher Console
GPT Reference

Create a button like the Facebook "like" button in Drupal

I would like to create a button with the name "Participate" that works like the "like" button on facebook.
I have an contenttype called Event, which should show the participate button, that logged in users can click, and add themselves to the event.
When looking at the content for Event I would also like to display a list of the users which have clicked the Participate button.
Is there someone who can help me with how it can be solved or what i should look into?
take a look at this module with some php knowledge you can make it , it's not what you really want but this guys pushed the hard part
The Activity module keeps track of the
things people do on your site and
provides mini-feeds of these
activities in blocks, in a specialized
table, and via RSS. The module is
extensible so that any other module
can integrate with it. The messages
that are produced are customizable via
the admin interface and are context
sensitive. Some theoretical example
messages include:
You wrote a comment in response to "example comment title"
Jim wants to be your friend. Approve this friendship here
Nancy is Phil's latest fan
http://drupal.org/project/activity

Redirecting search results into an ASP.NET page

I've an ASP.NET page with a textbox and a option from user of the following choices: Wikipedia, Google, Dictionary.com, Flickr, Google images.
The user enters a word(s) in the textbox and selects a choice among the following.
Depending on the choice select by the user I wish to return the following.
Wikipedia: Return the content and link to the page corresponding to the topic about the word.
Google: Return the top 10 results of google search for this word.
Flickr: Return a few images atmost 10 images from flickr search
GoogleImage: Return a few images from google image search.
Dictionary: Return the meaning of the word.
How can I do that?
Since you are wanting to do some processing on the results prior to displaying them, your best bet is probably to invoke a web request on the server to fetch your results as RSS or some other parsable XML format.
So first up, we have Wikipedia, which has API support for open search, and queries with XML or JSON output. You can get the details of the API by going to: http://en.wikipedia.org/w/api.php
I would think either the query action, or opensearch action would be what you want.
Right, now there is Google, which supports search results as RSS through their Active Search feature. The link takes you to the main page where you can build the query, at which point it should be easy to drop in your search terms. There is also the Google Search AJAX API, which you can find out about here (See the "Flash and other Non-Javascript Environments" section for building the URLs directly. I believe this option should give you access to Google Image results as well.
For Flickr, have a look at this App Garden page. There are several output formats available to choose from.
I wasn't able to find anything real solid on getting results from Dictionary.com, but it does appear that they have an API. You might be able to dig through google and find some references on how to get search results as XML or JSON. There are also several other Dictionary sites which may have more information about their APIs. While searching I managed to find this SO question about word lookup from google dictionary.
Hope this helps.
Have an iframe within your page, and then set the src of the frame to the appropriate query string that you craft from the user's input.
This can be done from javascript within the page, in response to the user selecting something in the 'choice' dropdown. You can have the appropriate urls already embedded in the javascript (as variables), and just substitute in the user's input.

API for word definitions

i'm trying to implement a little app which basically only hs a label, textbox and a button and when the user enters a word, i want to connect to some online api to retrieve the word's definition and display it in the label. is this possible? all i keep finding is api's related to other stuff on google/other se's. but i have seen this in practice before so i know they are out there, i just don't know where.
I suggest you try WordNet. It has got an API that you can use over the web.
Check it out here: http://wordnet.princeton.edu/wordnet/related-projects/#web
If you search more probably you will find, but let me give you a hint:
You can make a http web request to any website who handles word definitions. You can even search for "define: " + word in google and get the response.

Resources