LinkedIn Share API returns 400 error - "Owner entity type person is not supported" - share

I am using the below body to hit the LinkedIn Share API endpoint. Unable to figure out what exactly is the reason for this error and no mention of this in the documentation.
POST REQUEST:
{
"content": {
"contentEntities": [
{
"entityLocation": "https://www.sample.com",
"thumbnails": [
{
"resolvedUrl": "https://www.sample.com"
}
]
}
],
"title": "Test Share with Content"
},
"distribution": {
"linkedInDistributionTarget": {}
},
"owner": "urn:li:person:_EELFb0y",
"subject": "Test Share Subject",
"text": {
"text": "Test Share!"
}
}
RESPONSE:
{
"message": "Owner entity type person is not supported",
"status": 400
}
Any help on this?

[Official LinkedIn API DOCS]
In v2 API, LinkedIn uses "author", not "owner"
{
"author": "urn:li:person:8675309",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Hello World! This is my first Share on LinkedIn!"
},
"shareMediaCategory": "NONE"
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
May be that is the reason for that status=400

Related

Possible Notion API bug - Can't create Database Page with URL data

I have a Notion database that I'm trying to write to via the API.
I can write to text fields, but when I try to write to a URL field, I receive the following error:
{
"object": "error",
"status": 400,
"code": "validation_error",
"message": "body failed validation. Fix one:\nbody.properties.O?HT.id should be defined, instead was `undefined`.\nbody.properties.O?HT.name should be defined, instead was `undefined`.\nbody.properties.O?HT.start should be defined, instead was `undefined`."
}
This is the API description of that field:
"LinkedIn": {
"id": "O%3FHT",
"name": "LinkedIn",
"type": "url",
"url": {}
},
This is the body of the API POST request that's failing:
{
"parent": {
"database_id": "f016c02beeff4a34bf298ceb8a8a079f"
},
"properties": {
"title": [
{
"text": {
"content": "Mark Zuckerberg"
}
}
],
"%3DCzE": [
{
"text": {
"content": "CEO"
}
}
],
"HihI": [
{
"text": {
"content": "Facebook"
}
}
],
"JC%3BS": [
{
"text": {
"content": "Menlo Park, CA"
}
}
],
"O%3FHT": {
"url": "https://www.linkedin.com/in/mark-zuckerberg/"
},
"wS%7BN": {
"url": "https://www.linkedin.com/company/facebook/mycompany/verification/"
}
}
}
I'm basing the body contents on the Postman docs provided by Notion: https://www.postman.com/notionhq/workspace/notion-s-api-workspace/documentation/15568543-d990f9b7-98d3-47d3-9131-4866ab9c6df2

Why I do not receive the attachments in the Facebook Messenger webhook request?

Since yesterday (29/10/2020) i'm having this problem only on one of the pages linked to my app, the others work correctly:
The attached messages that the webhook receives from Facebook do not contain the attachment field.
Only messages with stickers contain the "attachment" field. All others (image, video, audio etc.) No.
What I expect (as facebook documentation) is:
{
"id": "682498302938465",
"time": 1518479195594,
"messaging": [
{
"sender": {
"id": "<PSID>"
},
"recipient": {
"id": "<PAGE_ID>"
},
"timestamp": 1518479195308,
"message": {
"mid": "mid.$cAAJdkrCd2ORnva8ErFhjGm0X_Q_c",
"attachments": [
{
"type": "<image|video|audio|file>",
"payload": {
"url": "<ATTACHMENT_URL>"
}
}
]
}
}
]
}
but I only receive:
{
"object": "page",
"entry": [
{
"id": "119320008135788",
"time": 1604051633128,
"messaging": [
{
"sender": {
"id": "XXXXXX"
},
"recipient": {
"id": "XXXXXX"
},
"timestamp": 1604051632953,
"message": {
"mid": "m_7DRP...."
}
}
]
}
]
}
This only happens on one page from 29/10/2020
Does anyone have the same problem / know why it happens?
The Facebook support team has confirmed my problem, and is investigating.
I am now solving using the graph api to get the desired message information using the mid
GET /v8.0/{message-id} HTTP/1.1
Host: graph.facebook.com
https://developers.facebook.com/docs/graph-api/reference/v8.0/message
Ex.
GET
https://graph.facebook.com/v8.0/' + mid + '?fields=message%2Cfrom%2Csticker%2Ctags%2Cid%2Cattachments.limit(10)%7Bid%2Cimage_data%2Cmime_type%2Cname%2Cfile_url%2Cvideo_data%7D&access_token=XXXXXX

Error trying to use an uploaded image in Linkedin

