How can I have carousel of basic cards in google actions app - chatbot

I want to show a carousel with a list of of basic cards (https://developers.google.com/actions/assistant/responses#basic_card) in google actions conversation response. I looked at the rich response(https://developers.google.com/actions/assistant/responses#rich-responses) and it allows only one basic card in it.
The reason I want to use basic card instead of carousel of option is simple. When I click on the carousel option it proceeds to next conversation, but with basic card I will be redirected to the external link, which is what I needed.
I'm using the code below to display a list of items(options) in carousel for a chat response currently. Any suggestions and help appreciated
let carousel = app.buildCarousel()
// carousel.addSimpleResponse();
products_raw.forEach(function(item){
console.log(item);
carousel.addItems(
app.buildOptionItem(item.title,)
.setTitle(item.title)
.setDescription(`Price: ${item.price}`)
// .addButton('know more', item.url)
.setImage(item.image, item.title)
// .setImageDisplay('CROPPED')
)
});
app.askWithCarousel(answerData.message_text, carousel)

You can make a carrousel or list selector with multiple sites that you want to be able to choose from. Then when a user selects an item, build a basic card with the site you passed from the selector.

You can't. The two are intended to serve different purposes.
Carousel cards are meant to advance the conversation and provide visual information as part of advancing it. It isn't really meant to provide a final result or to produce something that takes you out of the conversation.
The basic card is meant as part of a result that supplements the voice part of the conversation. It can be the "end result" of a conversation, although it doesn't need to be. As such, it makes sense that it allow linking out to a website.
If you have a number of results as part of the conversation, it may be that there is more you need to do to advance the conversation along still.

You can use browsing carousal for your use case, Browsing Carousel

Related

How to set starting options in facebook messenger for pages?

Is it possible to set starting options in facebook messenger for pages like example bellow:
example of expected result
I figured that similar could be achieved by using messenger BOT with 'start button', multiple BOT replies with 'quick reply' buttons and passing conversation to live chat in required cases.
The problem with this is that after user clicks 'get started' button BOT publish text replay 'Get started' which is not desired.
I wonder if there is an build-in setting to achieve this? If not, how would one solve it?
EDIT: It seems to me, it is not possible to build something like that neither with facebook quick reply neither with templates/buttons
EDIT 2: I also tried doing this in Facebook's page settings with no result. It seems it doesn't have anything to do with Facebook's 'quick replies'
First of all there is no way to set those options from facebook platform itself. Those questions are generated by facebook to give user a head start to a conversation and those are generated based on the type of page you are created. To see the option go to
Your Page's Settings-> Messaging -> General Settings
It is ideal that you will configure the 'Get Started' to initiate conversation with your bot and then show users a bunch of options using various templates like quick replies, carousel, list etc. By this way you have full control over your templates and expected answers.
But then again if you want to use those generated options from facebook then you can look for those option's text in the delivered json to your configured web hook. Here is a sample json:
{"object":"page","entry":[{"id":"","time":1519980744192,"messaging":[{"sender":{"id":""},"recipient":{"id":""},"timestamp":1519980743903,"message":{"mid":"","seq":1,"text":"Could you give me a call? I'd like to speak to someone."}}]}]}
Look at the 'text' attribute. The text is from after clicking one of those options. But again this is not ideal as the options can get changed anytime by facebook's algorithm.
My suggestion is to use 'Get Started' button and then send a list to the user.
The screenshot you posted shows a features that is currently being tested for Pages, so it is not available to every Page. There is no built-in way to do this, other than sending quick replies in response to the get started postback, messaging_optins or messaging_referrals events.
You can create a persistent menu to achieve this.
Here are few video tutorials I created to help you with Facebook integration and sending rich messages in facebook messenger through Dialogflow.
https://www.youtube.com/watch?v=fJ4HoYxoKl8
https://www.youtube.com/watch?v=JC9Y-AmcL6A

Generating a dynamic Buy Now button

I am currently speccing out a custom auction plugin for WordPress. One thing I would like to do for each item is to generate a dynamic Buy Now link that will redirect to a PayPal screen with the item name and final price.
From what I can see, the only way to generate one of these buttons is to go to the form that generates the buttons for you. Is there a js file that I can use to generate these buttons from a Wordpress admin area? If so, can someone please provide a link so that I can begin reading up on the documentation?
Thank you
There are several examples of how to create a "pay now" button on stackoverflow (with simple HTML form). I would rather not use the "insecure" forms.
For including it in Wordpress you need to create a PHP Script (Plugin) that creates you the button, either with a library or "by hand".
The second thing I would recommend is to give PayPal an URL they should call after a payment status change (IPN). Some libraries (as the one above) can help you with that.

Is there a way to embed an iframe in an email with text that updates?

I want to embed an iframe inside an email that contains the 10 most recent chat messages. Is there a way to make this iframe dynamic so that it always shows the latest 10 chats regardless of when the email is opened? If the iframe is not the correct way to do this, is there a better way?
You can implement an iframe into the email - but your mail will be recognized as spam by many providers.
You should try to render your content dynamically into an image and implement that image into the email.
There kind of is a solution. It is using Dynamic CSS with a fallback of a Dynamic image to pull the information. It is not elegant really as for some clients (e.g. Outlook) this is not available at all and will only display initial information. It also utilizes a link for a style sheet which also severely limits which clients this will work in.
The fall back dynamic image is a bit more comprehensive in client support, but much harder to maintain as you will need to build something that programatically pulls the tweets (HTML webpage potentially) and then also have something that creates and hosts an image for the email to pull. This is not a short, simple thing to set up and may not be worth the required back end work for a simple email.
See this link for a bit more in-depth info on how this can be done for adding a live twitter feed into an email: https://litmus.com/blog/how-to-code-a-live-dynamic-twitter-feed-in-html-email
Since there was no accepted answer i thought i would give my input as well.
Litmus had done something similar for their live twitter feed in emails sometime ago.
The method i can think off is to create a PHP page which takes 10 images and makes it into 1. PHP can have a loop that checks for increments from a specific number and if it exists then add to that 1 image. When there is a new chat image added, PHP will disregard the last one and add the new in the loop.
For anyone reading this in 2022, this is possible with AMP.
Instead of an iframe, you can create a dynamic email easily.
check out amp.dev
Note: AMP is not supported by many email clients

Want to share a particular block or div from my entire page into facebook

I have a requirement that in a webpage I have multiple block of content which is wrapped inside individual DIV. Each block needs to have a share to facebook button.
Did many researches but couldn't find a solution. Please can anyone give me a suitable code or idea how I can share particular blocks/content wrapped inside a div into facebook.
For e.g.
I have three DIV in my page and each DIV has share button, when user clicks on any of the share button the respective DIV is shared.
Is there any solution to this requirement or whether is it possible to do. Any kind of suggestions are widely accepted.
Check out this HyperArts tutorial on adding a Share Button to an iFrame tab - you use the exact same code for your webpage. You will be using the Facebook JavaScript SDK.
At the end of the tutorial it explains how to modify it to allow for multiple Share buttons on one page. You just need to add a unique identifier for each one.

Facebook actions like spotify?

I'm trying to understand actions and objects on facebook and im completely blown away by how spotify publishes actions with that format. How the heck do you customize the layout of a user's action like that?
As far as im concern, with facebook's lovely documentation, all you can do is publish actions on a single line : (user A) -- (action) -- on -- (object) followed by a title and description.
How do you design html/css layout of a user's actions? Link? Attachment? I'm guessing you have to do some sort of "magic" on the description? Thanks!
Facebook's open Graph Tutorial does a decent job of explaining this but with the various options you have to scroll for a while to make it to the grouping part. In short, the individual actions you're familiar with combine together via "aggregations" which can be set to show a number of formats from lists to grids.
To set one of these up you must configure your Actions and Objects via the open graph settings first and then manually create an aggregation and a few defaults to fill in for preview purposes.
This will show up when a user authenticates your app for open graph and becomes customized to them as they start actually using said actions.
Now as for the play button option, that's something I assume is unique to their integration.
Documents at https://developers.facebook.com/docs/beta/opengraph/tutorial/