Hi, I add photo to Facebook option is not working please check this.
Hello @Nuwan_Fonseka , Welcome to the community ,
Could you please provide the full error message from the sample data?
{
“response”: {
“status”: 400,
“body”: {
“error”: {
“message”: “(#100) url should represent a valid URL”,
“type”: “OAuthException”,
“code”: 100,
“fbtrace_id”: “A4zw6LYp2kMYPN0eQ-TrKLe”
}
}
},
“request”: {
“body”: {
“access_token”: “EAAQWLnGLh68BO2ohZCh8j2mkegxZBGaytGHxs52e1qe7f5dZClQt7CoAyu2Jm2vM1uYcLuyMWByzMbIbM7rgZCpEFW1c2t0w4sNeqTjZAPenROZBcU8o3OlBWqFhPRBMG1VXz0UTILmGffNjSq6BzEKighK4jqbgvIs3y91lPcxisgBFBroZCmS2QQKQh8Gz1ZAh”,
“url”: “{}”,
“caption”: “Woman drowns after falling from bridge in Ratnapura”
}
}
}
this is the error?
The error indicates that the provided URL for the photo is invalid. Could you please verify the image URL from the RSS feed? Is it a valid image URL?
This is from direct Rss feed. sometime there is no photo for the article. You need to improve your script what happened to the photo(in IFTTT the embed there own photo if there is no available photo)
https://www.adaderana.lk/rss.php
@kishanprmr
Which photo would you like to embed in such articles? Is there a specific logo?
Yes, may be soory photo is not avaialable or you should user to choose there own photo. @kishanprmr
You can add code piece after RSS trigger step. This step will fetch image from summary value and if there is no image available then it will give you default image.
export const code = async (inputs) => {
const text = inputs.summary;
const pattern = /<img\s+src='(?<url>[^']+)'/;
const regex = new RegExp(pattern);
const match = regex.exec(text);
if(match)
{
return match.groups.url;
}
else
{
// Replace this image URL with a suitable "Page not Found" image
return "https://img.freepik.com/free-vector/oops-404-error-with-broken-robot-concept-illustration_114360-5529.jpg?t=st=1718603156~exp=1718606756~hmac=f97e4d94feab6a386680eea12918466665139c143dab288123422432dbce95fb&w=996"
}
};
@kishanprmr where can i put these. i am using lifetime deal. i couldn’t fined any location.
Currently, you have two steps in the flow: RSS trigger and Facebook post. After the Trigger step, add a Code step and insert the code mentioned above into it. Your final flow will look like the image below. You can use the output of the Code step as the image URL in the Facebook post step.
@kishanprmr done the changes but still following issues occurring.
*please note that file is 300kb file and stored in google drive.
*Sri Lankan Gossip (Facebook Post).png - Google Drive
Error Occurring
{
“response”: {
“status”: 400,
“body”: {
“error”: {
“message”: “Invalid parameter”,
“type”: “OAuthException”,
“code”: 100,
“error_subcode”: 1366046,
“is_transient”: false,
“error_user_title”: “Can’t Read Files”,
“error_user_msg”: “Your photos couldn’t be uploaded. Photos should be less than 4 MB and saved as JPG, PNG, GIF, TIFF, HEIF or WebP files.”,
“fbtrace_id”: “AwE6xooi4PfWiFu-urEiU-p”
}
}
},
“request”: {
“body”: {
“access_token”: “token”,
“url”: “Sri Lankan Gossip (Facebook Post).png - Google Drive”,
“caption”: “Karuna Amman to back Ranil at presidential poll”
}
}
}
@Nuwan_Fonseka The link provided goes to view page of image, which is not the correct link to use.
The Photo field requires a direct download link.To create download link you can refer this guide. For your current flow, you can use “https://drive.google.com/uc?export=download&id=1JL8vBiAKdzR_j2HNfxACxRrg3ymJN8XZ” link for Photo field.
@kishanprmr some articles have images but still it doesn’t recognize it as image. Please check.
{
“response”: {
“status”: 400,
“body”: {
“error”: {
“message”: “(#100) url should represent a valid URL”,
“type”: “OAuthException”,
“code”: 100,
“fbtrace_id”: “Ar2aJEZVUFdh5mLy4sl8Oil”
}
}
},
“request”: {
“body”: {
“access_token”: “EAAQWLnGLh68BOwRjz087YUy79BMVMZAmEFuQ6Hty8COzibr8H4yltKog6S2A4KWl4Wj6ORMLOdSBXNCZBq0MTWYsNMNzwpZCrpxuWDEGkZAfzZCW32VFZBmr4NF0ZBrr6LGUvAkyPz7OoBtb2L6wQrRfIUP81k6ZCEEZAnyAAN2AKKgny59nOMUTkChQwot59bTLb”,
“url”: “වර්තමානයේ පවතින තරගකාරී ලෝකය තුළ කරුණාව යනු බොහෝවිට සමාජය තුළ අර්ථය හීන වී ගිය වචනයකි.”,
“caption”: “මහ මඟ අසරණ වූ සුනඛයින්ගේ කුස පුරවන අත්තම්මා\n#srilanka\n#colombo\n#travel\n#srilankatravel\n#travelphotography\n#travelsrilanka\n#srilankan\n#srilankadaily\n#nature\n#visitsrilanka\n#photography\n#ceylon\n#love\n#travelgram\n#instagood\n#kandy\n#srilankatrip\n#follow\n#srilankatourism\n#exploresrilanka\n#fashion\n#india\n#instagram\n#photooftheday\n#travelblogger\n\nපේජ් එකට ලයික් කරන්න අමතක කරන්න එපා\n:grin:\nSri Lanka News-Adaderana-Truth First”
}
}
}
please help @kishanprmr
@kishanprmr some articles have images but still it doesn’t recognize it as image. Please check.
{
“response”: {
“status”: 400,
“body”: {
“error”: {
“message”: “(#100) url should represent a valid URL”,
“type”: “OAuthException”,
“code”: 100,
“fbtrace_id”: “Ar2aJEZVUFdh5mLy4sl8Oil”
}
}
},
“request”: {
“body”: {
“access_token”: “EAAQWLnGLh68BOwRjz087YUy79BMVMZAmEFuQ6Hty8COzibr8H4yltKog6S2A4KWl4Wj6ORMLOdSBXNCZBq0MTWYsNMNzwpZCrpxuWDEGkZAfzZCW32VFZBmr4NF0ZBrr6LGUvAkyPz7OoBtb2L6wQrRfIUP81k6ZCEEZAnyAAN2AKKgny59nOMUTkChQwot59bTLb”,
“url”: “වර්තමානයේ පවතින තරගකාරී ලෝකය තුළ කරුණාව යනු බොහෝවිට සමාජය තුළ අර්ථය හීන වී ගිය වචනයකි.”,
“caption”: “මහ මඟ අසරණ වූ සුනඛයින්ගේ කුස පුරවන අත්තම්මා\n#srilanka\n#colombo\n#travel\n#srilankatravel\n#travelphotography\n#travelsrilanka\n#srilankan\n#srilankadaily\n#nature\n#visitsrilanka\n#photography\n#ceylon\n#love\n#travelgram\n#instagood\n#kandy\n#srilankatrip\n#follow\n#srilankatourism\n#exploresrilanka\n#fashion\n#india\n#instagram\n#photooftheday\n#travelblogger\n\nපේජ් එකට ලයික් කරන්න අමතක කරන්න එපා\n:grin:\nSri Lanka News-Adaderana-Truth First”
}
}
}
@kishanprmr please help.
Could you provide the Facebook step mapping? It seems like you’ve entered an RSS title or summary in the URL field. You need to input the output of the code step into the Photo field in the Facebook step.
@kishanprmr please find the output of Rss Feed.
object {23}
date : 2024-06-25T08:53:12.000Z
guid : ලෝක බැංකුවෙන් ඩොලර් මල්ලක්
link : ලෝක බැංකුවෙන් ඩොලර් මල්ලක්
meta {28}
@ [1]
0 {1}
xmlns:atom : Atom Syndication Format namespace
#ns [1]
0 {1}
xmlns:atom : Atom Syndication Format namespace
#xml {2}
version : 1.0
encoding : utf-8
date : 2024-06-25T05:26:07.000Z
link : http://sinhala.adaderana.lk/rss.php
#type : rss
cloud {0}
(empty object)
image {0}
(empty object)
rss:@ {0}
(empty object)
title : AdaDerana RSS
author : null
xmlUrl : AdaDerana RSS
xmlurl : AdaDerana RSS
favicon : null
pubDate : 2024-06-25T05:26:07.000Z
pubdate : 2024-06-25T05:26:07.000Z
#version : 2.0
language : en-us
rss:link {2}
: http://sinhala.adaderana.lk/rss.php
@ {0}
(empty object)
atom:link {1}
@ {3}
rel : self
href : AdaDerana RSS
type : application/rss+xml
copyright : null
generator : null
rss:title {2}
: AdaDerana RSS
@ {0}
(empty object)
categories [0]
(empty array)
description : AdaDerana RSS
rss:pubdate {2}
: Tue, 25 Jun 2024 05:26:07 +0000
@ {0}
(empty object)
rss:language {2}
: en-us
@ {0}
(empty object)
rss:description {2}
: AdaDerana RSS
@ {0}
(empty object)
image {0}
(empty object)
rss:@ {0}
(empty object)
title : ලෝක බැංකුවෙන් ඩොලර් මල්ලක්
author : null
source {0}
(empty object)
pubDate : 2024-06-25T08:53:12.000Z
pubdate : 2024-06-25T08:53:12.000Z
summary : ලෝක බැංකුවෙන් ශ්රී ලංකාවට ඩොලර් මිලියන 150ක මූල්යාධාරයක් ලබාදීමට අනුමත කර තිබේ.
comments : null
origlink : null
rss:guid {2}
: ලෝක බැංකුවෙන් ඩොලර් මල්ලක්
@ {0}
(empty object)
rss:link {2}
: ලෝක බැංකුවෙන් ඩොලර් මල්ලක්
@ {0}
(empty object)
permalink : ලෝක බැංකුවෙන් ඩොලර් මල්ලක්
rss:title {2}
: ලෝක බැංකුවෙන් ඩොලර් මල්ලක්
@ {0}
(empty object)
categories [0]
(empty array)
enclosures [0]
(empty array)
description : ලෝක බැංකුවෙන් ශ්රී ලංකාවට ඩොලර් මිලියන 150ක මූල්යාධාරයක් ලබාදීමට අනුමත කර තිබේ.
rss:pubdate {2}
: Tue, 25 Jun 2024 08:53:12 +0000
@ {0}
(empty object)
rss:description {2}
: ලෝක බැංකුවෙන් ශ්රී ලංකාවට ඩොලර් මිලියන 150ක මූල්යාධාරයක් ලබාදීමට අනුමත කර තිබේ.
@ {0}
(empty object)
the image of the flow.
please note that code always output else option( i think it can not find the image on the site code)
Please use this code to find an image from the summary. Replace the existing code with this one.
export const code = async (inputs) => {
const text =inputs.summary;
const pattern = /<img\s+src=(["'])(?<url>.*?)\1/;
const regex = new RegExp(pattern);
const match = regex.exec(text);
if(match)
{
return match.groups.url;
}
else
{
// Replace this image URL with a suitable "Page not Found" image
return "https://img.freepik.com/free-vector/oops-404-error-with-broken-robot-concept-illustration_114360-5529.jpg?t=st=1718603156~exp=1718606756~hmac=f97e4d94feab6a386680eea12918466665139c143dab288123422432dbce95fb&w=996"
}
};
Also not sure I’m not able to fetch RSS items from this URL.
@kishanprmr thank you very much for your response. but still i am getting else option as output.