There was a issue with the requested skill's response when using Alexa Simulator but works with Manual JSON - alexa

I am having a few issues with my new created alexa skills.
Typing the request in the text box in Alexa Simulator always returns "There was a problem with the requested skill's response". With the output JSON bellow.
{
"body":{
"version":"1.0",
"response":{
"outputSpeech":{
"type":"PlainText",
"text":"Hello i am here"
},
"card":{
"type":"Simple",
"title":"Welcome",
"content":"Hello i am here"
},
"directives":[
{
"type":"Display.RenderTemplate",
"template":{
"type":"BodyTemplate2",
"token":"",
"backgroundImage":{
"contentDescription":"Description for the background image",
"sources":[
{
"url":"URL for the background image - must be secure (https)",
"size":"x-small",
"widthPixels":0,
"heightPixels":0
}
]
},
"image":{
"contentDescription":"Description for the main image",
"sources":[
{
"url":"URL for the main image - must be secure (https)",
"size":"x-small",
"widthPixels":0,
"heightPixels":0
}
]
},
"title":"Welcome",
"textContent":{
"primaryText":{
"type":"RichText",
"text":"Welcome"
},
"secondaryText":{
"type":"RichText",
"text":"Hello i am here"
}
},
"backButton":"HIDDEN"
}
}
],
"shouldEndSession":false
},
"sessionAttributes":{
}
}
}
However, when i copy the JSON input from the request about and user Manual JSON to test, it works perfectly well but returns a slightly different JSON Format
{
"status":"SUCCESSFUL",
"result":{
"skillExecutionInfo":{
"invocationRequest":{
"endpoint":"url here",
"body":{
"version":"1.0",
"session":{
"new":true,
"sessionId":"amzn1.echo-api.session.b62b79ba-1dde-4b22-9bf5-492943a008bc",
"application":{
"applicationId":"amzn1.ask.skill.7c4d08db-82be-4e18-9a62-7a95c58dd69f"
},
"user":{
"userId":"amzn1.ask.account."
}
},
"context":{
"AudioPlayer":{
"playerActivity":"IDLE"
},
"Display":{
},
"System":{
"application":{
"applicationId":"amzn1.ask.skill.7c4d08db-82be-4e18-9a62-7a95c58dd69f"
},
"user":{
"userId":"amzn1.ask.account."
},
"device":{
"deviceId":"amzn1.ask.device.",
"supportedInterfaces":{
"AudioPlayer":{
},
"Display":{
"templateVersion":"1.0",
"markupVersion":"1.0"
}
}
},
"apiEndpoint":"https://api.amazonalexa.com",
"apiAccessToken":"eyJ0eXAiOiJKV1"
}
},
"request":{
"type":"LaunchRequest",
"requestId":"amzn1.echo-api.request.",
"timestamp":"2018-02-05T11:35:53Z",
"locale":"en-GB"
}
}
},
"invocationResponse":{
"body":{
"response":{
"card":{
"type":"Simple",
"title":"Welcome",
"content":"Hello i am here"
},
"directives":[
{
"template":{
"type":"BodyTemplate2",
"token":"",
"title":"Welcome",
"textContent":{
"primaryText":{
"type":"RichText",
"text":"Welcome"
},
"secondaryText":{
"type":"RichText",
"text":"Hello i am here"
}
},
"backButton":"HIDDEN",
"backgroundImage":{
"contentDescription":"Description for the background image",
"sources":[
{
"url":"URL for the background image - must be secure (https)",
"size":"X_SMALL",
"widthPixels":0,
"heightPixels":0
}
]
},
"image":{
"contentDescription":"Description for the main image",
"sources":[
{
"url":"URL for the main image - must be secure (https)",
"size":"X_SMALL",
"widthPixels":0,
"heightPixels":0
}
]
}
},
"type":"Display.RenderTemplate"
}
],
"outputSpeech":{
"type":"PlainText",
"text":"Hello i am here"
},
"shouldEndSession":false
},
"sessionAttributes":{
},
"version":"1.0"
}
},
"metrics":{
"skillExecutionTimeInMilliseconds":254
}
},
"error":null
}
}
Any idea what the problem could be thanks.

