Authentication Template API

1. Overview

Authentication templates deliver OTP codes via WhatsApp using the AUTHENTICATION template category. Three button variants are supported, each with its own creation and send-time constraints:

  • Copy Code: recipient taps a button to copy the OTP into the clipboard.
  • One-Tap Autofill: OTP autofills into the requesting Android app via package name and app signature hash.
  • Zero-Tap: OTP is submitted automatically without recipient interaction, subject to explicit terms acceptance at template creation.

Two APIs are covered: template creation (POST /wba/template/create) and message send (POST /wba-testing/v1/messages).

2. Template Creation API

Endpoint: POST https://apis.rmlconnect.net/wba/template/create

2.1 Copy Code — Payload

POST https://apis.rmlconnect.net/wba/template/create

{
  "template_category": "AUTHENTICATION",
  "template_name": "auth_copy_code_v120894",
  "language": ["en"],
  "message_send_ttl_seconds": 60,
  "components": {
    "body": { "add_security_recommendation": true },
    "footer": { "code_expiration_minutes": 5 },
    "buttons": {
      "type": "OTP",
      "otp_type": "COPY_CODE",
      "text": "Copy Code"
    }
  }
}

footer and message_send_ttl_seconds are optional for Copy Code; add_security_recommendation can be true or false.

2.2 One-Tap Autofill — Payload

POST https://apis.rmlconnect.net/wba/template/create

{
  "template_category": "AUTHENTICATION",
  "template_name": "auth_one_tap_v1",
  "language": ["en"],
  "message_send_ttl_seconds": 60,
  "components": {
    "body": { "add_security_recommendation": true },
    "footer": { "code_expiration_minutes": 10 },
    "buttons": {
      "type": "OTP",
      "otp_type": "ONE_TAP",
      "text": "Copy Code",
      "autofill_text": "Autofill",
      "package_name": "com.example.myapp",
      "signature_hash": "K8a/AINcGX7"
    }
  }
}

signature_hash must be exactly 11 characters. autofill_text, package_name, and signature_hash are all mandatory in the button object.

2.3 Zero-Tap — Payload

POST https://apis.rmlconnect.net/wba/template/create

{
  "template_category": "AUTHENTICATION",
  "template_name": "auth_zero_tap_v1",
  "language": ["en"],
  "message_send_ttl_seconds": 60,
  "components": {
    "body": { "add_security_recommendation": true },
    "footer": { "code_expiration_minutes": 10 },
    "buttons": {
      "type": "OTP",
      "otp_type": "ZERO_TAP",
      "text": "Copy Code",
      "autofill_text": "Autofill",
      "package_name": "com.example.myapp",
      "signature_hash": "K8a/AINcGX7",
      "zero_tap_terms_accepted": true
    }
  }
}

Same button-object requirements as One-Tap, plus zero_tap_terms_accepted, which must be present and true.

2.4 Field Reference

FieldTypeRequiredConstraints
template_categorystringYesMust be AUTHENTICATION
template_namestringYesUnique template identifier
languagearrayYese.g. ["en"]
message_send_ttl_secondsintegerNoRange 30–900 for authentication templates (C-N2)
components.body.add_security_recommendationbooleanYestrue or false
components.footer.code_expiration_minutesintegerNoOptional footer note
components.buttonsobjectYesRequired at all; missing fails creation (C-N3)
components.buttons.typestringYesMust be OTP
components.buttons.otp_typestringYesOne of COPY_CODE, ONE_TAP, ZERO_TAP (C-N1)
components.buttons.textstringYesButton label, e.g. "Copy Code"
components.buttons.autofill_textstringONE_TAP / ZERO_TAP onlyRequired (5.3)
components.buttons.package_namestringONE_TAP / ZERO_TAP onlyRequired (5.4, 6.5)
components.buttons.signature_hashstringONE_TAP / ZERO_TAP onlyRequired, exactly 11 chars (5.2, 5.5, 6.4)
components.buttons.zero_tap_terms_acceptedbooleanZERO_TAP onlyRequired, must be true (6.2, 6.3)

2.5 Test Cases — Template Creation

Copy Code (Feature 4)

IDScenarioExpected
4.1Happy path: full payload with footer and ttl200 OK — template created, Template ID returned
4.2add_security_recommendation false, no footer, no ttl200 OK — footer and ttl confirmed optional

One-Tap Autofill (Feature 5)

IDScenarioExpected
5.1Happy path: full payload, 11-char signature_hash200 OK — template created
5.2signature_hash too short ("abc123")422 — signature_hash must be exactly 11 characters long
5.3Missing autofill_text422 — please provide autofill_text element in button
5.4Missing package_name422 — please provide package_name element in button
5.5Missing signature_hash422 — please provide signature_hash element in button

Zero-Tap (Feature 6)

IDScenarioExpected
6.1Happy path: full payload, terms accepted200 OK — template created
6.2Missing zero_tap_terms_accepted422 — please provide zero_tap_terms_accepted element in button
6.3zero_tap_terms_accepted: false422 — zero_tap_terms_accepted must be true for ZERO_TAP authentication templates
6.4signature_hash too short ("short")422 — signature_hash must be exactly 11 characters long
6.5Missing package_name422 — please provide package_name element in button

Cross-Type Validation

