Skip to content

SocialPostTargetFailedNotification

Published when a post didn’t go out on a channel (Failed), or may have gone out (Unknown). Either way, a person should look. See Publishing lifecycle.

The following properties are available within the notification

Property Name Type Use
TargetId int The post’s target on this channel.
PostId int The post’s id.
ChannelKey Guid The channel.
Network string The channel’s network id.
Status TargetStatus Failed (definitely not posted, safe to retry) or Unknown (may be live: check before retrying).
Error string? Why: one of Social’s codes, or the network’s own message.
  • The channel’s automation run finished, and the post step failed or its outcome couldn’t be confirmed.
  • The post was still being sent after 15 minutes (dispatch.stale, Unknown).
  • Nothing was sent because the channel has no automation (channel.no_automation), the image couldn’t be resolved (media.unresolvable), a link wasn’t https (dispatch.invalid_url), or a dispatching handler cancelled (dispatch.cancelled:<message>).

It isn’t published for posts failed by removing their channel, or paused by the channel allowance.

LogFailedPosts.cs
using Microsoft.Extensions.Logging;
using UmbSocial.Core.Models;
using UmbSocial.Core.Notifications;
using Umbraco.Cms.Core.Events;
public sealed class LogFailedPosts(ILogger<LogFailedPosts> logger) : INotificationAsyncHandler<SocialPostTargetFailedNotification>
{
public Task HandleAsync(SocialPostTargetFailedNotification notification, CancellationToken cancellationToken)
{
if (notification.Status == TargetStatus.Unknown)
{
logger.LogWarning("Post {PostId} may be live on {Network}: check the account before retrying ({Error})",
notification.PostId, notification.Network, notification.Error);
}
else
{
logger.LogWarning("Post {PostId} failed on {Network}: {Error}", notification.PostId, notification.Network, notification.Error);
}
return Task.CompletedTask;
}
}