How to display response messege as response card in Amazon aws lex? - amazon-web-services

I have created a simple chatbot with the following flow.
Bot: do you want to buy a book?
Human: yes
Bot: what kind of book are you interested? (Response card)
-drama
-crime
-action
Human: drama (on click or typing)
Bot: Here is list of available drama movies in store(response card)
- Django
- first man
-true story
The last part is problem , I can't figure out how I can achieve that.
Can some one please help me what do I need to do to get what I want? Similar demo or tutorial Will be appreciated.

Here you need to add a response card using your Lambda code because the values are dynamic (available movies).
Here is the example code of adding response card:
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled or Failed",
"message": {
"contentType": "PlainText or SSML",
"content": "Message to convey to the user. For example, Thanks, your pizza has been ordered."
},
"responseCard": {
"version": "1",
"contentType": "application/vnd.amazonaws.card.generic",
"genericAttachments": [
{
"title":"card-title",
"subTitle":"card-sub-title",
"imageUrl":"URL of the image to be shown",
"attachmentLinkUrl":"URL of the attachment to be associated with the card",
"buttons":[
{
"text":"button-text",
"value":"Value sent to server on button click"
}
]
}
]
}
}
This is an example of adding response card in a fulfimmnet message, you can add this in elicit_slot as well. Play around it and let us know if you have any confusion.
Hope it helps.

Related

Google my business not fetching reviews correctly

I'm currently using Google's api for fetching reviews of a Google My Business Account. We do this for our clients, which have to enable oauth for us, so we can have an access token and a refresh token.
The response we get, has the following structure:
url: https://mybusiness.googleapis.com/v4/accounts/{account_id}/locations/{location_id}/reviews
{
"reviews": [
{
"reviewId": "some-id,
"reviewer": {
"profilePhotoUrl": "some-url",
"displayName": "Some Sample Name"
},
"starRating": "FOUR",
"comment": "Some long comment left by the user.",
"createTime": "2021-02-15T14:35:19.252Z",
"updateTime": "2021-02-15T14:35:19.252Z",
"reviewReply": {
"comment": "Some long reply by the business.",
"updateTime": "2021-03-04T16:49:32.973Z"
},
"name": "accounts/{account_id}/locations/{location_id}/reviews/{review_id}"
},
...
],
"averageRating": 4.5,
"totalReviewCount": 1312,
"nextPageToken": "some-page-token"
}
The problem is, for some set of clients, we are getting just an empty object (literally, we are receiving {} as the response body). We are not sure why this is happening, since we are able to see reviews on the client's web site, and we are not getting any error. We've refreshed tokens and refreshed tokens without any success.
I've tried posting a support ticket with GCP in order to get some guidance, but it seems that you don't get any help in this kind of issues if you don't have the right support plan.
Anyhow, any help on this issue (why is happening? can it be fixed? is it a setup problem? etc.) is very much appreciated.

AWS PinPoint - SMS Message From Postman

I'm trying to initiate a SMS message using Postman, but I keep getting a response indicating "Invalid Request Body". I can't seem to find a good example on the AWS documentation (Is it just me or does anyone else encounter this with AWS?)
Below is the request body I'm submitting with my request. Any help would be much appreciated!
{
"ApplicationId": "<MyApplicationID>",
"MessageRequest": {
"Addresses": {
"[{{Destination}}]": {
"BodyOverride": "Test",
"ChannelType": "SMS"
}
},
"MessageConfiguration": {
"SMSMessage": {
"Body": "Test",
"SenderId": "Test",
"MessageType": "TRANSACTIONAL",
"Keyword": "<MyKeyword>",
"OriginationNumber": "<Origination number in E.164 Format>"
}
}
}
}
Looking at the Amazon Pinpoint SendMessages REST API, the request body doesn't include either the application-id key or MessageRequest key.
Resolution:
You will need to put the Amazon Pinpoint application-id in the URI part (or create an environmental variable) and then specify the request body as shown below :
Hope this helps!

