How to integrate with Salesforce Commerce Cloud

Overview

Salesforce Commerce Cloud is a leading eCommerce platform that many Enterprise customers leverage to power their online stores. The integration with Friendbuy allows you to enhance your referral and loyalty programs by automating key functionalities and providing a seamless experience for your customers.

Key Benefits for Salesforce Commerce Cloud Users

  1. Streamlined Integration:
    • Quick and Easy Setup: Reduce the time and effort required to implement Friendbuy’s referral and loyalty programs. The integration with Salesforce Commerce Cloud simplifies the process, allowing you to go live faster.
  2. Enhanced Customer Experience:
    • Seamless Tracking: Automatically track customer activities such as purchases, sign-ups, and custom events.
    • Personalized Interactions: Provide a more personalized experience by tagging customers as Friendbuy Advocates or Referred Friends.
  3. Efficient Reward Management:
    • Automated Coupon Generation: Generate reward and friend incentive coupons based on predefined criteria like purchase thresholds and SKU restrictions, ensuring accurate and timely reward distribution.
    • Reward Validation: Utilize Friendbuy’s reward delay feature to validate rewards through Salesforce Commerce Cloud, ensuring compliance with your business rules.
  4. Data Integration and Utilization:
    • Comprehensive Customer Profiles: Enrich customer profiles in Salesforce Commerce Cloud with referral and loyalty data from Friendbuy, providing a holistic view of customer interactions and preferences.
    • Dynamic Customer Groups: Set up dynamic customer groups to better segment and target your audience, enhancing the effectiveness of your marketing campaigns.
  5. Global Support:
    • Default Currency Management: For merchants with international stores, the integration handles default currency settings, ensuring a consistent experience across different regions.

Before Getting Started

Login to both your Friendbuy and Salesforce Commerce Cloud (Business Manager) platforms.

Getting Started

To begin the integration, you’ll need to Salesforce Commerce Cloud APIs and Friendbuy credentials. Follow the detailed steps in the subsequent sections to complete the integration, enabling a seamless and automated referral and loyalty experience for your customers.

Setting up your Salesforce Commerce Cloud Integration

Configure Friendbuy Track Events:

Import Friendbuy Type Extensions:

First, Friendbuy metadata must be imported into your B2C instance to add the required customizations.

  1. Download metadata.zip archive
  2. Extract the zipped files
  3. In your B2C instance, navigate to Administration -> Site Development -> Import & Export
  4. In the Import & Export Files section, select Upload

  1. Select the previously extracted type extensions file (metadata/meta/system-objecttype-extensions.xmlI).
    This will add configurable properties to several system objects.
Of particular note, the extension file will add new site preference properties for storing the Friendbuy merchant ID and account secret, which are referenced in cartridge code for associating track events to your Friendbuy merchant and authorize customer track events respectively.
  1. Select Upload
  2. Back in the main Import & Export page, under the Metadata section, select Import
  3. Select the uploaded extensions file, then Next, followed by Import on the following page

  1. Confirm successful import of the type extensions

  1. In the top-left corner, select B2C site you would like to integrate with Friendbuy (Below is a sample. Please select your specific store name)

  1. Under Merchant Tools -> Site Preferences -> Custom Preferences, select the "friendbuy" group.
  2. In your Friendbuy account, navigate to Settings on the left, and select Account. Scroll down and copy the Merchant ID to your clipboard. Add the following settings.
    1. Merchant ID - YOUR_FRIENDBUY_MERCHANT_ID
    2. Account Secret - Use the value in your Friendbuy account (Developer Center -> Friendbuy Code -> Secret Key)
  3. Navigate back to your B2C commerce Cloud instance, and paste the Merchant ID and Secret Key. Select Save
Download and Install Friendbuy cartridges
  1. Download catridges.zip file
    Friendbuy ships two cartridges to facilitate communication between Friendbuy and Salesforce Commerce Cloud sites, int_salesforce_sfra and int_salesforce_core. For information on cartridge internals, see the cartridges documentation.
  2. Using your preferred WebDav client, upload the cartridges. Upload help doc here.
  3. On your B2C commerce cloud platform, go to Administration ->Sites -> Manage Sites
  4. Select the B2C site you would like to integrate with Friendbuy
  5. Select the Settings tab
  6. Ensure your instance type is the intended enviroment
  7. Modify the site cartridge path to include int_friendbuy_sfra:int_friendbuy_core:app_storefront_base

Your cartridge path will differ from the above example if you have other cartridges installed.

The Friendbuy cartridges must be at the beginning of the list.
  1. Select Apply
At this point in the installation, you can configure and display Friendbuy widgets on your storefront

Configure Friendbuy reward generation

Import the Friendbuy custom job

When new reward options are configured in your account, Friendbuy will automatically synchronize these settings in your B2C site to create any necessary Salesforce Commerce Cloud promotions or coupons. This is facilitated by a custom job implemented in the int_friendbuy_core cartridge. Prior to running the sync, the job definition must be imported.

  1. On your B2C commerce cloud platform, In the top-left corner, ensure the site used in previous steps is selected.

  1. Under Administration -> Operations -> Import & Export
  2. In the Import & Export Files section, select Upload

  1. Select the previously extracted job definition file (metadata/jobs.xml)

  1. Select Upload
  2. Back in the main Import & Export page, under the Jobs section, select Import

  1. Select the uploaded jobs file, then Next

  1. Select Next on the validation results page
  2. If prompted to provide an Import Mode, choose REPLACE and then select the Import button
Add a new Salesforce Commerce Cloud Client