I'm trying to use the Linkedin API to share a post with an image. I've followed all the steps in the documentation:
https://learn.microsoft.com/es-es/linkedin/consumer/integrations/self-serve/share-on-linkedin?context=linkedin/consumer/context#share-media
First, I register the upload with a POST to https://api.linkedin.com/v2/assets?action=registerUpload and this body:
{
"registerUploadRequest": {
"recipes": [
"urn:li:digitalmediaRecipe:feedshare-image"
],
"owner": "urn:li:person:{{owner_ID}}",
"serviceRelationships": [
{
"relationshipType": "OWNER",
"identifier": "urn:li:userGeneratedContent"
}
]
}
}
I get this response:
{
"value": {
"uploadMechanism": {
"com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest": {
"uploadUrl": "https://api.linkedin.com/mediaUpload/C4E22AQF6AS1WhrD1lw/feedshare-uploadedImage/0?ca=vector_feedshare&cn=uploads&m=AQKLg3lSJnswAgAAAXSgLwWp6iAPzjh6E_5XQh8QuP1Aucf_j9bgW3m5vQ&app=74851466&sync=0&v=beta&ut=2h9vtCSeuP0ps1",
"headers": {
"media-type-family": "STILLIMAGE"
}
}
},
"asset": "urn:li:digitalmediaAsset:C4E22AQF6AS1WhrD1lw",
"mediaArtifact": "urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C4E22AQF6AS1WhrD1lw,urn:li:digitalmediaMediaArtifactClass:feedshare-uploadedImage)"
}
}
Then I use the uploadURL to make another post with the image as body, and get a 201 Created response.
I've checked the upload with a GET https://api.linkedin.com/v2/assets/C4E22AQF6AS1WhrD1lw and it has been uploaded correctly:
{
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-image",
"status": "AVAILABLE"
}
],
"serviceRelationships": [
{
"relationshipType": "OWNER",
"identifier": "urn:li:userGeneratedContent"
}
],
"mediaTypeFamily": "STILLIMAGE",
"created": 1600415270252,
"id": "C4E22AQF6AS1WhrD1lw",
"lastModified": 1600415345915,
"status": "ALLOWED"
}
When I try to share a post referencing this image I get this error:
{"message":"com.linkedin.restli.server.RestLiServiceException [HTTP Status:401]: com.linkedin.content.common.ResponseException: Writers of type person are not authorized to modify UserGeneratedContent.","status":401}
I'm sending a POST to this URL https://api.linkedin.com/v2/ugcPosts with this body:
{
"author": "urn:li:person:{{person_id}}",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Feeling inspired after meeting so many talented individuals at this year's conference. #talentconnect"
},
"shareMediaCategory": "IMAGE",
"media": [
{
"status": "READY",
"description": {
"text": ""
},
"media": "urn:li:digitalmediaAsset:C4E22AQF6AS1WhrD1lw",
"title": {
"text": ""
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
I can share an only text post without trouble, look at my person ID, even like a post, but I'm stuck with this.
Can anyone tell me what am I doing wrong?
Solved. I had an error in the person_id variable, so I was trying to create a post with the wrong id.

DialogFlow v2 fulfillmentMessages

I'm trying to respond to users with news cards but as far as I can see if I follow your example it does not work.
If I just respond with fulfillmentMessages like this
res.json({
"fulfillmentMessages": [
{
"card": {
"title": "card title",
"subtitle": "card text",
"imageUri": "https://assistant.google.com/static/images/molecule/Molecule-Formation-stop.png",
"buttons": [
{
"text": "button text",
"postback": "https://assistant.google.com/"
}
]
}
}
],
"source": "example.com"
});
I get this error back:
{
"responseMetadata": {
"status": {
"code": 13,
"message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
"details": [
{
"#type": "type.googleapis.com/google.protobuf.Value",
"value": "{\"id\":\"ef8154ae-96ff-4837-b7e7-d3388223240d\",\"timestamp\":\"2018-04-27T15:19:19.449Z\",\"lang\":\"en-us\",\"result\":{},\"status\":{\"code\":200,\"errorType\":\"success\"},\"sessionId\":\"1524841118917\"}"
}
]
}
}
}
If I add the fulfillmentText (that should be optional) Google Assistant will only use the plain text as a response and won't use cards.
Has someone fixed this issue?

How can I create a response with rich messages in Dialogflow?

Currently, When an intent is invoked, I am calling a webhook and getting a response from the web service as json structure show below.
{
"speech": "this text is spoken out loud if the platform supports voice interactions",
"displayText": "this text is displayed visually"
}
This is mere text. Alternatively, What response do I have to get to display a list for example.
I tried the rich message section of dialogflow documentation. Those structures didn't work.
Every time DialogFlow matches an intent, you have the possibility to ask DialogFlow to send a request to a specific endpoint. An endpoint which you’ll obviously have to code.
That will allow you to retrieve the matched intent, as well as the matched parameters and contexts, and do some useful work with those.
How to use Message Object in Dialogflow
Kommunicate - Custom webhook Dialogflow integration example
Example of rich message with webhook
{
"fulfillmentMessages": [{
"payload": {
"message": "Object1",
"platform": "", // Example - Facebook, Slack...etc
{
"name": "Save Promo",
"action": {
"type": "quickReply",
"payload": {
"message": "text will be sent as message",
"replyMetadata": {
"key1": "value1"
}
}
}
},
{
"name": "Save Coupon",
"action": {
"type": "quickReply",
"payload": {
"message": "text will be sent as message",
"replyMetadata": {
"key1": "value1"
}
}
}
}
}, {
"payload": {
"message": "Object2",
"platform": "" // Example - Facebook, Slack...etc
}
}]
}
To add an Actions on Google List as part of the reply, you'll need to use the data field in your response to include a richResponse with what should be said, along with a systemIntent that contains the list information.
You can see more examples at their github example repository, but here is the one for showing a list:
{
"data": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Choose an item"
}
}
]
},
"systemIntent": {
"intent": "actions.intent.OPTION",
"data": {
"#type": "type.googleapis.com/google.actions.v2.OptionValueSpec",
"listSelect": {
"title": "Hello",
"items": [
{
"optionInfo": {
"key": "first title"
},
"description": "first description",
"image": {
"url": "https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
"accessibilityText": "first alt"
},
"title": "first title"
},
{
"optionInfo": {
"key": "second"
},
"description": "second description",
"image": {
"url": "https://lh3.googleusercontent.com/Nu3a6F80WfixUqf_ec_vgXy_c0-0r4VLJRXjVFF_X_CIilEu8B9fT35qyTEj_PEsKw",
"accessibilityText": "second alt"
},
"title": "second title"
}
]
}
}
}
}
}
}