Facebook API process shared object [duplicate]

I just tried through the Graph API Explorer with this path /v2.4/10153513872748291 and I've got this result:
{
"error": {
"message": "(#12) singular links API is deprecated for versions v2.4 and higher",
"type": "OAuthException",
"code": 12
}
}
But https://developers.facebook.com/docs/reference/api/post/ doesn't say anything about deprecation.
I'm not sure if I miss something, or there's another way to get info about an individual post.
Edit: v2.3 works, but v2.4 is the latest one.
Looks like you now need to the combination of the id of the user or page that made the post (or whose wall it is on), an underscore, and then the post id.
For your example post, 10153513872748291, that is made by a page Drama-addict, that has the id 141108613290 – so 141108613290_10153513872748291 will work.
And so does 788239567865981_10153513872748291, because 788239567865981 is the id of the user making the post.
Firstput userId underscore add postId /Likes to check Like status in facebook
userId_post_Id/Likes to fetch Likes Records
userId_post_Id/Comments to fetch Comments Records
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=303261006522998_751199848395776%2FLikes&version=v2.9
**In this link Right side Get Token indide GetAccessToken to select Permission**
303261006522998_751199848395776/Likes
303261006522998_751199848395776/Comments
{
"data": [
{
"id": "124778301449917",
"name": "Manisha Gera"
},
{
"id": "1680577265523548",
"name": "Rubi Sharma"
}
],
"paging": {
"cursors": {
"before": "MTI0Nzc4MzAxNDQ5OTE3",
"after": "MTY4MDU3NzI2NTUyMzU0OAZDZD"
}
}
}

Sharing a photo with text

The "Add a cat to that" example explains how to share a photo with my service.
But is there a way to share a photo with a text (using voice recorder) in a single item ?
Yup! You can do this using the REPLY built-in menu item.
However, the flow is a bit different than the Add a Cat to That flow. It works like this:
Subscribe to updates to the timeline collection.
Insert a timeline item with the REPLY built in action specified as shown here. Optionally, you can rename the menu item and customize the icon.
{
"text": "Hello world",
"menuItems": [
{
"action": "REPLY"
}
]
}
The timeline card will have a reply option in its menu. When the user selects it, they will be prompted to speak.
A new timeline card is then created which contains the text transcription and has an attached audio recording. Your Glassware has access to this card.
Your Glassware is then notified about this item insertion. The notification looks something like this:
{
"collection": "timeline",
"itemId": "3hidvm0xez6r8_dacdb3103b8b604_h8rpllg",
"operation": "INSERT",
"userToken": "harold_penguin",
"verifyToken": "random_hash_to_verify_referer",
"userActions": [
{
"type": "REPLY"
}
]
}
Fetch the indicated timeline item to access the transcribed text (in the text property) and the attached audio recording

Shares count of Graph API

Regarding Graph API, shares count of post, shares count of post's insights and shares count displayed on page are not identical. I've assumed that these represent same count. Is my assumption wrong?
From post:
https://graph.facebook.com/XXXX_YYYY
{
"id" : "XXXX_YYYY",
...
"shares": {
"count": 1 !!!!!
}
...
}
From post's insights:
https://graph.facebook.com/XXXX_YYYY/insights
[
...
{
"id": "XXXX_YYYY/insights/post_storytellers_by_action_type/lifetime",
"name": "post_storytellers_by_action_type",
"period": "lifetime",
"values": [
{
"value": {
"like": 90,
"share": 14, !!!!!
"comment": 10
}
}
],
"title": "Lifetime Talking About This (Post) by action type",
"description": "Lifetime The number of unique people who created a story about your Page post, by action type. (Unique Users)"
}
...
]
On facebook page: 4 shares !!!!!
Thanks.
I see the same problem on my side, api has had many issues since 2012 started (at least for me) , I think you have better luck reporting this as a bug on Facebook, they can give you a better insight and solve the problem on their side
Url : Facebook Bugs