Loading
Upcoming Mandatory Changes to Public Key Infrastructure (PKI)Read More
Salesforce Enforces New Security Requirements in Summer 2026Read More
Agentforce Contact Center
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Apex Classes for Catalog Messaging Components

          Apex Classes for Catalog Messaging Components

          Use these example Apex classes to process a Meta product catalog and return catalog data to your WhatsApp messaging component.

          Sample Apex Class for Multi-Product Messages

          This sample Apex class returns a list of RichMessaging.CatalogSection objects for a multi-product message. For more information on how to create an Apex class, see Create an Apex Class.

          Note
          Note For a multi-product message, create a list of RichMessaging.CatalogSection.
          public with sharing class GetCatalogSection {
              @InvocableMethod
              public static List<List<RichMessaging.CatalogSection>> getCatalogSection() {
                  String title = 'Wallpapers';
                  List<String> productIds = new List<String>();
                  productIds.add('ymrgtcg9co');
                  RichMessaging.CatalogSection catalogSection = new RichMessaging.CatalogSection();
                  catalogSection.titleValue = title;
                  catalogSection.productIdsValue = productIds;
          
                  List<RichMessaging.CatalogSection> x = new List<RichMessaging.CatalogSection>();
                  x.add(catalogSection);
                  List<List<RichMessaging.CatalogSection>> y = new List<List<RichMessaging.CatalogSection>>();
                  y.add(x);
                  return y;
              }
          }

          Sample Class Implementation for Single-Product and Catalog Messages

          Use this sample class implementation for both single-product and catalog messages. The class implements the RichMessaging.ProcessCatalogOrderHandler interface.

          global class MyProcessCatalogOrderHandler implements RichMessaging.ProcessCatalogOrderHandler {
              global RichMessaging.ProcessCatalogOrderResult processCatalogOrderRequest(
                      RichMessaging.ProcessCatalogOrderRequest catalogOrderRequest) {
                  return new RichMessaging.ProcessCatalogOrderResult(
                      RichMessaging.ProcessCatalogOrderResultStatus.SUCCESS, null, 'order-ref-123');
              }
          }
           
          Loading
          Salesforce Help | Article