RESTful API

Campaign Descriptor

This descriptor -as a json file- contains all the details to describe each different type of campaign (Multiple Choice, Raffle, Keyword and External Interaction)

Json Structure

{
  "name": "Campaign Name",  
  "description": "Campaign Description",
  "useFallback": false,
  "wildcards": true,
  "active": 1,
  "delivery_method": "SMS",
  "listIds": "",
  "autowildcards": true,
  "keyphrasesBegin": false,
  "onetime": false,
  "autoMenu": true,
  "alertMimAggregator": "none",
  "mute": false,
  "isMenu": false,
  "typeMessage": "0",
  "oncorrect": "Campaign Correct",
  "onincorrect": "Campaign Incorrect",  
  "startup_keyword_activated": true,
  "HTTPMETHOD": "GET",
  "URL": "https://www.messangi.com/messangi_mmc/",
  "rafflePriceThreshold": 4,
  "cycle": 2,
  "raffleTypeId": 5,
  "oneCycle": -1,
  "alreadyWinner": 1,
  "KeywordInit": {
    "keyphrase": "KeywordInitValue1,KeywordInitValue2",
    "label": "KeywordInitValue"
  },
  "questions": [
    {
      "question": "Question 1",
      "prize": 10,
      "answers": [
        {
          "keyphrase": "rp1-1|rp1-2|rp1-3",
          "label": "label 1",
          "nexQuestionNumber": "0",
          "isCorrect": true,
          "campaign": "campaign demo 1",          
          "keyword": "keyword1"
        }
      ]
    }
  ],
  "answers": [
    {      
      "keyphrase": "keyphraseQ1A1|keyphraseQ1A2|keyphraseQ1A3",
      "label": "labelA 1",
      "response": "Response 1"
    }
  ],
  "prizes": [
    {
      "prizeQuantity": "3",
      "prizeName": "Prize 1",
      "dropCycle": "1",
      "responsePrize": "Prize 1"
    }
  ]
}

Basic JSON Parameters

Parameter Name Description Possible Values
name Campaign Name Text
description Campaign description text Text
useFallback Enables SMS Fallback if using a non SMS Delivery method Boolean
wildcards
OPTIONAL
Allows the uses of wildcards to activate the campaign Boolean
active Use 1 to activate the campaign, 0 to keep it deactivated Number
delivery_method Change the delivery channel. Use one of the following: SMS, PUSH Text
listIds
OPTIONAL
Use this parameter only if you want to whitelist users using custom distribution lists Text
autowildcards
OPTIONAL
Use true to automatically generate a wildcard expression Boolean
keyphrasesBegin
OPTIONAL
Force the presence of the desire keyword at the start of the message to initiate the campaign Boolean
onetime
OPTIONAL
If true user can only use the campaign one time Boolean
autoMenu
OPTIONAL
Automatically generates a menu using all keywords configured Boolean
mute
OPTIONAL
Mute the campaign output Boolean
isMenu If true the campaign will be a menu. Applies only for Multiple Choice Boolean
typeMessage Use 0 to create a Poll or 1 to create a Contest. Applies only for Multiple Choice Text
oncorrect On correct answer message Text
onincorrect On incorrect answer message Text
startup_keyword_activated if true the user can only start the campaign by using the configured keyword Boolean
HTTPMETHOD The http method to use when calling the configured URLs. Use GET or POST. Applies only when for External Web Service Text
URL The URL to call on every message received. Applies only when for External Web Service Text
rafflePriceThreshold Send a low prizes inventory notification when the inventory fall below this number Number
cycle Cycles by day Number
raffleTypeId Use “5” tu use cycles or “6” for the regular Raffle Number
oneCycle Use 1 to allow one cycle per day Number
alreadyWinner Use 1 to allow the user to win multiple times, use 0 to limit one user per price Number
questions Contains the questions pool for the Multiple Choice Text
questions.question Question text Text
questions.prize Points to win if the user answer correctly Numérico
questions.answers Contains the answers pool Text
questions.answers.keyphrase Keyword to match this answer. Use “,” to indicate multiple keywords Text
questions.answers.label Answer internal label Text
questions.answers.nexQuestionNumber Indicate which will be the next question after answer this one, use 0 to end Number
questions.answers.isCorrect Indicates if this answer is the correct one Boolean
questions.answers.campaign Indicates which campaign will be triggered if user select this answer, Applies only when typeMessage is 0 and isMenu is true, otherwise it will be ignored Text
questions.answers.keyword Which keyword will be interpreted if this answer is selected Text
answers Contains the answers pool Text
answers.keyphrase Keyword to match this answer. Use “,” to indicate multiple keywords Text
answers.label Answer internal label Text
answers.response Response to deliver if this answer is selected Text
prizes Contains the prizes pool. Applies only for Raffle Text
prizes.prizeQuantity How many prizes on inventory Number
prizes.prizeName Prize name Text
prizes.dropCycle How many prizes can be awarded by cycle Text
prizes.responsePrize Message to deliver when a user win this prize Text

