Tag: CDP

Siteocre Personalize – Create a triggered experience to send abandon cart mail

This blog describes the step by step process to create a triggered expereience in Sitecore Personalize to send a abandon cart mail.

Create Experience

Choose Triggered Experience

Name the experience

Configure API Request

Choose a connection created in this blog post – here

Configure the reponse

Save and Close

Start the Expereince and select option “Run immediately”

Steps to add abandon the cart-

Step 1 – View event

Follow the blog post – here

Step 2- Identity event

Follow the blog post – here

Step 3- Add event

Follow the blog post – here

Step 4 – Force Close event

Follow the blog post – here OR wait for session to expire ( normally 20 minutes or as configured in POS)

Mail is delivered to the customer

Loading

Sitecore Personalize – Create connection used by triggered experience

Create connection to external service used to trigger experience. This connections are outbound.

In this blog will see an example to create a connection to mailjet which can be used to trigger a expereience for abandon cart(covered in another blog post)- here

Setup mailjet account

Create a new account if you don’t have any- https://www.mailjet.com/

In the Account Settings => select optin “API Key management”

Note the API Key and Secret Key

Generate a secret key if not already generated.

Create a connection in Sitecore CDP portal

Navigate to “Develoepr center” => Connections option

Search for existing connection or “Add Connection”

Select “Destination” option for Flows to send data.

Fille in the required details and select icon-

Authentication

Next setup the Basic Authentication. Copy the API Key as User Name and Password as Secret Key and “Test Authentication”

Setup the request

Get the api endpoint and the request body from here – https://dev.mailjet.com/email/guides/getting-started/

// Sample mail 
{
    "Messages": [
        {
            "From": {
                "Email": "pilot@mailjet.com",
                "Name": "Your Mailjet Pilot"
            },
            "To": [
                {
                    "Email": "passenger@mailjet.com",
                    "Name": "Customer 1"
                }
            ],
            "Subject": "Your cart is waiting",
            "TextPart": "Dear passenger, Welcome to pastoral grill",
            "HTMLPart": "<h3>Dear passenger 1, welcome to <a href=\"https://www.mailjet.com/\">Mailjet!</a></h3><br />May the delivery force be with you!"
        }
    ]
}

Tet the connection-

Note- add sender address to the contact list in mailjet or the mails will be blocked. Also the mails from gmail wont be triggered. Use this URL to add sender address-

https://app.mailjet.com/account/sender

Check if the test Mail received-

Click Next, Review & Save

Connection is created and this can be used when an expereince is triggered.

Next setup the Triggered Expereince

Loading

Sitecore CDP – Abandon cart with force close event

You can force close event to test Abandon Cart. This works only in non-prod environments.

Assumption- An identified guest which is active and has added products in cart.

If you are corectly tracking you should see in the timeline Session and event a Product been added.

So whilst developing if you want to force close this session, since you might not want to wait for 20 minutes for session to expire or whatever time is set to expire the session, you can force close the session to see or perform the next steps if the cart is been abandoned.

The force close event can be triggered by providing message type as FORCE_CLOSE in the payload.

Send the payload to this endpoint. For more details on what should be the apiEndpoint and client key see this blog

https://{{apiEndpoint}}/{{apiVersion}}/event/create.json?client_key={{CLIENT_KEY}}&message={{message}}

var browser_id = pm.environment.get("browserId") -- browser id
var pointOfSale = pm.environment.get("PointOfSale") -- point of sale

var message = {    
    "channel": "WEB",
    "type": "FORCE_CLOSE",
    "language": "EN",
    "currency": "GBP",
    "page": "home page",
    "pos": pointOfSale,
    "browser_id": browser_id
}

postman.setEnvironmentVariable("message", JSON.stringify(message));

Since the session is now closed we can see the Abandoned Revenue. Further reminder mails can be sent to user to complete the purchase on the abandoned cart.

Hope this helps.

Loading

Sitecore CDP and Personalize FAQs