In order to generate coupon codes and synchronize the Friendbuy reward configuration, Friendbuy will need to be granted OCAPI API access to your B2C site.

  1. Visit the Account Manager, and add a new API client
  2. Fill out all required fields and add the following Friendbuy specific settings:
    1. Default Scopes
      mail
      roles
      tenantFilter
      profile
      openId
    2. Redirect URIs
      https://retailer.friendbuy.io/developers/integrations/salesforceB2c
    3. Token Endpoint Auth Method: client_secret_post
    4. Access Token Format: JWT
  3. Create the client, and copy the ID and password for the next installation steps
Configure Open Commerce API settings

The OCAPI API restricts access to almost all resources by default. We will need to grant access to the client we just created.

  1. In the Business Manager, visit Administration -> Site Development -> Open Commerce API Settings
    If there is existing client configuration, you will need to add the following snippets in the clients list. Ensure there is a version for your API settings.
    Replace the YOUR_CLIENT_ID with your actual client ID.

    To ensure access to the required resources, use the Global context in production.
    Shop
    {
    "client_id": "YOUR_CLIENT_ID",
    "resources": [
    {
    "resource_id": "/orders/*",
    "methods": ["get"],
    "read_attributes": "(**)",
    "write_attributes": "(**)"
    },
    {
    "resource_id": "/customers/*/orders",
    "methods": ["get"],
    "read_attributes": "(**)",
    "write_attributes": "(**)"
    },

    {
    "resource_id": "/customers/*",
    "methods": ["get", "patch"],
    "read_attributes": "(**)",
    "write_attributes": "(**)"
    }
    ]
    }

    Data
    {
    "client_id": "YOUR_CLIENT_ID",
    "resources": [
    {
    "resource_id": "/sites/*/coupons/**",
    "methods": ["get", "post"],
    "read_attributes": "(**)",
    "write_attributes": "(**)"
    },
    {
    "resource_id": "/sites",
    "methods": ["get"],
    "read_attributes": "(**)",
    "write_attributes": "(**)"
    },
    {
    "resource_id": "/jobs/FriendbuyImportConfig/executions",
    "methods": ["post"],
    "read_attributes": "(**)",
    "write_attributes": "(**)"
    },
    {
    "resource_id": "/jobs/FriendbuyImportConfig/executions/*",
    "methods": ["get"],
    "read_attributes": "(**)",
    "write_attributes": "(**)"
    }
    ]
    }
    To ensure access to the required resources, use the Global context in production.

    Note the different _v values.
    The configuration now should have the following shape:
  2. Shop
    {
    "_v": "21.3",
    "clients": [
    {
    "client_id": "NEW_FRIENDBUY_CLIENT_ID",
    "resources": [
    ...
    ]
    },
    {
    "client_id": "SOME_OTHER_CLIENT_ID",
    "resources": [
    ...
    ]
    }
    ]
    }
  3. Data
    {
    "_v": "23.2",
    "clients": [
    {
    "client_id": "NEW_FRIENDBUY_CLIENT_ID",
    "resources": [
    ...
    ]
    },
    {
    "client_id": "SOME_OTHER_CLIENT_ID",
    "resources": [
    ...
    ]
    }
    ]
    }
  4. Select Save

Install the Friendbuy <-> Salesforce Commerce Cloud Integration

This section will require the Business Manager Administrator role for your user. The Account Manager can be used to grant this role.
  1. In the Friendbuy Retailer App, go to Developers -> Integrations -> Salesforce Commerce Cloud

  1. Fill in the client information and add your Open Commerce API URL
    The OCAPI URL will be your public domain name for production instances. For B2C sandboxes, refer to the OCAPI URL syntax documentation.
  2. Select Apply to begin the OAuth flow
  3. Upon successful authentication, pick your site from the dropdown and select Install Integration
  4. You will see a blue check on the integration page notifying that you a properly integrated with Salesforce Commerce Cloud.

  1. You will see a green check mark under Status, letting you know that Event are tracking properly.

Advocate Reward Configuration

You can choose to reward your Advocate with a Salesforce discount. Friendbuy will automatically generate the discount code and dynamically include it in a reward email.

  1. On the Advocate Rewards tab of your referral campaign, select How will you reward your Advocates?
  2. Select Salesforce Commerce Cloud Promotion

  1. Enter the type and amount you will reward Advocates.
    The default currency type is set as your the currency you chose when you created your merchant account

  1. Select Save Settings
  2. At any time, you may go back and modify the discount by selecting Modify Rules

Referred Friend Incentive Configuration

You can choose to reward your Friends with a Salesforce discount. Friendbuy will automatically generate the discount code and dynamically include it in a reward email.

  1. On the Friend Incentives tab of your referral campaign, select How will you incentivize referred friends?
  2. Select Salesforce Commerce Cloud Promotion

  1. Enter the type and amount you will incentive Friends with.
The default currency type is set as your the currency you chose when you created your merchant account

  1. Select Save Settings
  2. At any time, you may go back and modify the discount by selecting Modify Rules

Rewarding Loyalty Members with Salesforce Discounts

You can reward loyalty members with a Salesforce discount that will automatically be generated and distributed when a Loyalty Member earns a reward.

  1. From the Loyalty section, click the Earning Events tab at the top of the page.
  1. Click + Add Earning Event at the top right of the screen.
  2. Here you will be prompted with all the different types of Earning Events Friendbuy offers.
  3. Create an Earning Event of your choosing.
  1. Select what you want to reward the customer with when they complete an earning event.
    1. Click the Reward With drop down
  2. Select Salesforce Commerce Cloud Promotion

  1. Select the type and amount of discount and any additional logic. click save.

For more information around Earning Events, click here.

How did we do?

Contact