DIY Surveys / API
  • Welcome to the DIY Surveys API
  • Getting Started
  • Messaging
    • Keyword
    • Languages
    • GSM Character Set
    • Macros
      • Macro Reference
    • Message Statuses
    • Message Windows
    • Metadata
    • Stop Lists
    • Usage
    • Message Type
  • Organizations
  • Recipient
  • Security
  • Survey
  • TinyUrl
  • Web Hooks and Callbacks
  • Custom Transformations
  • FAQ
  • Cloud Service
  • API Versions
    • DIY Surveys API 1.0
    • DIY Surveys API 2.0
    • DIY Surveys API 3.0
Powered by GitBook

Services

  • Surveys
  • Respondents
  • Results
  • Channels

© 2025 DIY Surveys Ltd.

On this page
  • Formatting Macros
  • Parameters

Was this helpful?

  1. Messaging

Macros

DIY Surveys support the principle ability to insert values into a message. This is achieved through its Macro Capability. Macros can be used during the recipient upload process and the Messaging process.

Formatting Macros

Macros take the basic format as follows:

'{' name [ '(' parameters ')' ] '}'

Name

Description

name

The name of the macro

parameters

an optional set of parameters depending on the type of macro

An example of a macro is the tiny, which takes the basic format:

{tiny(https://diysurveys.com)}

The above macro will convert the long URL provided into a short version and based on your account settings will use either the default tiny URL or a specific one associated with your account.

Parameters

Parameters have to be separated by commas. If a parameter includes a parameter then it needs to be surrounded by double quotes ("). For example:

{tiny(https://diysurveys.com, 1pt.mobi)}

The above macro will convert the long URL into a tiny URL using the domain name provided as the second parameter as the tiny URL.

In the above examples the parameters are literal entries in the message. It is also possible to refer to external references by using reference macros. For example it is possible to refer to values provided along with the method call when sending a message:

{tiny({long}?id={RequestID}, {short})}

In this example the {long} and {short} references must be included in the method to send a message. For example:

URL: base/Message/Send
Method: POST
{
  "Source": "DIY Surveys",
  "Destination": "12345678901",
  "Message": "Please click on the link {tinyurl({long}, {short})} to get your reward",
  "Reply": false,
  "When": "2020-02-04T11:47:33.645773+00:00",
  "Window": [{ From: "09:00", To: "16:00", Days: "1,2,3,4,5"}],
  "Callback": "https://yourco.com/api/messagetracker",
  "Lookup": true,
  "Test": false,
  "MetaData": 
    [
        { "long" : "https://diysurveys.com" },
        { "short" : "1pt.mobi" }
        { "RequestID": "1234567890DEFED" },
        { "OrgID": 1010 },
        { "Instance": "ETRERT"},
        { "Campaign": 1242 },
        { "TimeStamp": "2020-02-04T11:47:33.645773+00:00" }
    ]
}

If there is a conflict with the macro list supplied in the API call and the standard macros the macro list takes precedence.

PreviousGSM Character SetNextMacro Reference

Last updated 2 years ago

Was this helpful?

For a full list of macros please check .

here