Our documentation is changing, please click here to enjoy it!

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This API route allows you to create a message on Accengage.

Operations

POST

/createMessage.php

ParameterModel
body
Code Block
titleData
languagejs
{
  createMessage: {
    user: User
    partner: Partner,
	campaignId: String, optional
    externalId: String, optional
    message: Message, mandatory if messages is not defined
    messages: MessageGroup, mandatory if message is not defined
  }
}

 


 

 

Code Block
titleMessages
languagejs
{
  ${languageId1}: Message
  ${languageId2}: Message
  ...
}

 


 

 

Code Block
titleMessage
languagejs
{
  subject: String
  text: String, optional
  customizedTitle: String, optional (1)
  longText: String, optional (1)
  bigPicture: String, optional (1)(3)
  icon: String, optional (1)(3)
  sound: String in ["None", "default", "custom"]
  soundName: String, mandatory if "sound" value is "custom"
  Badge: String, optional (2), prepend "+" for a badge increment
  actionButtonLabel: String, optional
  richPushUrl: String, optional
  richPushOpening: String in ["webview", "browser"], optional
  Popup: Boolean or Popup, optional (1)
  collapseKey: String, optional
  customParams: [CustomParam], optional
  interactiveButtons: InteractiveButtons, optional
  contentAvailable: boolean, default false, only for iOS
}

 


 

 

Code Block
titlePopup
languagejs
{
  okButtonLabel: String, optional
  cancelButtonLabel: String, optional
}

 


 

 

Code Block
titleCustomParam
languagejs
{
  key: String
  value: String
}

 


 

 

Code Block
titleInteractiveButtons
languagejs
{
  template: String, mandatory for iOS, optional for Android
  buttons: [Button], optional
} 

 

The value of the template can be found in the category on the interface or here for the Accengage's templates.

 

 

 

Code Block
titleButtons
languagejs
{
  id: String, index of the button in the template
  action: String, optional
  url: String, optional
  title: String, optional, only for Android
  icon: String, optional, only for Android
  destructive: Boolean, optional, only for Android, default true
  customParams: [CustomParam], optional
} 
  

(1) Only available for Android push messages

(2) Only available for iOS push messages

(3) The name of the image must be provided by the uploadImage API

Response
body
Code Block
languagejs
{
  returnCode: String
  returnLabel: String
  messageId: String
}
Return code
returnCodeDescription

0

Message has been created

1A database error occured
2No createMessage
3No or bad user
4No or bad partner
5No or bad message
6Bad custom params
9No or bad appId
13Cannot have message & messages
14Bad message language code
15External ID already exists
16CampaignId and partner mismatch
23No or bad template for buttons
24No or bad button id
25Bad custom params for buttons

Examples

RequestBodyDescription

POST /createMessage.php

 

Code Block
languagejs
{  
   "createMessage":{  
      "user":{  
         "login":"abc@abc.com",
         "password":"abc"
      },
      "partner":{  
         "id":"test510774"
      },
      "campaignId": "123",
      "message":{  
         "subject":"Api Test",
         "text":"Api test message",
         "sound":"custom",
         "soundName":"test.wav",
         "badge":"1",
         "actionButtonLabel":"Ok",
         "richPushUrl":"http://…",
         "richPushOpening":"webview",
         "customParams":[  
            {  
               "key":"testKey",
               "value":"testValue"
            },
            {  
               "key":"testKey2",
               "value":"testValue2"
            }
         ]
      }
   }
}
Create a message "Api test message" with a custom sound "test.wav" and badge "1", with a richpush in a webview and custom params, for campaign 123
POST /createMessage.php
Code Block
languagejs
{  
   "createMessage":{  
      "user":{  
         "login":"abc@abc.com",
         "password":"abc"
      },
      "partner":{  
         "id":"test510774"
      },
      "externalId":"externalName",
      "messages":{  
         "fr":{  
            "subject":"Api Test FR",
            "text":"Api test message FR",
            "sound":"custom",
            "soundName":"test.wav",
            "badge":"1",
            "actionButtonLabel":"Ok",
            "richPushUrl":"http://…",
            "richPushOpening":"webview",
            "customParams":[  
               {  
                  "key":"testKey",
                  "value":"testValue"
               },
               {  
                  "key":"testKey2",
                  "value":"testValue2"
               }
            ]
         }
      },
      "en":{  
         "subject":"Api Test EN",
         "text":"Api test message EN",
         "sound":"custom",
         "soundName":"test.wav",
         "badge":"1",
         "actionButtonLabel":"Ok",
         "richPushUrl":"http://…",
         "richPushOpening":"webview",
         "customParams":[  
            {  
               "key":"testKey",
               "value":"testValue"
            },
            {  
               "key":"testKey2",
               "value":"testValue2"
            }
         ]
      }
   }
}
Create several messages for different language IDs with the same externalId "externalName"
POST /createMessage.php
Code Block
languagejs
{
   "createMessage": {
      "user": {
         "login": "abc@abc.com",
         "password": "abc"
      },
      "partner": {
         "id": "test510774"
      },
      "campaignId": "123",
      "message": {
         "subject": "Api Test",
         "text": "Api test message",
         "sound": "custom",
         "soundName": "test.wav",
         "badge": "1",
         "actionButtonLabel": "Ok",
         "richPushUrl": "http://…",
         "richPushOpening": "webview",
         "interactiveButtons": {
            "template": "category_name",
            "buttons": [{
               "id": 1,
               "title": "Confirm",
               "url": "http://google.fr",
               "icon": "ic_action_search",
	       "action": "browser",
               "destructive": false,
               "customParams": [{
                  "key": "testKey",
                  "value": "testValue"
               }, {
		  "key": "testKey2",
		  "value": "testValue2"
               }]
            }, {
               "id": 2,
               "url": "http://mobilecrm.accengage.com",
               "icon": "action_settings_light",
               "action": "webView"
            }]
         }
      }
   }
}
Create one message with interactive buttons

Comment (Hide)

If needed, final notes and advice, e.g.: "This API call may be heavy, you should try to group calls as much as possible" or "if you get an X error, it may lead to Y".