February 2023 Update – Sitecore has released new api endpoint per region which routes through a CDN closer to end users call along with new Javascript library. See the new documentation here – Sitecore CDP developer documentation

How to get the Client Key and API Token?

Get the client key from the Sandbox/CDP & Personalise portal.

Login to portal – https://app.boxever.com/#/

Top right click the settings icon. Select API Access option

Get teh client key from this page-

How to create and get the point of sale?

Login to portal – https://app.boxever.com/#/

Top right click the settings icon. Select API Access option

Search or Create a point of sale-

Enter Name and other required details. Timeout is the session timeout.

How to debug?

Navigate to the Features options

Enable the Debug option

Orange settings icon will appear where the debug is possible-

How to get the base URL for Sitecore CDP Rest API?

Old Endpoints

RegionAPI endpoint
Europeapi.boxever.com
Asia Pacificapi-ap-southeast-2-production.boxever.com
United Statesapi-us.boxever.com

New Endpoints from February 2023 *

ENVIRONMENTBASE URL
AP Regionhttps://api-engage-ap.sitecorecloud.io​
EU Regionhttps://api-engage-eu.sitecorecloud.io
US Regionhttps://api-engage-us.sitecorecloud.io

* Endpoints can change see Sitecore documentation for the up-to-date URL’s

See the updated URL’s here-

https://doc.sitecore.com/personalize/en/developers/api/index-en.html#UUID-b6753c92-1347-86de-069c-f3a5c99ad6c3_UUID-5f0de4b0-05f7-7700-3378-23283d1839ab

What is the Web Flow target URL?

Web Flow target URL is used for Web Experiements and Experiences.

From the documentation following is the URL, but this can change. See the link for up-to-date URL-

ScenarioWeb flow target
Your organization uses Sitecore Personalize.https://d35vb5cccm4xzp.cloudfront.net
Your organization does not use Sitecore Personalize.An empty string ""

https://doc.sitecore.com/personalize/en/developers/api/index-en.html#UUID-a2c699f5-0ea0-028e-b0e3-599e0308e969

What is the latest version of Javascript Library?

Boxever JavaScript Library (legacy)

https://doc.sitecore.com/personalize/en/developers/api/index-en.html#UUID-c2389675-0a7b-3cd9-3e9a-0111d360af39

See the release notes for the latest version. Point of writing this blog the version is 1.4.9. This can change. See the link to get the latest version.

https://doc.sitecore.com/personalize/en/developers/api/index-en.html#UUID-91e5c577-92c2-71c4-efca-4b5b61edc817

How to get Fullstack Experience friendly id?

Navigate to Experience => Full Stack option. Search and open the exprience

Goto details tab to get the friendly id-

What if the size of the compressed batch file exceeds the max limit i.e. 50MB?

Recompress the files into two or more compressed batch files that do not exceed the 50MB size limit. Then upload the compressed files as separate batches.

Reference –

Size limit for uploading batch files

Why I recieve HTTP 400 response when uploading the batch file?

If the size of the import does not match the one specified in the size field in the request, the service returns a HTTP 400 response.

Reference –

Frequent errors you might encounter during the batch file upload process

Why I recieve HTTP 409 response when uploading the batch file?

If the base64 checksum attribute in header does not match the hex-encoded MD5 Checksum generated by uploading the compressed file you will receive 409 response.

Reference –

Frequent errors you might encounter during the batch file upload process

How to delete a guest profile without using Batch API?

Make a DELETE request to the following endpoint- https://api.boxever.com/v2/guests/{GUESTREF}

It may take upto 24 hours for the Guest to be removed

What access do you need to setup the Point of sale for Sitecore CDP and Personalize?

Enterprise User Manager or Enterprise Admin role 

How to generate the browser id using postman?

To generate browserid send a request to this endpoint –

https://{{apiEndpoint}}/{{apiVersion}}/browser/create.json?client_key={{CLIENT_KEY}}&message={}

See above the apiendpoint and apiversion to use.

Send request with the clientkey in query parameters.

The “ref” in response is the browser id

Loading