Update a Template Fragment

You can update the text in a Template Fragment using this endpoint. Note that there are four reserved template variables that can be used here: ${code}, ${brand}, ${time-limit} and ${time-limit-unit}.

KeyDescription
VONAGE_APPLICATION_ID

The Vonage Application ID.

VONAGE_APPLICATION_PRIVATE_KEY_PATH

Private key path.

JWT

Used to authenticate your request. See Authentication for more information, including how to generate a JWT.

TEMPLATE_ID

The custom template ID

TEMPLATE_FRAGMENT_ID

The custom template fragment ID

Write the code

Add the following to update-template-fragment.sh:

curl -X PATCH "https://api.nexmo.com/v2/verify/templates/$VERIFY_TEMPLATE_ID/template_fragments/$VERIFY_TEMPLATE_FRAGMENT_ID" \
  -H "Authorization: Bearer $JWT"\
  -H 'Content-Type: application/json' \
  -d $'{
	   "text": "The authentication code for your ${brand} is: ${code}"
  }'

View full source

Run your code

Save this file to your machine and run it:

sh update-template-fragment.sh