NAV Navbar
cURL PHP Java Ruby Python

Rich Messaging API v2020-03-09T12:34:37Z

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

The Rich Messaging API is used for sending rich content messages to mobiles as part of the Rich Messaging service. API keys for including as the x-api-key header in requests can be obtained at https://melroselabs.com. The Rich Messaging API is part of the Rich Messaging service from Melrose Labs.

Base URLs:

Email: Melrose Labs - Technical Support

Authentication

Cards

Retrieve

Code samples

# You can also use wget
curl -X GET https://api.melroselabs.com/richmessaging/card \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.melroselabs.com/richmessaging/card', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/richmessaging/card");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.get 'https://api.melroselabs.com/richmessaging/card',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.get('https://api.melroselabs.com/richmessaging/card', params={

}, headers = headers)

print r.json()

GET /card

Get a card in the Melrose Labs Cards service.

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK 200 response Empty

Create

Code samples

# You can also use wget
curl -X POST https://api.melroselabs.com/richmessaging/card \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.melroselabs.com/richmessaging/card', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/richmessaging/card");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.post 'https://api.melroselabs.com/richmessaging/card',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.post('https://api.melroselabs.com/richmessaging/card', params={

}, headers = headers)

print r.json()

POST /card

Create a card in the Melrose Labs Cards service.

Body parameter

{
  "templateref": 0,
  "data": {},
  "userref": "string",
  "callback": "string",
  "expires": "string"
}

Parameters

Name In Type Required Description
body body CreateCard true none
» templateref body number true Identifier of the card template for this new card
» data body object false Data in JSON to populate the card template
» userref body string false Reference provided by the user (i.e. customer-provided message ID)
» callback body string false Callback URL or webhook to receive event notifications for this new card
» expires body string false Time at which the card will expire

Example responses

200 Response

{
  "messageID": "string",
  "shortURL": "string"
}

Responses

Status Meaning Description Schema
200 OK Card successfully created CreateCardResponse
404 Not Found Card failed to be created Error

Update

Code samples

# You can also use wget
curl -X PUT https://api.melroselabs.com/richmessaging/card \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','https://api.melroselabs.com/richmessaging/card', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/richmessaging/card");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.put 'https://api.melroselabs.com/richmessaging/card',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.put('https://api.melroselabs.com/richmessaging/card', params={

}, headers = headers)

print r.json()

PUT /card

Update a card in the Melrose Labs Cards service.

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK 200 response Empty

Delete

Code samples

# You can also use wget
curl -X DELETE https://api.melroselabs.com/richmessaging/card \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.melroselabs.com/richmessaging/card', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/richmessaging/card");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.delete 'https://api.melroselabs.com/richmessaging/card',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.delete('https://api.melroselabs.com/richmessaging/card', params={

}, headers = headers)

print r.json()

DELETE /card

Delete a card in the Melrose Labs Cards service.

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK 200 response Empty

Messages

Send message

Code samples

# You can also use wget
curl -X POST https://api.melroselabs.com/richmessaging/message \
  -H 'Accept: application/json' \
  -H 'x-api-key: API_KEY'

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'x-api-key' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.melroselabs.com/richmessaging/message', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.melroselabs.com/richmessaging/message");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'x-api-key' => 'API_KEY'
}

result = RestClient.post 'https://api.melroselabs.com/richmessaging/message',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'x-api-key': 'API_KEY'
}

r = requests.post('https://api.melroselabs.com/richmessaging/message', params={

}, headers = headers)

print r.json()

POST /message

Send a Rich Message to a mobile

Example responses

200 Response

{}

Responses

Status Meaning Description Schema
200 OK 200 response Empty

Schemas

Empty

{}

Empty Schema

Properties

None

CreateCardResponse

{
  "messageID": "string",
  "shortURL": "string"
}

CreateCardResponse Schema

Properties

Name Type Required Restrictions Description
messageID string true none Unique identifier of message
shortURL string true none URL for accessing message

Error

{
  "message": "string"
}

Error Schema

Properties

Name Type Required Restrictions Description
message string false none none

CreateCard

{
  "templateref": 0,
  "data": {},
  "userref": "string",
  "callback": "string",
  "expires": "string"
}

CreateCard Schema

Properties

Name Type Required Restrictions Description
templateref number true none Identifier of the card template for this new card
data object false none Data in JSON to populate the card template
userref string false none Reference provided by the user (i.e. customer-provided message ID)
callback string false none Callback URL or webhook to receive event notifications for this new card
expires string false none Time at which the card will expire