Skip to content

SocialPostDispatchingNotification

Published before a due post is handed to a channel’s automation, once per channel and attempt. A handler can change what is sent, for example to add campaign tags to the link, or hold the post back.

The following properties are available within the notification

Property Name Type Use
Target OutgoingSocialPost What is about to be sent to this channel.
Messages EventMessages Add the message to record when you cancel.
Cancel bool Set to true to cancel without a message.

OutgoingSocialPost has these properties:

Property Name Type Settable Use
TargetId int No The post’s target on this channel.
PostId int No The post’s id.
ChannelKey Guid No The channel.
Network string No The channel’s network id, for example linkedin.
Attempt int No The attempt number (0 for the first).
Text string Yes The text the network receives: the channel’s own text or the main text, with the link already added for networks that take it in the text.
LinkUrl string? Yes The link.
LinkTitle string? Yes The link’s title.
LinkDescription string? Yes The link’s description.
ImageUrl string? Yes The image’s absolute public URL (a JPEG version for Instagram).
ImageAltText string? Yes The image’s alt text.

Call CancelOperation(new EventMessage(category, message, EventMessageType.Error)). Nothing is sent, the target is Failed with the error dispatch.cancelled:<message>, and SocialPostTargetFailedNotification is published. A person can retry it later.

  • LinkUrl and ImageUrl must stay absolute https URLs. If a handler leaves anything else, nothing is sent and the target is Failed with dispatch.invalid_url.
  • The text is counted again after the handlers. If it no longer fits the network’s limit (see Network limits), nothing is sent and the target fails with text.too_long:<network>.
  • For X, Bluesky and Mastodon, the link is already in Text. Changing LinkUrl doesn’t change it there: change Text too.
  • Changes apply to what is sent this time only. They aren’t stored on the post.
  • The notification runs on the background server that sends posts, outside any request.

See Extending UmbSocial for an example.