Templates
Templates are the make up of the content that will be delivered to the end recipients handset. This is where custom fields, links, keywords and senders all come together.
The body
of a template is where the content both static and customisable will be set.
There are several shorthand versions that can be included in a template for personalisation.
-
:: ::
- Double colons is what Passona recognises as a shorthand link which will later be resolved to a vanity domain to redirect the receipent to a destination url of your choosing. Example -::NEW_LINK::
would look something likehttps://psms.io/openRe7A
in the message. -
{{ }}
- Double curly braces is what Passona recognises as a custom field. These placeholders correspond to what has been set against the contacts uploaded. Example -Hello {{title}} {{surname}}
would look something likeHello Mr Doe
in the message.
If any of these shorthands cannot find a respective match, the message will have a blank space in its place when received be the end recipients handset
Create Template
Create a new template.
The body is where your static and customisable content will be set. Shorthand placeholders can be set here and they will be personalised for each recipient in the campaign. See above for an explanation of shorthands
Senders must be between 3-11 characters, otherwise the template will be rejected.
It also takes a boolean
field called force_utf8
. This will stripe all non UTF-8 characters from the body.
Request
curl --location 'https://passona.co.uk/api/2.0/templates/' \
--header 'Authorization: Bearer B1gooyw1FlLcITdn2nd4vfem4b4YYogJUGjVTnrrSTOt2T5hCFnS2xpANsYd' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"name": "Template Example",
"body": "Test content with a ::link::",
"sender": "Digitonic"
}'
Response
{
"data": {
"uuid": "49deafce-fbbd-11e9-93b1-0242ac120009",
"name": "Template Example",
"body": "Test content with a ::link::",
"links": [],
"is_locked": false,
"sender": "Digitonic",
"created_at": "2019-10-31 09:03:21",
"updated_at": "2019-10-31 09:03:21"
}
}
Edit Template
Edit an existing template.
It also takes a boolean
field called force_utf8
. This will stripe all non UTF-8 characters from the body
Request
curl --location --request PUT 'https://passona.co.uk/api/2.0/templates/49deafce-fbbd-11e9-93b1-0242ac120009' \
--header 'Authorization: Bearer B1gooyw1FlLcITdn2nd4vfem4b4YYogJUGjVTnrrSTOt2T5hCFnS2xpANsYd' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"name": "Template Example",
"body": "Test content with a ::link:: and update content",
"sender": "Digitonic"
}'
Response
{
"data": {
"uuid": "49deafce-fbbd-11e9-93b1-0242ac120009",
"name": "Template Example",
"body": "Test content with a ::link:: and update content",
"links": [],
"is_locked": false,
"sender": "Digitonic",
"created_at": "2019-10-31 09:03:21",
"updated_at": "2019-10-31 09:04:46"
}
}
Show Template
You can retrieve an individual template by passing the uuid
into the url.
Request
curl --location 'https://passona.co.uk/api/2.0/templates/49deafce-fbbd-11e9-93b1-0242ac120009' \
--header 'Authorization: Bearer B1gooyw1FlLcITdn2nd4vfem4b4YYogJUGjVTnrrSTOt2T5hCFnS2xpANsYd' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
Response
{
"data": {
"uuid": "49deafce-fbbd-11e9-93b1-0242ac120009",
"name": "Template Example",
"body": "Test content with a ::link:: and update content",
"links": [],
"is_locked": false,
"sender": "Digitonic",
"created_at": "2019-10-31 09:03:21",
"updated_at": "2019-10-31 09:04:46"
}
}
Retrieve All Templates
Returns a paginated list of templates for your current team.
Default pagination length is 15 per page.
This can be changed if needed by adding a query parameter of /?per_page=
and the number you wish to paginate by.
Request
curl --location 'https://passona.co.uk/api/2.0/templates/' \
--header 'Authorization: Bearer B1gooyw1FlLcITdn2nd4vfem4b4YYogJUGjVTnrrSTOt2T5hCFnS2xpANsYd' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
Response
{
"data": [
{
"uuid": "49deafce-fbbd-11e9-93b1-0242ac120009",
"name": "Template Example",
"body": "Test content with a ::link:: and update content",
"links": [],
"is_locked": false,
"sender": "Digitonic",
"created_at": "2019-10-31 09:03:21",
"updated_at": "2019-10-31 09:04:46"
}
],
"links": {
"first": "http://passona.test/api/2.0/templates?page=1",
"last": "http://passona.test/api/2.0/templates?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "http://passona.test/api/2.0/templates",
"per_page": 15,
"to": 1,
"total": 1
}
}
Preview Template
You can preview what a template will look like with the shorthand placeholders replaced.
When this endpoint is called it will use the first contact of your campaigns information to replace any link and custom field placeholders for the preview.
This gives you an opportunity to see the end result before it sends to the end recipients and make any changes if appropriate.
Request
curl --location 'https://passona.co.uk/api/2.0/templates/49deafce-fbbd-11e9-93b1-0242ac120009/preview' \
--header 'Authorization: Bearer B1gooyw1FlLcITdn2nd4vfem4b4YYogJUGjVTnrrSTOt2T5hCFnS2xpANsYd' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
Response
{
"data": {
"uuid": "49deafce-fbbd-11e9-93b1-0242ac120009",
"name": "Template Example",
"body": "Test content with a https://google.co.uk and update content",
"links": [
{
"id": 1,
"uuid": "30472018-fb1e-11e9-bff4-0242ac120008",
"vanity_domain_id": 1,
"template_id": 2,
"vanity_domain_uuid": "fa399fc6-f4df-11e9-8b4a-0242ac120006",
"template_uuid": "3021906e-fb1e-11e9-bbd9-0242ac120008",
"name": "link",
"destination": "https://google.co.uk",
"created_at": "2019-10-30 14:04:28",
"updated_at": "2019-10-30 14:04:28"
}
],
"is_locked": false,
"sender": "Digitonic",
"created_at": "2019-10-31 09:03:21",
"updated_at": "2019-10-31 09:04:46"
}
}
Delete Template
Delete a specific template by passing its uuid
into the url.
There is no response body for this request. The HTTP status will be 204 - No Content
when successful.
Request
curl --location --request DELETE 'https://passona.co.uk/api/2.0/templates/49deafce-fbbd-11e9-93b1-0242ac120009' \
--header 'Authorization: Bearer B1gooyw1FlLcITdn2nd4vfem4b4YYogJUGjVTnrrSTOt2T5hCFnS2xpANsYd' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
Template Encoding
This endpoint will return a string with the econding of the provided body.
Request
curl --location 'https://passona.co.uk/api/2.0/templates/encoding' \
--header 'Authorization: Bearer B1gooyw1FlLcITdn2nd4vfem4b4YYogJUGjVTnrrSTOt2T5hCFnS2xpANsYd' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"body": "Sample template body text."
}'
Response
{
"data": {
"encoding": "GSM_7BIT"
}
}