For any one that comes across this question with the same problem. If the response includes the Display.RenderTemplate directive, make sure that display interface is enabled on the Alexa developer console.
From the Alexa developer console on your skill, navigate to Interfaces and make sure Display Interface is enabled.

Related

Instagram: invalid message data error while trying to send pushback buttons

Using https://graph.facebook.com/v13.0/me/messages?access_token=pagetoken post url trying to send pushback buttons. But its gives error as:
"message": "(#100) Invalid message data",
"type": "OAuthException",
"code": 100,
"error_subcode": 2534015
**Request-body:**
{
"recipient":{
"id":"PSID"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"Try the postback button!",
"buttons":[
{
"type":"postback",
"title":"Postback Button",
"payload":"DEVELOPER_DEFINED_PAYLOAD"
}
]
}
}
}
}
This one is not supported by instagram anymore, try generic type with post back button https://developers.facebook.com/docs/messenger-platform/instagram/features/generic-template

Overseer sending a blank message on discord when new movie / Tv has been added to plex

I have overseerr set up to send a message on discord when a movie / Tv show is available on plex. A few months back it stopped working, just had not had time to look into it. This is the default json in overseerr
{
"notification_type": "{{notification_type}}",
"event": "{{event}}",
"subject": "{{subject}}",
"message": "{{message}}",
"image": "{{image}}",
"{{media}}": {
"media_type": "{{media_type}}",
"tmdbId": "{{media_tmdbid}}",
"tvdbId": "{{media_tvdbid}}",
"status": "{{media_status}}",
"status4k": "{{media_status4k}}"
},
"{{request}}": {
"request_id": "{{request_id}}",
"requestedBy_email": "{{requestedBy_email}}",
"requestedBy_username": "{{requestedBy_username}}",
"requestedBy_avatar": "{{requestedBy_avatar}}"
},
"{{issue}}": {
"issue_id": "{{issue_id}}",
"issue_type": "{{issue_type}}",
"issue_status": "{{issue_status}}",
"reportedBy_email": "{{reportedBy_email}}",
"reportedBy_username": "{{reportedBy_username}}",
"reportedBy_avatar": "{{reportedBy_avatar}}"
},
"{{comment}}": {
"comment_message": "{{comment_message}}",
"commentedBy_email": "{{commentedBy_email}}",
"commentedBy_username": "{{commentedBy_username}}",
"commentedBy_avatar": "{{commentedBy_avatar}}"
},
"{{extra}}": []
}
In the logs, I see this error code 400 and 50006
Can anyone advise on how to fix the code? Many thanks

PayPal responding with "CANNOT_MIX_CURRENCIES" when purchase unit currency changed

