Skip to content
SilktideHelp

Connect a custom CMS

If Silktide has no plugin for your CMS, your developers can connect it themselves. A custom connection does the same two things as the others (see CMS connections):

  • Publishing: when a page is published or changed, your CMS tells Silktide, which retests it.
  • Editing: each page carries a meta tag saying where it is edited, so Open in CMS in Silktide opens that page in your CMS.

You can build either part, or both.

1. Get your key and API address

  1. In Silktide, open Settings, then Integrations, and choose CMS.
  2. Choose Custom CMS, pick what the connection applies to, and choose Connect.
  3. Copy the Key and the API address.

The API address depends on the region your account is in, for example https://api.eu.silktide.com. Use the one Silktide shows. In the examples below, replace https://api.eu.silktide.com with it, and the key with yours.

To check the key works, send it to /cms/test-key. Silktide answers 200 if the key is valid, and 403 if it is not:

curl --request POST \
  --header "Content-Type: application/json" \
  --data '{"apiKey": "eu:your-key"}' \
  https://api.eu.silktide.com/cms/test-key

Your integration does not need to call this. It is there for testing.

2. Publishing: tell Silktide what changed

When a page is added or changed, send a POST request to /cms/update with a JSON body:

  • apiKey: your key.
  • url: the public address of the page that changed, or urls: a list of addresses.
  • deferRetestSeconds (optional): how many seconds Silktide should wait before testing, for example while your caches clear.
curl --request POST \
  --header "Content-Type: application/json" \
  --data '{"apiKey": "eu:your-key", "url": "https://www.example.com/news/open-day"}' \
  https://api.eu.silktide.com/cms/update

Silktide answers straight away and queues the test. The page is usually retested within a minute.

Silktide only tests addresses that belong to the websites the connection applies to, within each website's testing scope. Anything else is ignored.

3. Editing: say where each page is edited

Add a meta tag to the <head> of every page your CMS publishes:

<meta name="silktide-cms" content="...">

Its content is a JSON object, Base64 encoded:

{"cms": "Your CMS name", "editorUrl": "https://cms.example.com/pages/123/edit"}
  • cms names your CMS. It is free text.
  • editorUrl is the address someone visits to edit this page.

Silktide reads the tag each time it tests the page. Open in CMS opens editorUrl in a new tab.

Base64 is easy to decode, so anyone viewing the page can read editorUrl. Never put anything in it that signs someone in, such as a token or a username. If you would rather not show your editor addresses at all, encrypt the tag.

Encrypt the tag (optional)

Encrypt the JSON with AES-256-CBC, using your key as the encryption key. Then Base64 encode, in this order: the initialisation vector, a SHA-256 HMAC of the encrypted bytes (also using your key), and the encrypted bytes. In PHP:

$data = ['cms' => 'Your CMS name', 'editorUrl' => 'https://cms.example.com/pages/123/edit'];
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('AES-256-CBC'));
$encrypted = openssl_encrypt(json_encode($data), 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv);
$hmac = hash_hmac('sha256', $encrypted, $key, true);
$content = base64_encode($iv . $hmac . $encrypted);
// $content is the meta tag's content.

4. Test it

  1. Deploy your changes. If you added the meta tag, clear any caches so the public pages carry it.
  2. Retest the website in Silktide.
  3. Open a page in the Inspector. Open in CMS should appear, and open that page in your CMS.
  4. Publish a page in your CMS. Silktide should start testing it within a minute.

If something does not work, choose Contact support in Silktide.

Last updated

Was this page helpful?