The problem was solved thanks to the help of MrMusic. Thank you so much for taking the time, I am grateful.
I'll leave the attached code here for others to use if they have something like that.
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
$doc = JFactory::getDocument();
$uri = JURI::getInstance();
$ambit = JoomAmbit::getInstance();
$doc->setMetaData('og:title', $this->category->name, 'property');
$doc->setMetaData('og:type', 'article', 'property');
$doc->setMetaData('og:url', $uri->toString(), 'property');
$doc->setMetaData('og:image', $ambit->getImg('img_url', $this->images[0]), 'property');
$doc->setMetaData('og:image:secure_url', $ambit->getImg('img_url', $this->images[0]), 'property');
$doc->setMetaData('og:image:alt', $this->images[0]->imgtitle, 'property');
$doc->setMetaData('og:image:type', 'image/jpeg', 'property');
if($this->category->description)
{
$doc->setMetaData('og:description', $this->category->description, 'property');
}
else
{
$doc->setMetaData('og:description', $this->category->name, 'property');
}
$doc->setMetaData('fb:app_id', 'xxxxxx', 'property');