JSon Example - Multiple Choice

{
  "startup_keyword_activated": true,
  "KeywordInit": {
    "keyphrase": "init1,init2,init3",
    "label": "demoInit"
  },
  "wildcards": true,
  "questions": [
    {
      "question": "Question 1",
      "answers": [
        {
          "keyphrase": "rp1-1|rp1-2|rp1-3",
          "nexQuestionNumber": "0",
          "keyword": "keyword1",
          "isCorrect": true
        },
        {
          "keyphrase": "rp2-1|rp2-2|rp2-3",
          "nexQuestionNumber": "0",
          "keyword": "keyword2",
          "isCorrect": "false"
        }
      ],
      "prize": 20
    }
  ],
  "active": 1,
  "description": "Description Multiple choice",
  "isMenu": false,
  "useFallback": false,
  "typeMessage": "0",
  "oncorrect": "Correct",
  "delivery_method": "SMS",
  "name": "Name Multiple choice",
  "onincorrect": "Incorrect"
}

JSon Example - Keywords

{
  "useFallback": false,
  "delivery_method": "SMS",
  "answers": [
    {
      "response": "Response Question 1",
      "keyphrase": "response1_1|response1_2|dresponse1_3",
      "label": "lebel1"
    },
    {
      "response": "Response Question 2",
      "keyphrase": "response2_1|response2_2|response2_3",
      "label": "lebel2"
    }
  ],
  "name": "Name Keywords",
  "active": 1,
  "description": "Description Keywords"
}

JSon Example - External Web Servicese

{
  "HTTPMETHOD": "GET",
  "useFallback": false,
  "delivery_method": "SMS",
  "answers": [
    {
      "response": "Response External",
      "keyphrase": "response1_1|response1_2|response1_3",
      "label": "label"
    }
  ],
  "name": "Name External Web Servicese",
  "active": 1,
  "description": "Description External Web Servicese",
  "URL": "https://www.google.co.ve/"
}

JSon Example - Raffle

{
  "oneCycle": -1,
  "useFallback": false,
  "rafflePriceThreshold": 4,
  "prizes": [
    {
      "prizeQuantity": "3",
      "prizeName": "Prize 1",
      "dropCycle": "1",
      "responsePrize": "Response Prize 1"
    },
    {
      "prizeQuantity": "6",
      "prizeName": "Prize 2",
      "dropCycle": "2",
      "responsePrize": "Response Prize 2"
    }
  ],
  "delivery_method": "SMS",
  "answers": [
    {
      "response": "Response Raffle",
      "keyphrase": "response1_1|response1_2|response1_3",
      "label": "label"
    }
  ],
  "name": "Name Raffle",
  "active": 1,
  "alreadyWinner": 1,
  "description": "Description Raffle",
  "cycle": 2,
  "raffleTypeId": 5
}