API Example

post
Send a transactional message

https://txnhog.co/txn/api/your_message_key
API POST Example for sending a transactional message. This is a simple example of sending a name, email, and phone number to the transactional template. The API accepts only string values, as application/json or application/x-www-form-urlencoded. When using an email template, the parameter "email" is required, and when using an sms template, the parameter "phone" is required.
Request
Response
Request
Form Data Parameters
apiKey
required
string
Your API key, listed below each of your transactional messages. This key is private, and should only be used server-side.
name
optional
string
Name of the person receiving the transactional message. Exposed in your template with the {{name}} tag
email
optional
string
Exposed in your template with the {{email}} tag. Required if sending an email.
phone
optional
string
Exposed in your template with the {{phone}} tag. Required if sending an sms.
Response
200: OK
Cake successfully retrieved.
{ "name": "Cake's name", "recipe": "Cake's recipe name", "cake": "Binary cake"}
404: Not Found
Could not find a cake matching this query.
{ "message": "Ain't no cake like that."}

You can POST any key/value pair of up to 1400 characters each. This allows for variables to insert password reset links, image urls, just about anything. Note that HTML will be sanitized and encoded.