Codique

DevelopersUse template codes

Developers · Send notifications

Use template codes

Copy the ready-made request for any template and fill in its values.

On this page

Every approved template in your workspace has a template code: the exact request your backend sends to deliver it, with every field the template needs already filled in. You don’t have to work out headers, variables or buttons yourself.

Get the code for a template

  1. Open EngageTemplates

  2. Click the code icon (</>) on the template’s row

    The Send “template_name” from a backend window opens.

  3. Pick the calling app

    Choose the connected app that will send it. This fills the x-app-id header. No apps yet? Register one first.

  4. Check what the template needs

    The summary shows the number of body variables, button variables and the header type, with the body text so you can see which value goes where.

  5. Copy curl and replace the placeholders

    Replace YOUR_SERVICE_KEY with the key you saved, and the sample values with real ones. Notes under the request tell you about media headers, carousels and one-time passcodes.

A template code, as copied
curl -X POST 'https://api.example.com/api/app-notifications/send' \  -H 'Content-Type: application/json' \  -H 'x-app-id: acme-orders' \  -H 'x-app-service-key: YOUR_SERVICE_KEY' \  -d '{  "to": "919876543210",  "category": "TRANSACTIONAL",  "notification_type": "order_shipped",  "template_name": "order_shipped",  "template_variables": ["Aarav", "#4421"],  "language_code": "en_US",  "button_variables": ["4421"]}'

How template parts map to fields

Fill in only the fields your template uses. The template code already includes the right ones.

In the templateFieldExample
Body {{1}}, {{2}}…template_variables["Aarav", "#4421"]
Body {{first_name}} (named)template_variables{"first_name": "Aarav"}
Text header variableheader_variables["Diwali"]
Image, video or document headerheader_media_url"https://…/invoice.pdf"
Location headerheader_location{"latitude": 12.97, "longitude": 77.59, "name": "Store"}
Website button with a variablebutton_variables["4421"]
Copy-code buttoncoupon_code"SAVE20"
Limited-time offeroffer_expirationExpiry as a timestamp or ISO date
Carouselcards[{"body_variables": ["…"], "header_media": {"link": "https://…"}}]
One-time passcode (Authentication)template_variables["482910"]; the copy-code button is filled from it
  • Numbered variables go in order: the first value fills {{1}}.
  • Media headers: if you leave header_media_url out, the image or file approved with the template is sent. Use a public https link to send a different one.
  • If a value is missing, the request is refused and the error names it, for example Template "order_shipped" needs values for: Button "Track order" URL {{1}}, instead of sending a broken message.
  • language_code picks the template’s language when you have several translations. It defaults to en_US.

Examples

OTP (Authentication template)
{  "to": "919876543210",  "category": "SYSTEM",  "notification_type": "login_otp",  "template_name": "login_code",  "template_variables": ["482910"]}
Invoice with a PDF header and named variables
{  "to": "919876543210",  "category": "TRANSACTIONAL",  "notification_type": "invoice_ready",  "template_name": "invoice_ready",  "header_media_url": "https://files.example.com/invoices/INV-1042.pdf",  "template_variables": { "customer_name": "Aarav", "amount": "₹2,499" }}
Offer with a coupon code
{  "to": "919876543210",  "category": "TRANSACTIONAL",  "notification_type": "loyalty_reward",  "template_name": "loyalty_reward",  "template_variables": ["Aarav"],  "coupon_code": "THANKYOU15"}

Turn the code into your language

The same request in the language your backend uses. Swap in the body from your template code.

curl -X POST https://api.example.com/api/app-notifications/send \  -H "Content-Type: application/json" \  -H "x-app-id: $CODIQUE_APP_ID" \  -H "x-app-service-key: $CODIQUE_SERVICE_KEY" \  -d '{    "to": "919876543210",    "category": "TRANSACTIONAL",    "notification_type": "order_confirmed",    "template_name": "order_confirmation",    "language_code": "en_US",    "template_variables": ["Aarav", "#4421"]  }'

Every field and response is listed in the Notifications API reference.

Still stuck? Contact us with what you were doing and the exact message you saw.