I'm selling an item which has a different price and currency depending on the delivery address.
If the user has two addresses, one in the US and another in the UK, they will be able to change the delivery address through PayPal. When the user changes the region from US to UK, PayPal informs my site that there has been a region change and it will reply with the new currency and price, changing from 345$ to £305.
When PayPal receives this update, PayPal displays an error to the customer. In the network tab there is more insight, and one can find the following error: CANNOT_MIX_CURRENCIES. However, both item prices and total prices are all converted to the desired currency, so there is no "mix" of currencies. Below is the request and the accompanying response that generates the error.
Request: PATCH -> www.sandbox.paypal.com/smart/api/order/890595684S747592L/patch
{
"data":{
"patch":[
{
"op":"replace",
"path":"/purchase_units/#reference_id=='xxx'",
"value":{
"reference_id":"xxx",
"invoice_id":"xxx",
"custom_id":1,
"description":"xxx",
"amount":{
"currency_code":"GBP",
"value":"305.00",
"breakdown":{
"item_total":{
"currency_code":"GBP",
"value":"305.00"
},
"shipping":{
"currency_code":"GBP",
"value":"0.00"
},
"tax_total":{
"currency_code":"GBP",
"value":"0.00"
},
"discount":{
"currency_code":"GBP",
"value":"0.00"
}
}
},
"items":[
{
"name":"xxx",
"sku":"xxx",
"currency":"GBP",
"quantity":1,
"category":"PHYSICAL_GOODS",
"unit_amount":{
"currency_code":"GBP",
"value":"305.00"
}
}
]
}
}
]
}
}
Response:
{
"ack":"contingency",
"contingency":"UNPROCESSABLE_ENTITY",
"data": {
"name":"UNPROCESSABLE_ENTITY",
"details":[{
"location":"body",
"issue":"CANNOT_MIX_CURRENCIES",
"description":"CANNOT_MIX_CURRENCIES"
}],
"message":"The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id":"xxx",
"links":[{
"href":"https://developer.paypal.com/docs/api/orders/v2/#error-CANNOT_MIX_CURRENCIES",
"rel":"information_link",
"method":"GET"
}]
},
"meta":{"calc":"xxx","rlog":"xxx"},
"server":"xxx"
}
Below is the request (and response) for the creation of the purchase unit above.
Request: POST -> POST -> www.sandbox.paypal.com/v2/checkout/orders
{
"intent":"CAPTURE",
"purchase_units":[
{
"reference_id":"xxx",
"invoice_id":"xxx",
"custom_id":1,
"description":"xxx",
"amount":{
"currency_code":"USD",
"value":"345.00",
"breakdown":{
"item_total":{
"currency_code":"USD",
"value":"345.00"
},
"shipping":{
"currency_code":"USD",
"value":"0.00"
},
"tax_total":{
"currency_code":"USD",
"value":"0.00"
},
"discount":{
"currency_code":"USD",
"value":"0.00"
}
}
},
"items":[
{
"name":"xxx",
"sku":"xxx",
"currency":"USD",
"quantity":1,
"category":"PHYSICAL_GOODS",
"unit_amount":{
"currency_code":"USD",
"value":"345.00"
}
}
]
}
],
"application_context":{
"shipping_preference":"GET_FROM_FILE"
}
}
Response:
{
"id":"xxx",
"status":"CREATED",
"links":[
{
"href":"https://api.sandbox.paypal.com/v2/checkout/orders/xxx",
"rel":"self",
"method":"GET"
},
{
"href":"https://www.sandbox.paypal.com/checkoutnow?token=xxx",
"rel":"approve",
"method":"GET"
},
{
"href":"https://api.sandbox.paypal.com/v2/checkout/orders/xxx",
"rel":"update",
"method":"PATCH"
},
{
"href":"https://api.sandbox.paypal.com/v2/checkout/orders/xxx/capture",
"rel":"capture",
"method":"POST"
}
]
}
I am using the PayPal Orders API v2, via the react-paypal-button-v2 npm package.
The documentation for "CANNOT_MIX_CURRENCIES" mentions all currencies in the purchase unit must be the same, but it does not mention that a purchase unit currency change is not possible. Something confusing is that I could only find mention of this error ("CANNOT_MIX_CURRENCIES") in Billing Agreements API v1.
CANNOT_MIX_CURRENCIES
The currency code is not valid. All currency codes much match. Use same currency code for all amount objects.
In the <script> line where you're loading the SDK, currency defaults to USD, and this SDK line currency matters because it is used to determine which buttons can be shown before the orders v2 object is ever called.
If you need to change the currency after page load time, you can reload the SDK asynchronously.
function loadAsync(url, callback) {
var s = document.createElement('script');
s.setAttribute('src', url); s.onload = callback;
document.head.insertBefore(s, document.head.firstElementChild);
}
// Usage:
loadAsync('https://www.paypal.com/sdk/js?client-id=sb&currency=USD', function() {
paypal.Buttons({
createOrder: function(data, actions) {
//your code here
},
onApprove: function(data, actions) {
//your code here
}
}).render('body'); // Replace with selector to render in
});
Alternatively there is a node package, if you like dependencies more than 3 line functions :) https://github.com/paypal/paypal-js

