Whispir Forums

New Features

RSS Feed

Simplify your API Messages with Message Attributes

  1. Dear Whispir Customer,

    As part of Whispir's continuous improvement programme, Whispir will be introducing enhancements to simplify the creation of messages from the Whispir API.

    Any customers who have Message Attributes configured will now have the ability to simplify their messages by using these Message Attributes within their API Calls.

    In the upcoming release of Whispir's API customers who have Message Attributes configured within the Whispir Platform will have the ability to simplify their API message requests by using the Message Attributes directly from the API.

    Using Message Attributes will allow developers using the API to focus on the data behind a message, rather than focusing on the presentation or messaging channels within the message.

    This separation ensures that the marketing or communications teams within an organisation can focus on what they are best at, and the developers can ensure the system integrations are working as effectively as possible.

    For example;

    A message could contain some content, and a potential variable such as the expiry of the invitation

    Reminder: your invitation to the Acme Event will expire on 13/06/2014.
    

    The API call to populate this without Message Attributes could look as follows:

    POST /messages?apikey=...
    Content-Type: application/vnd.whispir.message-v1+json
    {
        "to" : "john@api-example.com",
        "subject" : "Reminder:",
        "body" : "Your invitation to the Acme Event will expire on 13/06/2014.",
        "email" : {
            "type" : "text/plain",
            "body" : "Your invitation to the Acme Event will expire on 13/06/2014."
        }
    }
    

    This is combining both the channels being selected for the message, and the data driving the message. Using Message Attributes and Message Templates allows developers to cleanly separate these responsibilities.

    For example; the same message could be saved into a Whispir Message Template.

    POST /templates?apikey=...
    Content-Type: application/vnd.whispir.template-v1+json
    {
        "messageTemplateName" : "Event Reminder",
        "subject" : "Reminder:",
        "body" : "Your invitation to the Acme Event will expire on @@event_expiry@@.",
        "email" : {
            "type" : "text/plain",
            "body" : "Your invitation to the Acme Event will expire on @@event_expiry@@."
        }
    }
    

    This would provide a response of:

    HTTP 201 Created
    {
        "id": "DACADB02209CC93C",
        "messageTemplateName": "Event Reminder",
        "link": [ {
            "uri": "...",
            "rel": "self",
            "method": "GET"
        }
        ...
    }
    

    Using this Message Template ID and now using the Message Attribute @@event_expiry@@, the updated is far simpler to implement and is more efficient.

    POST /messages?apikey=...
    Content-Type: application/vnd.whispir.message-v1+json
    {
        "to" : "john@api-example.com",
        "messageTemplateId" : "DACADB02209CC93C",
        "messageattributes" : [ {
            "name" : "event_expiry",
            "value" : "13/06/2014"
        } ]
    }
    

    For more information about using Message Attributes within your application or Whispir Platform, please contact your Whispir Representative or sales@whispir.com.

    Jordan Walsh

    API Product Manager

    Message edited by Jordan Walsh 4 years ago

[ Page 1 of 1 ]