def METHOD_NAME(
    notification: BaseNotification,
    recipient: RpcActor,
    shared_context: Mapping[str, Any],
    extra_context_by_actor: Mapping[RpcActor, Mapping[str, Any]] | None,
) -> List[SlackAttachment]:
    extra_context = (
        extra_context_by_actor[recipient] if extra_context_by_actor and recipient else {}
    )
    context = get_context(notification, recipient, shared_context, extra_context)
    cls = get_message_builder(notification.message_builder)
    attachments = cls(notification, context, recipient).build()
    if isinstance(attachments, List):
        return attachments
    return [attachments]