Cannot query ACF Options page with GraphQL and GatsbyJS

I am trying to query my ACF options page fields that I have set up in the admin side, and through the WP API Query them using GatsbyJS's gatsby-source-wordpress. When I run build and dev it requests the data and prints out the output
=== [ Fetching wordpress__acf_options ] === http://url.local/wp-json/acf/v3/options/options/
⠈ source and transform nodes -> wordpress__acf_options fetched : 1
Fetching the wordpress__acf_options took: 518.885ms
=== [ Fetching wordpress__acf_options ] === http://url.local/wp-json/acf/v3/options/options
⠈ source and transform nodes -> wordpress__acf_options fetched : 1
Fetching the wordpress__acf_options took: 478.580ms
and within those urls on the browser, I get this response. So I know the data is correct
{
acf: {
social_options: [
{
social_name: "Twitter ",
social_link: "https://twitter.com"
},
{
social_name: "Linkedin",
social_link: "https://www.linkedin.com/"
}
],
test: "pagfe 1"
}
}
The problem is when I query the allWordpressAcfOptions in the internal GraphQL. I try and see what options are available to query but all I can get is the ID. This is my query below.
{
allWordpressAcfOptions {
edges {
node {
id
internal {
type
contentDigest
owner
}
children {
id
}
wordpress_id
}
}
}
}
and none of the data in there is the data I need, an none of it is representative of the same data shown from REST API Link. So there is something missing. This is the response I get back from the Query.
{
"data": {
"allWordpressAcfOptions": {
"edges": [
{
"node": {
"id": "038ece9f-326d-5bb0-8f17-1bb72ce06c57",
"internal": {
"type": "wordpress__acf_options",
"contentDigest": "10b2729a5f87723bbafc539f99fb23d6",
"owner": "gatsby-source-wordpress"
},
"children": [],
"wordpress_id": "acf"
}
}
]
}
}
}
For reference my gatsby-source-wordpress options in the gatsby config are this below
options: {
baseUrl: 'url.local',
protocol: 'http',
hostingWPCOM: false,
useACF: true,
acfOptionPageIds: ['options'],
verboseOutput: true
},
options refers to the page ID the my ACF options page is set in my functions.php on the wordpress side.
So in summary, GatsbyJs is referencing the API and pulling the data but what am I doing wrong to query the data via GraphQL?

Sending images or buttons on facebook messenger via ibm watson configuered via botkit

I have made a wotson chat bot, deployed on facebbok messenger the broker is a node app just like in this github example. I'm recieving text responses perfectly but how do I configure the bot to send images or buttons to the fb messenger. I have tried Respond with JSON option in watson dialog.
JSON:
{
"output": {
},
"context":{
"facebook":{
"message":{
"attachment":{
"type":"image",
"payload":{
"url":"https://petersapparel.com/img/shirt.png"
}
}
}
}
}
}
I Think there is some problem with my JSON.
To send buttons define message with template_type generic and buttons with type postback
controller.hears('test', 'message_received', function(bot, message) {
var attachment = {
'type':'template',
'payload':{
'template_type':'generic',
'elements':[
{
'title':'Chocolate Cookie',
'image_url':'http://cookies.com/cookie.png',
'subtitle':'A delicious chocolate cookie',
'buttons':[
{
'type':'postback',
'title':'Eat Cookie',
'payload':'chocolate'
}
]
},
]
}
};
bot.reply(message, {
attachment: attachment,
});
});
To send attachment define attachment message with resource url and call upload method.
controller.hears('test', 'message_received', function(bot, message) {
var attachment = {
"type":"image",
"payload":{
"url":"https://pbs.twimg.com/profile_images/803642201653858305/IAW1DBPw_400x400.png",
"is_reusable": true
}
};
controller.api.attachment_upload.upload(attachment, function (err, attachmentId) {
if(err) {
// Error
} else {
var image = {
"attachment":{
"type":"image",
"payload": {
"attachment_id": attachmentId
}
}
};
bot.reply(message, image);
}
});
}
Check Botkit Messenger documentation.

Resources