i've created online facebook store and catalog but for some reason I'm unable sending single product interactive message.
Anyone can help me understand what am i missing?
endpoint https://graph.facebook.com/v13.0/MY_ID/messages
request:
{
"messaging_product": "whatsapp",
"to": "xxxxxxx",
"recipient_type": "individual",
"type": "interactive",
"interactive": {
"type": "product",
"body": {
"text": "text-body-content"
},
"footer": {
"text": "text-footer-content"
},
"action": {
"catalog_id": "zzzzzz",
"product_retailer_id": "wwww"
}
}
}
response:
{
"error": {
"message": "(#131009) Parameter value is not valid",
"type": "OAuthException",
"code": 131009,
"error_data": {
"messaging_product": "whatsapp",
"details": "Interactive Message type, 'product' not supported. Supported types ['button', 'list']"
},
"error_subcode": 2494010,
"fbtrace_id": "AFhn57y_es2_yWcQpsm6c2S"
}
}
Related
I'm trying to fetch data from an AWS DataExchange provider based on their company's API specification.
I'm using the AWS Node.JS NPM modules 'aws-sdk' and '#aws-sdk/client-dataexchange'.
However, every query I've written is returning the error '404: Asset not found'.
I'm subscribed to use the API and I've verified that all my AWS credentials, policies and IAM keys give me permission to access the API.
Could someone please help me identify what's wrong with my query in relation to the API specification.
Thanks!
The response I get looks like below:
404: Asset not found
'$fault': 'client',
'$metadata': {
httpStatusCode: 404,
requestId: 'b7e6e691-xxxxxxx7657201138a4',
extendedRequestId: undefined,
cfId: 'dBQBwlCE8cXp4--xxxxxxxxxxx3j2lTfxywUezCPEA6nusJCJg==',
attempts: 1,
totalRetryDelay: 0
},
ResourceType: 'ASSET',
ResourceId: 'e055c882bde1fa3xxxxxxxxx'
}
My current request 'body' looks like below:
Body: JSON.stringify({
"description": "GraphQL query for the Ursa Space Imagery Catalog.",
"content": {
"application/graphql": {
"schema": {
"$ref": "#/components/schemas/CatalogSearchRequest"
},
"query": {
"description": "Limit the number of records in a response.",
"value":"{\n availablemetadatarecord(\n limit: 20\n content: { catalogProperties: { vendor: { eq: \"ICEYE\" } } }\n ) {\n assignedId\n }\n}\n"
}
}
},
"required": true
}),
The DataExchange provider's actual API specification looks like below:
{
"openapi": "3.0.1",
"info": {
"title": "image-services",
"description": "API Gateway for integration of Platform Services into AWS Data Exchange",
"version": "2022-03-03T20:04:18Z"
},
"servers": [
{
"url": ""
}
],
"paths": {
"/psdm/graphql": {
"post": {
"requestBody": {
"description": "GraphQL query for the Catalog in the form of:\n\n `{\n availablemetadatarecord(\n QUERYPARAMS\n ) { \n FIELDLIST\n } \n }`\n",
"content": {
"application/graphql": {
"schema": {
"$ref": "#/components/schemas/CatalogSearchRequest"
},
"examples": {
"Limit returned data": {
"description": "Limit the number of records in a response.\n\nIn your query, simply specify `limit: <int>` \n",
"value": "{\n availablemetadatarecord(\n limit: 10\n content: { catalogProperties: { vendor: { eq: \"EYE\" } } }\n ) {\n assignedId\n }\n}\n"
}
}
}
},
"required": true
},
"responses": {
"200": {
"description": "200 response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CatalogSearchResponse"
}
}
}
}
},
"security": [
{
"sigv4": []
}
]
}
}
},
"components": {
"schemas": {
"CatalogSearchRequest": {
"title": "CatalogSearchRequest",
"type": "object"
},
"CatalogSearchResponse": {
"title": "Catalog Search Response",
"required": [
"data",
"paginationInfo"
],
"type": "object",
"properties": {
"paginationInfo": {
"type": "object",
"properties": {
"recordsInPage": {
"type": "integer"
},
"nextOffset": {
"type": "integer"
}
}
},
"data": {
"type": "object",
"properties": {
"availablemetadatarecord": {
"type": "array",
"description": "Records returned by query",
"items": {
"type": "object"
}
}
}
}
}
}
},
"securitySchemes": {
"sigv4": {
"type": "apiKey",
"name": "Authorization",
"in": "header",
"x-amazon-apigateway-authtype": "awsSigv4"
}
}
}
}
My team is building a health app and thus using Asymmetrik FHIR API Server. We need to save a bundle consisting of Condition, Observation and Procedure. The bundle should create each individual object in their respective tables. But when we are using postman to hit the base URL with a very simple bundle object it is giving Invalid URL. Each service is individually working fine and able to create respective objects. How can we enable the root URL of this FHIR server?
POST URL: http://localhost:3000/4_0_0/
POST Object:
{
"resourceType": "Bundle",
"id": "f001",
"type": "transaction",
"entry": [
{
"resource": {
"resourceType": "Observation",
"status": "registered"
},
"request": {
"method": "POST",
"url": "Observation"
}
},
{
"resource": {
"resourceType": "Condition",
"code": {
"coding": {
"system": "http://hl7.org/fhir/ValueSet/condition-code",
"code": "",
"display": ""
}
}
},
"request": {
"method": "POST",
"url": "Condition"
}
}
]
}
ERROR:
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "not-found",
"details": {
"text": "Invalid url: /4_0_0/"
}
}
]
}
I get a TypeError on one particular line (commented) when I run this code:
(I've only included this specific block of code, variables like chunk and count seen here are defined elsewhere).
//if semantic meaning found
if (msg.tmp.nlu.results.semantic_roles.length > 0) {
msg.tmp.nlu.results.semantic_roles.forEach( function (arrayItem){
chunk[count].semantic.push(
{
subject: arrayItem.subject.text,
object: arrayItem.object.text, // TypeError: Cannot read property 'text' of undefined"
action: arrayItem.action.text,
}
);
score++;
});
}
This is the msg.tmp.nlu.results.semantic_roles array I run the forEach on:
[{
"subject": {
"text": "I"
},
"sentence": "I worked with the team to deploy a new marketing software application.",
"object": {
"text": "to deploy a new marketing software application",
"keywords": [{
"text": "new marketing software"
}, {
"text": "application"
}]
},
"action": {
"verb": {
"text": "work",
"tense": "past"
},
"text": "worked",
"normalized": "work"
}
}, {
"subject": {
"text": "I"
},
"sentence": "I worked with the team to deploy a new marketing software application.",
"object": {
"text": "a new marketing software application",
"keywords": [{
"text": "new marketing software"
}, {
"text": "application"
}]
},
"action": {
"verb": {
"text": "deploy",
"tense": "future"
},
"text": "to deploy",
"normalized": "to deploy"
}
}]
It's something to do with the arrayItem.object.text using the name 'object' but have no clue how to resolve it. Can anyone help?
I cannot reproduce your problem, but I've tried to re-create code snippet based on your question. For me it should work correctly, without an TypeError: Cannot read property 'text' of undefined" error. Hopefuly you can use this working code to find and fix problem in yours.
// simulates chunk[count].semantic array
const semantic = [];
// simulates semantic_roles array
const semantic_roles = [{
"subject": {
"text": "I"
},
"sentence": "I worked with the team to deploy a new marketing software application.",
"object": {
"text": "to deploy a new marketing software application",
"keywords": [{
"text": "new marketing software"
}, {
"text": "application"
}]
},
"action": {
"verb": {
"text": "work",
"tense": "past"
},
"text": "worked",
"normalized": "work"
}
}, {
"subject": {
"text": "I"
},
"sentence": "I worked with the team to deploy a new marketing software application.",
"object": {
"text": "a new marketing software application",
"keywords": [{
"text": "new marketing software"
}, {
"text": "application"
}]
},
"action": {
"verb": {
"text": "deploy",
"tense": "future"
},
"text": "to deploy",
"normalized": "to deploy"
}
}];
// Slightly changed forEach loop
semantic_roles.forEach( function (arrayItem){
// Push items to the semantic array
semantic.push(
{
subject: arrayItem.subject.text,
object: arrayItem.object.text,
action: arrayItem.action.text,
}
);
// Log in console arrayItem.object.text for each item
console.log('Text:', arrayItem.object.text);
});
//Log in console semantic_roles array
console.log('semantic_roles array:', semantic_roles); // 2 items
//Log in console semantic array
console.log('semantic array:', semantic); // 2 items
I have a swagger tag document using the Swagger UI that always returns text/html but it should return application/json. The POST requests and every other type returns application/json but this particular GET request does not. The service end point code is correct. And if I change the request to POST it does return as application/json. So it is just type GET within swagger which does not return the correct type. Any thoughts how to correct the call within the UI to use the application/json?
This is swagger version 2.1.4 that was downloaded recently from the swagger site.
"/bankName": {
"get": {
"summary": "Bank Name Search",
"description": "Bank Name Search, input routing number to return bank name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "query",
"name": "routingNumber",
"description": "Input Bank Routing Number",
"required": true,
"type": "string",
}
],
"responses": {
"200": {
"description": "An array",
"schema": {
"type": "object",
"properties": {
"errorInfo": {
"$ref": "#/definitions/ErrorInfo"
},
"bankName": {
"type": "string",
}
}
}
},
"400": {
"description": "Invalid Request Input supplied"
},
"500": {
"description": "General Unexpected Error"
}
}
}
}
Accept:application/json
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Host:localhost:9086
Origin:http://localhost:9086
Pragma:no-cache
Referer:http://localhost:9086/swagger/index.html
Here is the Java code Spring Restful definition:
#RequestMapping(value="bankName",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
Have you tried this?
"/bankName": {
"get": {
"summary": "Bank Name Search",
"description": "Bank Name Search, input routing number to return bank name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "query",
"name": "routingNumber",
"description": "Input Bank Routing Number",
"required": true,
"type": "string",
}
],
"responses": {
"200": {
"description": "An array",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"errorInfo": {
"$ref": "#/definitions/ErrorInfo"
},
"bankName": {
"type": "string",
}
}
}
}
}
},
"400": {
"description": "Invalid Request Input supplied"
},
"500": {
"description": "General Unexpected Error"
}
}
}
}
I'm having trouble in showing the latest post of my Facebook page in my website without using PHP since the website is not hosted in an Apache server.
What I've done till now:
Created a Facebook app and generated an Access token.
Access to Facebook Developer Graph explorer, and used GET method
https://developers.facebook.com/tools/explorer?method=GET&path=nextgenerationmorocco%2Ffeed%3Flimit%3D1&version=v2.0
The result after clicking on Graph Explorer submit button:
{
"data": [
{
"id": "421944571240838_501444706624157",
"from": {
"category": "Organization",
"category_list": [
{
"id": "162237190493977",
"name": "Computer Training"
},
{
"id": "108472109230615",
"name": "Computer Services"
}
],
"name": "Next Generation I.T.",
"id": "421944571240838"
},
"message": "Inscriptions ouvertes pour la formation symfony2\nProfil du formateur : Ingénieur d'état, 5 ans d'expérience.",
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCyB9kEztxV2fnb&w=154&h=154&url=http%3A%2F%2Fngitmaroc.com%2Fimg%2Fportfolio%2Fformation-web-1.jpg",
"link": "http://ngitmaroc.com/formation-web.html",
"name": "Formation Web",
"caption": "ngitmaroc.com",
"description": "Formation programmation/développement site application web php5 symfony2 Maroc Oujda",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"privacy": {
"value": ""
},
"type": "link",
"status_type": "shared_story",
"created_time": "2014-06-01T12:17:22+0000",
"updated_time": "2014-06-01T12:17:22+0000",
"likes": {
"data": [
{
"id": "1459899217586855",
"name": "Nassira Said"
},
{
"id": "1484688285098548",
"name": "Mohamed Tizaoui"
},
{
"id": "1458333711077710",
"name": "Hasnae Lazaar"
},
{
"id": "574623632656391",
"name": "KaOûtar OuJdiia"
}
],
"paging": {
"cursors": {
"after": "NTc0NjIzNjMyNjU2Mzkx",
"before": "MTQ1OTg5OTIxNzU4Njg1NQ=="
}
}
}
}
],
"paging": {
"previous": "https://graph.facebook.com/v2.0/421944571240838/feed?limit=1&since=1401625042",
"next": "https://graph.facebook.com/v2.0/421944571240838/feed?limit=1&until=1401625041"
}
}
How can I use Javascript to fetch these information and show them on my website : "message", "from", "created_time"? Any help will be highly appreciated since I'm new to Javascript and Facebook developers!
You alternatively may use Facebook Likebox plugin to show your recent posts in your website.