Skip to content

Commit ec61ae4

Browse files
committed
Updating README with details of Verify templates
1 parent cea8158 commit ec61ae4

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,66 @@ if code_check.http_response.code == '200'
488488
end
489489
```
490490

491+
### Working with Verify Custom Templates and Template Fragments
492+
493+
Verify custom templates allow you to customize the message sent to deliver an OTP to your users, rather than using the default Vonage templates. See the [Template Management Guide document](https://developer.vonage.com/en/verify/guides/custom-templates) for more information.
494+
495+
#### Templates
496+
497+
```ruby
498+
# Get a list of all templates
499+
template_list = verify.templates.list
500+
501+
# Get details of a specific template
502+
template = verify.templates.info(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9')
503+
504+
# Create a new template
505+
verify.templates.create(name: 'my-template')
506+
507+
# Update an existing template
508+
verify.templates.update(
509+
template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
510+
name: 'my-updated-template'
511+
)
512+
513+
# Delete a template
514+
verify.templates.delete(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9')
515+
```
516+
517+
#### Template Fragments
518+
519+
```ruby
520+
# Get a list of template fragments for a specific template
521+
template_fragment_list = verify.template_fragments.list(template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9')
522+
523+
# Get details of a specific template fragment
524+
template_fragment = verify.template_fragments.info(
525+
template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
526+
template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19'
527+
)
528+
529+
# Create a new template fragement
530+
verify.template_fragments.create(
531+
template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
532+
channel: 'sms',
533+
locale: 'en-gb',
534+
text: 'Your code is: ${code}'
535+
)
536+
537+
# Update an existing template fragment
538+
verify.template_fragments.update(
539+
template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
540+
template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc1',
541+
text: 'Your one-time code is: ${code}'
542+
)
543+
544+
# Delete a template fragment
545+
verify.template_fragments.delete(
546+
template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
547+
template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19'
548+
)
549+
```
550+
491551
## Voice API
492552

493553
The [Vonage Voice API](The [Vonage Verify API v2](https://developer.vonage.com/en/verify/verify-v2/overview) allows you to automate voice interactions by creating calls, streaming audio, playing text to speech, playing DTMF tones, and other actions. See the Vonage Developer Documentation for a [complete API reference](https://developer.vonage.com/en/api/voice) listing all the Voice API capabilities.

lib/vonage/verify2/template_fragments.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def create(template_id:, channel:, locale:, text:)
8585
# @example
8686
# client.verify2.template_fragments.update(
8787
# template_id: '8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9',
88-
# template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19,
88+
# template_fragment_id: 'c70f446e-997a-4313-a081-60a02a31dc19',
8989
# text: 'Your one-time code is: ${code}'
9090
# )
9191
#

0 commit comments

Comments
 (0)