Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.msgflash.com/llms.txt

Use this file to discover all available pages before exploring further.

Endpoints

MethodEndpoint
GET/api/v1/templates
POST/api/v1/templates
GET/api/v1/templates/{id}
PUT/api/v1/templates/{id}
DELETE/api/v1/templates/{id}
POST/api/v1/templates/{id}/preview
Authentication: x-api-key: <api_key>

Parameter models

GET /api/v1/templates

ParameterTypeRequiredLocationDescription
pageintegernoqueryPage, défaut 1
limitintegernoqueryTaille, défaut 20, max 100

POST /api/v1/templates

FieldTypeRequiredLocationDescription
namestringyesbodyName of the template
typeenumyesbodytext, image, video, audio, document
bodystringyes if type=textbodyBody avec placeholders
mediaUrlstringyes si template mediabodyPublic media URL

POST /api/v1/templates/{id}/preview

FieldTypeRequiredLocationDescription
idUUIDyespathID du template
instanceIdUUIDnobodyinstance.* context
contactIdUUIDnobodycontact.* context
variablesobjectnobodycustom.* values

Syntaxe des variables

Format :
{{namespace.variable}}
Namespaces supportés :
  • contact.*
  • user.*
  • instance.*
  • custom.*
Example:
Hello {{contact.firstName}}, votre code {{custom.code}} est prêt sur {{instance.name}}.
Variables are automatically detected and recomputed by the backend from body. You do not need to maintain the variables list manually.

Create un template

curl -X POST https://srv.msgflash.com/api/v1/templates \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Relance panier",
    "type": "text",
    "body": "Hello {{contact.firstName}}, utilisez {{custom.code}} aujourd''hui."
  }'
Response:
{
  "data": {
    "id": "tmpl_uuid",
    "name": "Relance panier",
    "type": "text",
    "body": "Hello {{contact.firstName}}, utilisez {{custom.code}} aujourd'hui.",
    "mediaUrl": null,
    "variables": ["contact.firstName", "custom.code"]
  }
}

Common errors

CodeHTTPWhen
VALIDATION_ERROR400Invalid body
TEMPLATE_INVALID400Placeholder invalid

Preview

curl -X POST https://srv.msgflash.com/api/v1/templates/TEMPLATE_ID/preview \
  -H "x-api-key: msgf_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "instanceId": "INSTANCE_UUID",
    "contactId": "CONTACT_UUID",
    "variables": {
      "code": "PROMO10"
    }
  }'
{
  "data": {
    "rendered": "Hello Awa, utilisez PROMO10 aujourd'hui.",
    "variables": ["contact.firstName", "custom.code"],
    "missingVariables": [],
    "valid": true
  }
}
Si une variable ne peut pas être résolue :
  • valid devient false
  • missingVariables liste les chemins missings

Common errors

CodeHTTPWhen
NOT_FOUND404Template not found
TEMPLATE_CONTEXT_UNAVAILABLE400Missing contact or instance context

Templates media

Pour image, video, audio ou document, le backend exige mediaUrl. Example:
{
  "name": "Brochure",
  "type": "document",
  "body": "Voici votre brochure {{contact.firstName}}.",
  "mediaUrl": "https://cdn.example.com/brochure.pdf"
}