Building Marketplace apps for Contentstack often requires connecting to external APIs such as AI models, analytics tools, webhooks, or SaaS integrations. Managing these integrations securely and efficiently can be challenging when handling API keys, endpoints, and customer-specific values. Advanced Settings in Developer Hub simplifies this process by allowing developers to manage configurations, credentials, and API interactions directly within Contentstack without maintaining a custom backend.
Additional Resources: Refer to the Introduction to Advanced Settings document to learn more.
This guide will take you through building an application using Advanced Settings.
The Quick Web Lookup is an app that uses an entry sidebar widget to quickly preview links in an entry.
The app uses Peekalink API to fetch metadata like the page title, description, and preview image. This enriches content creation by automating data entry and ensuring consistency.
The best place to start a new project is by cloning Marketplace App Boilerplate. It includes necessary components for rapid app development.
Clone the Marketplace Boilerplate repository and run the following commands:
npm install npm run dev
To register an app in Developer Hub, perform the steps given below:
Additional Resource: Refer to the Creating an App in Developer Hub documentation to know more about Standard and Machine to Machine app categories.



Note: The App Configuration UI location lets you add a Peekalink API key for the Quick Web Lookup app.

Note: The Entry Sidebar UI location allows you to view the app in the Entry Sidebar of an entry.

Enter the App URL and click Save to apply and confirm your hosting configuration. While running the application locally, select Custom Hosting and use your local app URL (for example, http://localhost:3000).
After development, you can host your application using Contentstack Launch.

Advanced Settings comprises three features: Variables, Mappings, and Rewrites.
Additional Resource: Refer to the Introduction to Advanced Settings document to learn more.
Configure Mappings: For the Quick Web Lookup app, configure a new mapping, API_KEY which will be linked to peekalink_api_key stored in the server configuration. Later, we will use the same key to store the configuration in the next step.

Configure Rewrites: Configure a Rewrite rule which calls the peekalink_api_key, prefixed with /preview as shown below:

Quick Web Lookup application needs peekalink_api_key to be configured earlier to be stored in server configuration. Let’s design an app configuration screen where the user can enter his peekalink api key.
Additional Resource: Refer to this document for the reference code of peekalink_api_key.
The following code sets up the App Configuration UI with the Peekalink API key:
import React, { useRef } from 'react';
// useInstallationData hook will help to get and set server configurations.
// Server configurations are required when you need installation specific sensitive data
import { useInstallationData } from '../../common/hooks/useInstallationData';
const AppConfiguration: React.FC = () => {
const { installationData, setInstallationData } = useInstallationData();
const peekalinkApiKeyInputRef = useRef<HTMLInputElement>(null);
const updateConfig = async () => {
if (typeof setInstallationData !== 'undefined') {
setInstallationData({
configuration: {},
serverConfiguration: {
peekalink_api_key: peekalinkApiKeyInputRef.current?.value,
},
});
}
};
return (
// Render UI
);
};
export default AppConfiguration;Additional Resource: Refer to this document to check the Reference code for fetching API using Contentstack App SDK.
import React from 'react';
import { useAppSdk } from '../../common/hooks/useAppSdk';
import { useEntry } from '../../common/hooks/useEntry';
// Implement this function, to extract URLs from a JSON Object
import { extractUrls } from '../../utils/urlExtractor';
const EntrySidebarExtension: React.FC = () => {
// gets data from current entry
const { entryData } = useEntry();
// gets app sdk
const appSdk = useAppSdk();
// gets urls from entry data
const urls = entryData ? extractUrls(entryData) : [];
// fetch link preview from peekalink api
const fetchLinkPreview = async (url: string): Promise<any> => {
const response = await appSdk?.api(`/preview`, {
method: 'POST',
headers: {
Authorization: `Bearer {{map.API_KEY}}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ link: url }),
});
return response?.json();
};
return (
// Render UI here
<>
);
};Note: The App SDK API method is designed to simplify how Contentstack apps integrate with APIs. It allows apps to interact with Contentstack's platform APIs using the configured permissions, and with external APIs using the Rewrite rules set up as part of Advanced Settings.
To install and test the app, follow the steps below:


Additional Resource: Refer to the Peekalink site to fetch the API Key. You must create an account to get the API Key.


This app connects to third-party APIs securely using Contentstack’s app and server configuration, without building or deploying a custom backend or worrying about future maintenance.