Error #1487713 when trying to link video to campaign ad - facebook

I am having trouble creating a video ad on AdVideos platform. I am able to successfully create campaigns, ad sets, and ads, but am encountering an error #1487713 when uploading a specific 15-second MP4 video from Google Drive. Some other videos have uploaded successfully. What could be causing this issue and how can I resolve it?
When creating the video with the API/ using that id for the ad, i dont get any errors (i get a advideo ID back). only when i navigate to the business campaign manager it gives me the error "#1487713 check if your video is in the right format and try again"
here is the code im using to test, again some videos DO work (all around 10-20 seconds)
# creates advideo
params = {
"name": "TEST",
"file_url": drive_url_to_download(video_url),
"title": "TEST",
}
url = f"https://graph.facebook.com/v15.0/{act}/advideos?access_token={fb_token}"
rr = requests.post(url, params=params)
print(rr.json(), rr.status_code)
# exit()
# creates a campaign
campaign_params = {
"name": "TEST",
"objective": "REACH",
"status": "PAUSED",
"special_ad_categories": ["NONE"],
}
url = f"https://graph.facebook.com/v15.0/{act}/campaigns?access_token={fb_token}"
r = requests.post(url, params=campaign_params)
print(r.json())
adset_params = {
"name": "TEST",
"campaign_id": r.json()["id"],
"billing_event": "IMPRESSIONS",
"optimization_goal": "REACH",
"bid_amount": "100",
"daily_budget": "1000",
"targeting": str({
"geo_locations": {
"custom_locations": [
{
"address_string": "someaddr",
"radius": "5",
"distance_unit": "kilometer"
},
]
},
"facebook_positions": ["feed", "video_feeds", "instant_article", "marketplace", "video_feeds", "story", "search"],
}),
"status": "PAUSED",
}
url = f"https://graph.facebook.com/v15.0/{act}/adsets?access_token={fb_token}"
r = requests.post(url, params=adset_params)
print(r.json())
# create ad with video
ad_params = {
"name": "TEST",
"adset_id": r.json()["id"],
"creative": str({
"name": "TEST333",
"object_story_spec": {
"page_id": "someid",
"video_data": {
"image_url": "someurl",
"call_to_action": {
"type": "NO_BUTTON",
},
"title": "TEST",
"message": "TEST",
"video_id": rr.json()["id"]
}
}
}),
"status": "PAUSED",
}
what is going on??

Related

Sending png image response in nodejs from the Microsoft Graph API json

I have a json response from Microsoft Graph API as below. Which i need to convert into a image to display in my html page. I am getting this done from my node js / nest js app via RestAPI and delivering it to angular app via http request. So how can i convert into blob or data of image.. or any other file transfer from api to web.
My Graph API response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('cd2a056e-014e-40ff-8068-45392b2be32b')/drive/items/$entity",
"#microsoft.graph.downloadUrl": "https://onluftek-my.sharepoint.com/personal/workflow_luftek_in/_layouts/15/download.aspx?UniqueId=''&Translate=false&tempauth=''",
"createdDateTime": "2022-11-26T18:50:03Z",
"eTag": "\"{521BBE40-B069-467E-AF95-848ECCBF2A21},1\"",
"id": "01OGQGK5CAXYNVE2NQPZDK7FMER3GL6KRB",
"lastModifiedDateTime": "2022-11-26T18:50:03Z",
"name": "logo.svg",
"webUrl": "https://onluftek-my.sharepoint.com/personal/workflow_luftek_in/Documents/Rezors/Tenants/luftek/logo.svg",
"cTag": "\"c:{521BBE40-B069-467E-AF95-848ECCBF2A21},1\"",
"size": 17216,
"createdBy": {
"user": {
"email": "workflow#luftek.in",
"id": "cd2a056e-014e-40ff-8068-45392b2be32b",
"displayName": "WorkFlow"
}
},
"lastModifiedBy": {
"user": {
"email": "workflow#luftek.in",
"id": "cd2a056e-014e-40ff-8068-45392b2be32b",
"displayName": "WorkFlow"
}
},
"parentReference": {
"driveType": "business",
"driveId": "b!Q5jvgqio9UaGVWaQoSlkUWrRyzk-OSVEif6teVD1jRf1VNtmisdwRKyoKV01U1Mb",
"id": "01OGQGK5EX722P6JTC4NEJCVH7TBBOVRBP",
"path": "/drive/root:/Rezors/Tenants/luftek"
},
"file": {
"mimeType": "image/svg+xml",
"hashes": {
"quickXorHash": "czZroyVfWxLGfydCWL/X6zZhuqo="
}
},
"fileSystemInfo": {
"createdDateTime": "2022-11-26T18:50:03Z",
"lastModifiedDateTime": "2022-11-26T18:50:03Z"
}
}

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.

