Send templates
Send a saved template, such as a verification code, by name.
Send a saved template by its name, with the values it needs. {{secret.x}} values are delivered, but kept as
••••••. See Send templates.
Send a template
For a template auth_1 that reads Your code is {{secret.code}}. It expires in {{data.minutes}} minutes.:
message = goomzo.messages.send_one(
{'to': '+255712345678', 'template': 'auth_1', 'variables': {'code': '482913', 'minutes': '10'}},
idempotency_key=f'login-{attempt_id}',
)
message['private'] # True
message['content']['text'] # 'Your code is ••••••. It expires in 10 minutes.'Manage templates
goomzo.templates.create({
'name': 'auth_1',
'channel': 'sms',
'category': 'authentication',
'content': {'text': 'Your code is {{secret.code}}. It expires in {{data.minutes}} minutes.'},
})
templates = goomzo.templates.list(channel='sms')| Method | Does |
|---|---|
templates.list(channel, category) | Lists your templates. |
templates.get(id) | Gets one. |
templates.create(template) | Saves one. A WhatsApp one can be submitted to Meta. |
templates.update(id, changes) | Changes one. |
templates.delete(id) | Deletes one. |
whatsapp.templates.list() | Lists the templates on your WhatsApp account. |
Next steps
Last updated