Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Config Callback Class

Config Callback Class boosts product recommendations beyond the constraints defined by recommendation type rules. When config callback class is executed based on the custom code, you can see a refined list of recommended products in the Recommendation Thumbs up icon. Recommended products will be displayed if the Show Recommended Products Cart View setting is enabled in Config Select Products Settings. This feature is part of ConfigCallback which implements the IConfigCallback interface. This interface facilitates customization and extension of the configuration rules execution process.

The following method is available in the IConfigCallback interface and custom logic should be written inside this method:
MethodSignatureDescription
BeforeConfigRulesExecutionAsyncpublic async Task BeforeConfigRulesExecutionAsync(IConfigCartRequest configCartRequest, CancellationToken cancellationToken);This extension point is called before config rules execution.
AfterConfigRulesExecutionAsyncpublic async Task AfterConfigRulesExecutionAsync(IConfigCartRequest configCartRequest, CancellationToken cancellationToken);This extension point is called after config rules execution.

IConfigCartRequest is passed as an argument in both BeforeConfigRulesExecution and AfterConfigRulesExecution method.

This class stores info about the cart , inputLineItems, cartLineItems, ruleInfos and recommendedproducts list.

This interface is implemented by Conga.Revenue.Config.Manager.Messages.ConfigCartRequest.

CancellationToken has been introduced in custom code developed within the Conga Advantage Platform. If you are still using the older approach, you must mark those legacy methods as obsolete. This means applying the [Obsolete] attribute to methods that do not support tokens. For example: [Obsolete("Use version with CancellationToken")]. For more information, see CancellationToken Implementation Guidelines.

BeforeConfigRulesExecutionAsync

FeatureFlag : IsBeforeConfigRulesCallbackEnabled

public async Task BeforeConfigRulesExecutionAsync(IConfigCartRequest configCartRequest, CancellationToken cancellationToken);
{
    ThrowIfCancellationRequested(cancellationToken);
    var logHelper = GetLogHelper();
    try
    {
        //add your logic here
    }
    catch (Exception ex)
    {
        logHelper?.LogError("Exception Message=" + ex.Message + "stacktrace =" + ex.StackTrace);
    }
    await Task.CompletedTask;
}

AfterConfigRulesExecutionAsync

public async Task AfterConfigRulesExecutionAsync(IConfigCartRequest configCartRequest, CancellationToken cancellationToken);
{
    ThrowIfCancellationRequested(cancellationToken);
    var logHelper = GetLogHelper();
    try
    {
        //add your logic here
    }
    catch (Exception ex)
    {
        logHelper?.LogError("Exception Message=" + ex.Message + "stacktrace =" + ex.StackTrace);
    }
    await Task.CompletedTask;
}