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
- In Silktide, open Settings, then Integrations, and choose CMS.
- Choose Custom CMS, pick what the connection applies to, and choose Connect.
- 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, orurls: 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"}
cmsnames your CMS. It is free text.editorUrlis 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
- Deploy your changes. If you added the meta tag, clear any caches so the public pages carry it.
- Retest the website in Silktide.
- Open a page in the Inspector. Open in CMS should appear, and open that page in your CMS.
- Publish a page in your CMS. Silktide should start testing it within a minute.
If something does not work, choose Contact support in Silktide.