Instantiation
config.cfg (see Authentication). The constructor dies if apiKey is missing.
Building a message
Messages are created with a single constructor call using named parameters:allowNonTLS as the string 'true' or 'false'. If you leave it out, the SDK sends the number 0, which the scheduling endpoint rejects with a 400 error, so scheduleMessage fails unless you set it.
Attachments
Each attachment is a hashref with three keys. UseMIME::Base64 to encode the file content:
String::Util::trim removes the trailing newline that encode_base64 appends.
Send a message
Check delivery status
deliveryStatus values: delivered, delivered via secure portal, soft bounced, hard bounced, processing. Opens are reported separately in openedStatus, which the SDK sets to "unopened" until the message is opened.
Scheduled send
Schedule a message for future delivery, check its status, reschedule, or cancel it.Schedule a message
scheduledAt must be an ISO 8601 UTC datetime string in the future and within 30 days.
Get scheduled message status
Reschedule a message
Cancel a scheduled message
Error handling
Methods die when a response cannot be interpreted. An API error response that contains anerrors key is returned as JSON, not thrown, so check for it as well as wrapping calls in eval: