Skip to main content
Context Links are buttons in the conversation sidebar that open external URLs with contact and conversation details filled in. Agents click them to jump to CRMs, billing systems, or internal dashboards without copy-pasting identifiers.

Setup

Go to Admin > Integrations > Context Links and click Create Context Link.
FieldDescription
NameLabel shown to agents (e.g., “Open in CRM”)
URL TemplateURL with placeholders (see below)
Secret32-character key, required only if you use {{token}}
Token ExpiryHow long the encrypted token stays valid
StatusEnable or disable the link

URL Template Variables

These placeholders are replaced with the current contact’s details when an agent clicks the link.
VariableDescription
{{email}}Contact’s email
{{phone}}Contact’s phone number
{{external_user_id}}Contact’s external user ID
{{contact_id}}Contact’s internal Libredesk ID
{{first_name}}Contact’s first name
{{last_name}}Contact’s last name
{{conversation_uuid}}UUID of the current conversation
{{token}}Encrypted token containing all fields (requires secret)

Encrypted Token

When you use {{token}}, Libredesk generates an AES-256-GCM encrypted, time-limited token containing all the above fields plus agent_id, agent_email, iat, and exp. The receiving system decrypts it with the shared secret.

Decrypting the Token

import base64, json, time
from cryptography.hazmat.primitives.ciphers.aead import AESGCM

def decrypt_context_token(token, secret):
    raw = base64.b64decode(token)
    nonce = raw[:12]
    ciphertext = raw[12:]

    aesgcm = AESGCM(secret.encode('utf-8'))
    plaintext = aesgcm.decrypt(nonce, ciphertext, None)
    return json.loads(plaintext)

# Usage
secret = "your-32-character-shared-secret!"  # exactly 32 characters
payload = decrypt_context_token(token_from_url, secret)

if payload["exp"] < time.time():
    raise ValueError("Token has expired")

print(payload["email"], payload["conversation_uuid"])