Whispir Forums

New Features

RSS Feed

Message Template Resource Enhancements

  1. Message Template Resource Enhancements

    In our next release, we're endeavouring to simplify the way you reference templates within your Whispir messages.

    Message Templates can be used within Whispir API requests. Using Message Templates simplifies the process in two different ways;

    1. It simplifies the API payload, allowing the developer to supply a simple ID instead of including message content
    2. It ensures a clear delineation between development and template design; having message content in the code is a poor design practice as code changes will be required to change template design

    Message Templates are currently referenced within the Message Request through the use of unique IDs e.g.

    REQUEST
    HTTP 1.1 https://api.whispir.com/messages?apikey=4v089dffa0af90ddfj90f
    Content-Type: application/vnd.whispir.message-v1+json
    Authorization: Basic 4bv0v0dn3nf0d90f90f90d==
    
    {
        "to" : "john@test.com",
        "messageTemplateId" : "48CB36DCDA3764DCB"
    }
    

    Message Template IDs

    The Message Templates are represented by hash digest consisting of a 20 digit hexadecimal string. When a template has been re-created, these hash digests are updated, and subsequently so are the IDs.

    This may have implications, as the update and promotion of templates between environments, may update the Template IDs between workspaces. This will require the requesting server to validate that the Template ID exists prior to each message request - which becomes an in-efficient chain of API requests.

    Whispir is proposing to enhance this process by supporting the use of a Template Name in a message payload in place of the Template ID.

    This enhancement aims to address the following issues;

    1. API developers expect to develop consistent and portable code, with minimal impact from BAU activities

    2. HTML developers expect to promote, describe a template for a particular use case

    Message Template Names

    The enhancement involves allowing the use of Template Names within Message API requests.

    Rather than reference the Message Templates by their hash IDs, Templates may be referenced by their name. As template names are unique within each workspace, this provides an elegant solution for both API and Template developers.

    Request Structure

    The existing request utilising messageTemplateId will consist of the following structure in JSON:

    POST https://api.whispir.com/messages?apikey=yxexcxexfx3
    Authorization: Basic 83hxhx3x8xfxuxfxxioxfhxr9f090
    Content-Type: application/vnd.whispir.message-v1+json
    {
        "to" : "john@test.com",
        "messageTemplateId" : "48CB36DCDA3764DCB"
    }
    

    The proposed request utilising messageTemplateName will consist of the following structure in JSON:

    POST https://api.whispir.com/messages?apikey=yxexcxexfx3
    Authorization: Basic 83hxhx3x8xfxuxfxxioxfhxr9f090
    Content-Type: application/vnd.whispir.message-v1+json
    
    {
        "to" : "john@test.com",
        "messageTemplateName" : "My Great Template"
    }
    

    If you've got any questions, please feel free to leave a comment, or contact us at apisupport@whispir.com.

    Whispir Team

    Message edited by Jordan Walsh 3 years ago

[ Page 1 of 1 ]