Month: February 2023

Sitecore CDP and Personalize FAQs

Last Updated on September 7, 2023 by sandeeppote

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

Setup Sitecore Headless SXA with Next js

Last Updated on February 21, 2023 by sandeeppote

Pre-requisite-

Install Sitecore 10.3 XP0 on local machine – see this blog to install the SIF way

Install Powersehll Extensions

Sitecore PowerShell Extension for Sitecore on your local Sitecore instance

Sitecore Headless Rendering 21.0.0

Install Sitecore Headless Services for Sitecore XP on your local Sitecore instance

See the Sitecore Headless Rendering 21.0.0 download page

Install SXA module –

Sitecore Experience Accelerator on your local Sitecore instance

See the Sitecore Experience Accelerator 10.3.0 dowload page

Once you have the above installed the local instance should have options to create a Headless Tenant and Folder

Ensure all the search index and rebuilt-

Install Node js Download | Node.js (nodejs.org). Latest whilst writing this blog was v18.14.0

Create a Headless Tenant

Select the Headless Tenant

Enter a valid tenant Name and the modules to install –

Should create a tenant successfully-

Create a Headless Site

Now create a Headless Site

Provide a valid Site name and other options-

Select the modules to install-

Keep the Site settings as is for now and will generate the deployment secret later-

Site should be crated within the tenant-

Setup the rendering host

Site Settings – Check for the rendering host- should have set to Default

/sitecore/content/mycompany/retail/Settings/Site Grouping/retail

Find the Default rendering host on this location-

/sitecore/system/Settings/Services/Rendering Hosts/Default

Server side rendering engine endpoint URL:- http://localhost:3000/api/editing/render

Server side rendering engine application URL:- http://localhost:3000

Application name:- e.g.:- retail-app

Where is the above value coming from – when a next js app is created by default it is hosted on port 3000. Please see section below- NEXT STEPS

Create JSS Api key

Navigate to this location to create API key- /sitecore/system/Settings/Services/API Keys

Provide a valid name-

Set the CORS and Allowed Controllers to all domains. Set this to *

Will need API key while setting up the next js app.

Install JSS globally

https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/install-the-jss-cli-globally.html

npm install -g @sitecore-jss/sitecore-jss-cli

Initialise JSS App

Refer following for various options –https://doc.sitecore.com/xp/en/developers/hd/210/sitecore-headless-development/the-jss-app-initializer.html

Use following command-

npx create-sitecore-jss --templates nextjs,nextjs-sxa --appName retail-app --hostName xp103.sc --fetchWith GraphQL

Possible values for templates arguments-

Base templatesnextjs. Other possible values-

Other templates

appName – enter the app name provided in the rendering host. See Setup the rendering host section

hostname– enter the hostname of the Sitecore instance

While installing following questions are asked-

? Where would you like your new app created? – provide the location to create a next jss app

? How would you like to prerender your application? – Select SSG

Understand the pre-rendering to select. In this case I have selected SSG option.

https://doc.sitecore.com/xp/en/developers/hd/190/sitecore-headless-development/prerendering-methods-and-data-fetching-strategies-in-jss-next-js-apps.html

https://doc.sitecore.com/xp/en/developers/hd/210/sitecore-headless-development/switch-the-pre-rendering-method-in-a-jss-next-js-app.html

Following files will be created in a new folder (retail-app) –

Setup JSS app-

see this link- https://doc.sitecore.com/xp/en/developers/hd/190/sitecore-headless-development/start-a-jss-app-in-disconnected-mode.html

Setup the JSS app-

jss setup

Following options are asked, provide the required details-

Is your Sitecore instance on this machine or accessible via network share? [y/n]: y

Path to the Sitecore folder (e.g. c:\inetpub\wwwroot\my.siteco.re): C:\inetpub\wwwroot\XP103.sc

Sitecore hostname (e.g. http://myapp.local.siteco.re; see /sitecore/config; ensure added to hosts): https://xp103.sc

Sitecore import service URL [https://xp103.sc/sitecore/api/jss/import]: [Leave blank]

Sitecore API Key (ID of API key item): B418AB1D-A7A9-48F4-9A96-51F7D6C2105F [enter the api key created earlier- see section Create JSS Api key ]

Please enter your deployment secret (32+ random chars; or press enter to generate one): [Leave this blank and it should create one or enter the value here]

See the highlighted values. Also note the where the deployment secret is written-C:\projects\Sitecore\HeadlessSXA\retail-app\sitecore\config\retail-app.deploysecret.config

NEXT STEPS

Remove/Comment the site definition in this case as opposed to JSS sites as this will be handled in Sitecore site settings-

Remove it from /sitecore/config/retail-app.config

Verify JSS app registration-

See the values of Endpoint Url and Application URL. The same url was configured in rendering host.

Set JSS Editing Secret in .env file- Use the deployment secret from the /sitecore/config/app-name.deploysecret.config

Deploy config

jss deploy config

Note the config was deployed to C:\inetpub\wwwroot\XP103.sc\App_Config\Include\zzz folder in the Sitecore instance

Start Application in connected mode

jss start:connected

Application should listen to http://localhost:3000

Try accessing – http://localhost:3000

Errors:-

Solution

$env:NODE_TLS_REJECT_UNAUTHORIZED=0

Error-

Solution-

Search for root item in code- open \src\lib\dictionary-service-factory.ts

Error- Page not found

Solution – Ensute the site and the app name is same.

After all the above errors, it should show the blank page- Since there are no component s added.

Lets add some content, for this opne the Home page in experienec editor and see this error-

Error- Connection to your rendering host failed with an Unauthorized error. Ensure the JSS Editing Secret is configured.

Update the JSS Editing Secret in Sitecore instance at following path (best practice-you have to patch the config instead of updating the Sitecore configs directly)

App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.ViewEngine.Http.config

Update the value to the deployment secret used earlier in .env file-

After update-

Finally we can see the experience editor-

Add some content –

Save and Publish

Finally we have next js app showing the content- on localhost:3000

Layout Services

Lets check if the layout services are accessible-

Get Item data (home) and secret key-

https://xp103.sc/sitecore/api/layout/render/jss?item={40A111E6-6B4D-41D5-BA0D-FD993C5D00E4}&sc_apikey={B418AB1D-A7A9-48F4-9A96-51F7D6C2105F}

Graphql

https://xp103.sc/sitecore/api/graph/edge/ui?sc_apikey={B418AB1D-A7A9-48F4-9A96-51F7D6C2105F}

Loading

Sandeep Pote wins Sitecore Most Valuable Professional award

Last Updated on February 1, 2023 by sandeeppote

Sandeep Pote has been named a Most Valuable Professional (MVP) in the Technology by Sitecore®, a global leader in end-to-end digital experience management software. Sandeep Pote was one of only 137 Technology MVPs | 30 Strategy MVPs | 74 Ambassadors] worldwide to be named a Sitecore MVP this year.

Now in it’s 17th year, the MVP program recognizes professionals who actively share their fascination, knowledge and expertise with online and offline Sitecore communities to help them best utilize Sitecore products to deliver premier customer experiences.

Selected out of more than 16,000 certified developers and over 30,000 active community participants, the 241 MVPs are truly an elite group. This year’s MVPs were selected by a panel of Sitecore employees for the quality, quantity and impact of the contributions they made in 2022, including the sharing of product expertise and advanced knowledge of the Sitecore platform to support both partners and customers.

Sandeep also joined MVP mentor program.

Loading