Microsoft bot framework Probelms with WebChat and Messenger

I deployed my bot to azure ,and to messenger channel .
The bot works fine on emulator , while , video card do not work on web-chat and messenger .
Also , I created an adaptive form card so the user can send data , it works fine on emulator , but
web-chat and messenger it show up but when trying to submit it show code error .
Here is the code for my video card :
public static VideoCard GetVideoCard()
{
var videoCard = new VideoCard
{
Title = "Big Buck Bunny",
Subtitle = "by the Blender Institute",
Text = "Big Buck Bunny (code-named Peach) is a short computer-animated comedy film by the Blender Institute",
//Image = new ThumbnailUrl
//{
// Url = "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Big_buck_bunny_poster_big.jpg/220px-Big_buck_bunny_poster_big.jpg",
//},
Media = new List<MediaUrl>
{
new MediaUrl()
{
Url = "http://techslides.com/demos/sample-videos/small.mp4",
},
},
Buttons = new List<CardAction>
{
new CardAction()
{
Title = "Learn More",
Type = ActionTypes.OpenUrl,
Value = "https://peach.blender.org/",
},
},
};
return videoCard;
} .
the form card (u can see it by copy past this code to https://adaptivecards.io/designer/) :
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": 2,
"items": [
{
"type": "TextBlock",
"text": "Get In Touch",
"weight": "Bolder",
"size": "Medium"
},
{
"type": "TextBlock",
"text": "We are interested in advenced technology, we are interested in your business, we are interested in you.\n",
"isSubtle": true,
"wrap": true
},
{
"type": "TextBlock",
"text": "Don't worry, we'll never share or sell your information.",
"isSubtle": true,
"wrap": true,
"size": "Small"
},
{
"type": "TextBlock",
"text": "Your name",
"wrap": true
},
{
"type": "Input.Text",
"placeholder": "Full name",
"id": "name",
"spacing": "Medium"
},
{
"type": "TextBlock",
"text": "Your email",
"wrap": true
},
{
"type": "Input.Text",
"id": "email",
"placeholder": "youremail#example.com",
"style": "Email"
},
{
"type": "TextBlock",
"text": "Subject"
}
]
}
]
},
{
"type": "Input.Text",
"placeholder": "message",
"id": "message",
"isMultiline": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit",
"id": "submitid"
}
]
}
For the Video Card , I have fixed it , the only one probelm is facebook is not rendering the card as it suppose to be :
sample on FB :
Sample on webchat

Adding Videos to a Magento 2 product using REST

Magento version 2.2.5
Endpoint in question /V1/products/{sku}/media METHOD: POST
I am trying to add a video under a product sku using Magento's provided API endpoint.
{
"entry": {
"media_type": "external-video",
"label": "Video 2",
"position": 2,
"disabled": false,
"types": ["thumbnail"],
"content" : {
"base64_encoded_data": "encoded image data ",
"type": "image/jpeg",
"name": "0.jpg"
},
"extension_attributes": {
"video_content": {
"media_type": "external-video",
"video_provider": "youtube",
"video_url": "some youtube video url",
"video_title": "some title",
"video_description": "",
"video_metadata": ""
}
}
}
The response I get from this call is "invalid option value", I had debugged this in a local environment which leads me to failure during ProductRepository->save() within Magento\Catalog\Model\Product\GalleryGalleryManagement.php on line 70.
Is this an issue with my payload or actual magento bug?
Resolved this issue by adding videos directly using POST /V1/products or PUT /V1/products/{sku} endpoints.
post method example:
{
"product": {
"sku": "some-sku",
..... other product data,
"media_gallery_entries": {
"media_type": "external-video",
"label": "Video 2",
"position": 2,
"disabled": false,
"types": [],
"content" : {
"base64_encoded_data": "encoded image data ",
"type": "image/jpeg",
"name": "0.jpg"
},
"extension_attributes": {
"video_content": {
"media_type": "external-video",
"video_provider": "youtube",
"video_url": "some youtube video url",
"video_title": "some title",
"video_description": "",
"video_metadata": ""
}
}
}
}
I had no luck with Magento's MediaGallery POST endpoint (/V1/products/{sku}/media.
If you want to add a video to the product page then why you did not try using YouTube API?
You just need to follow these steps:
Generate a YouTube API Key by going goodle developer console
Then add Youtube API key to your Magento 2 by going to STORES --> Configuration
Then Add Video URL