IDScenarioExpected
C-N1otp_type: "INVALID_TYPE"422 — otp_type must be one of ONE_TAP, COPY_CODE, ZERO_TAP
C-N2message_send_ttl_seconds: 1000 (> 900)422 — message_send_ttl_seconds should have value in range from 30 to 900 for authentication templates
C-N3components.buttons omitted entirely422 — please provide button element in components

3. Message Send API

Endpoint: POST https://apis.rmlconnect.net/wba-testing/v1/messages

3.1 Copy Code — Payload

POST https://apis.rmlconnect.net/wba-testing/v1/messages

{
  "phone": "9922892143",
  "media": {
    "type": "media_template",
    "template_name": "auth_copy_code_v120894",
    "lang_code": "en",
    "body": [{ "text": "123456" }],
    "button": [
      {
        "button_no": "0",
        "button_type": "authentication",
        "text": "123456"
      }
    ]
  }
}

3.2 One-Tap Autofill — Payload

POST https://apis.rmlconnect.net/wba-testing/v1/messages

{
  "phone": "919876543210",
  "media": {
    "type": "media_template",
    "template_name": "auth_one_tap_v1",
    "lang_code": "en",
    "body": [{ "text": "12345" }],
    "button": [
      {
        "button_no": "0",
        "button_type": "one_tap",
        "text": "12345",
        "autofill_text": "Autofill",
        "package_name": "com.example.myapp",
        "signature_hash": "K8a/AINcGX7"
      }
    ]
  }
}

3.3 Zero-Tap — Payload

POST https://apis.rmlconnect.net/wba-testing/v1/messages

{
  "phone": "919876543210",
  "media": {
    "type": "media_template",
    "template_name": "auth_zero_tap_v1",
    "lang_code": "en",
    "body": [{ "text": "12345" }],
    "button": [
      {
        "button_no": "0",
        "button_type": "zero_tap",
        "text": "12345"
      }
    ]
  }
}

3.4 Field Reference

FieldTypeRequiredConstraints
phonestringYesRecipient mobile number
media.typestringYesMust be media_template
media.template_namestringYesMust match an approved authentication template
media.lang_codestringYese.g. "en"
media.bodyarrayYesExactly one object; OTP text. Max 50 chars for authentication/copy_code (4.5); max 15 chars for one_tap/zero_tap (5.7, 6.7); only one parameter allowed (4.8)
media.button[].button_nostringYesMust be "0" for all three types (4.7, S-N4, S-N5)
media.button[].button_typestringYesauthentication, one_tap, or zero_tap (6.9)
media.button[].textstringYesMust equal media.body text exactly (4.4, 5.10, 6.8); mandatory field (4.6, S-N1, S-N2)
media.button[].autofill_textstringone_tap onlyRequired (5.8)
media.button[].package_namestringone_tap onlyRequired (5.9)
media.button[].signature_hashstringone_tap onlyRequired (S-N3)

3.5 Test Cases — Message Send

Copy Code (Feature 4)

IDScenarioExpected
4.3Happy path: body and button text match200 OK — message queued, Copy Code button displayed
4.4Body text ≠ button text (123456 vs 999999)422 — body object text parameter and button object text parameter must be same if the template category is authentication
4.5OTP text exceeds 50 characters422 — length of body object text parameter must be less than 50 characters
4.6Button object missing text field422 — text key is mandatory in button object if the template category is authentication
4.7button_no: "1" (must be 0)422 — button_no value must be 0 if the template category is authentication
4.8media.body has two parameter objects422 — body object must contain only one parameter if the template category is authentication
S-N6OTP exactly 50 characters (boundary)200 OK — 50 characters is the accepted maximum

One-Tap Autofill (Feature 5)

IDScenarioExpected
5.6Happy path: full button object200 OK — message queued, autofill OTP delivered
5.7OTP text exceeds 15 characters422 — length of OTP code must be 15 characters or less for one_tap authentication template
5.8Missing autofill_text422 — autofill_text key is mandatory in button object if the button_type is one_tap
5.9Missing package_name422 — package_name key is mandatory in button object if the button_type is one_tap
5.10Body text ≠ button text (12345 vs 99999)422 — body object text parameter and button object text parameter must be same if the template category is authentication (one_tap)
S-N2Missing button text422 — text key (OTP code) is mandatory in button object if the button_type is one_tap
S-N3Missing signature_hash422 — signature_hash key is mandatory in button object if the button_type is one_tap
S-N4button_no: "1" (must be 0)422 — button_no value must be 0 if the template category is authentication (one_tap)
S-N7OTP exactly 15 characters (boundary)200 OK — 15 characters is the accepted maximum

Zero-Tap (Feature 6)

IDScenarioExpected
6.6Happy path: full button object200 OK — message queued, zero-tap delivered
6.7OTP text exceeds 15 characters422 — length of OTP code must be 15 characters or less for zero_tap authentication template
6.8Body text ≠ button text (12345 vs 99999)422 — body object text parameter and button object text parameter must be same if the template category is authentication (zero_tap)
6.9button_type: "invalid_type"422 — button_type must be authentication, one_tap, or zero_tap
S-N1Missing button text422 — text key (OTP code) is mandatory in button object if the button_type is zero_tap
S-N5button_no: "1" (must be 0)422 — button_no value must be 0 if the template category is authentication (zero_tap)

Did this page help you?