Rich Messaging API v2020-06-09T21:28:39Z
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
- API Key (api_key)
- Parameter Name: x-api-key, in: header.
Default
options__card
Code samples
# You can also use wget
curl -X OPTIONS https://api.melroselabs.com/richmessaging/card \
-H 'Accept: application/json'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('https://api.melroselabs.com/richmessaging/card',
{
method: 'OPTIONS',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json'
}
r = requests.options('https://api.melroselabs.com/richmessaging/card', params={
}, headers = headers)
print r.json()
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('OPTIONS','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("OPTIONS");
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'
}
result = RestClient.options 'https://api.melroselabs.com/richmessaging/card',
params: {
}, headers: headers
p JSON.parse(result)
OPTIONS /card
Example responses
200 Response
{}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | 200 response | Empty |
Response Headers
Status | Header | Type | Format | Description |
---|---|---|---|---|
200 | Access-Control-Allow-Origin | string | none | |
200 | Access-Control-Allow-Methods | string | none | |
200 | Access-Control-Allow-Headers | string | none |
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/richmessaging/card',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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 |
Response Headers
Status | Header | Type | Format | Description |
---|---|---|---|---|
200 | Access-Control-Allow-Origin | string | none |
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'
const fetch = require('node-fetch');
const inputBody = '{
"templateref": 0,
"data": {},
"userref": "string",
"callback": "string",
"expires": "string"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/richmessaging/card',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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 |
Response Headers
Status | Header | Type | Format | Description |
---|---|---|---|---|
200 | Access-Control-Allow-Origin | string | none |
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/richmessaging/card',
{
method: 'PUT',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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 |
Response Headers
Status | Header | Type | Format | Description |
---|---|---|---|---|
200 | Access-Control-Allow-Origin | string | none |
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/richmessaging/card',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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 |
Response Headers
Status | Header | Type | Format | Description |
---|---|---|---|---|
200 | Access-Control-Allow-Origin | string | none |
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'
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'API_KEY'
};
fetch('https://api.melroselabs.com/richmessaging/message',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
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()
<?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)
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 |