Get message
Fetch the status of a message you've previously sent.
URL: https://api.courier.com/messages/:message_id
Method: GET
Path Parameters
message_idstringrequired
A unique identifier associated with the message you wish to retrieve (results from a send).
Responses
status: 200 OK
idstring
A unique identifier associated with the message you wish to retrieve (results from a send).
statusstring
*[CLICKED | DELIVERED | OPENED | CANCELED | SENT | UNDELIVERABLE | ENQUEUED | UNMAPPED | UNROUTABLE]* Message Status:
CLICKED
- The recipient has clicked on any link in the message at least one time.
DELIVERED
- The provider successfully delivered the message to the recipient.
ENQUEUED
- The request has been received to send a message, is waiting in the work queue.
OPENED
- The recipient has opened the message at least one time.
CANCELED
- The message has been canceled such that it will not be delivered.
SENT
- The message has been accepted by the provider.
UNDELIVERABLE
- The message could not be delivered to at least one provider, or the provider could not deliver the message to the recipient. This can happen for multiple reasons: an error, insufficient profile data, invalid notification setup, invalid integration configuration, etc.
UNMAPPED
- Could not find a corresponding notification or event for the messages.
UNROUTABLE
- The message could not be routed to any channel or provider. This can happen for multiple reasons: insufficient profile data, invalid notification setup, invalid integration configuration, etc.
enqueuednumber
A UTC timestamp at which Courier received the message request. This is stored as a millisecond representation of the Unix epoch (the time passed since January 1, 1970).
sentnumber
A UTC timestamp at which Courier passed the message to the Integration provider. This is stored as a millisecond representation of the Unix epoch (the time passed since January 1, 1970).
deliverednumber
A UTC timestamp at which the Integration provider delivered the message. This is stored as a millisecond representation of the Unix epoch (the time passed since January 1, 1970).
openednumber
A UTC timestamp at which the recipient opened a message for the first time. This is stored as a millisecond representation of the Unix epoch (the time passed since January 1, 1970).
clickednumber
A UTC timestamp at which the recipient clicked on a tracked link for the first time. This is stored as a millisecond representation of the Unix epoch (the time passed since January 1, 1970).
recipientstring
A unique identifier associated with the recipient of the delivered message.
eventstring
A unique identifier associated with the event of the delivered message.
notificationstring
A unique identifier associated with the notification of the delivered message.
errorstring
A message describing the error that occurred.
reasonstring
*[FILTERED | NO_CHANNELS | NO_PROVIDERS | OPT_IN_REQUIRED | PROVIDER_ERROR | UNPUBLISHED | UNSUBSCRIBED]* Reason:
FILTERED
- The recipient did not receive the notification because of a condition that passed.
NO_CHANNELS
- The notification did contain any valid channels.
NO_PROVIDERS
- The notification did not contain a configured provider for a channel.
PROVIDER_ERROR
- The Integration provider had an error when sending a notification.UNPUBLISHED
- The notification hasn't been published yet.
UNSUBSCRIBED
- The recipient did not receive the notification because they chose to unsubscribe from it.
providersarray
+ Show Properties
status: 400 Bad Request
messagestring
A message describing the error that occurred.
typestring
[invalid_request_error] The type of error that occurred.
status: 404 Message Not Found
messagestring
A message describing the error that occurred.
typestring
[invalid_request_error] The type of error that occurred.
Request Example
- cURL
- Node.js
- Ruby
- Python
- Go
- PHP
curl --request GET \
--url https://api.courier.com/messages/1-5e2b2615-05efbb3acab9172f88dd3f6f \
--header 'Accept: application/json'
// Dependencies to install:
// $ npm install node-fetch --save
const fetch = require('node-fetch');
const options = {
method: 'GET',
headers: {
Accept: 'application/json'
},
};
fetch('https://api.courier.com/messages/1-5e2b2615-05efbb3acab9172f88dd3f6f', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.courier.com/messages/1-5e2b2615-05efbb3acab9172f88dd3f6f")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = 'application/json'
response = http.request(request)
puts response.read_body
# Dependencies to install:
# $ python -m pip install requests
import requests
url = "https://api.courier.com/messages/1-5e2b2615-05efbb3acab9172f88dd3f6f"
headers = {
"Accept": "application/json"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.courier.com/messages/1-5e2b2615-05efbb3acab9172f88dd3f6f"
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
// Dependencies to install:
// $ composer require guzzlehttp/guzzle
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.courier.com/messages/1-5e2b2615-05efbb3acab9172f88dd3f6f', [
'headers' => [
'Accept' => 'application/json',
],
]);
echo $response->getBody();
Responses Example
{
"id": "1-5e2b2615-05efbb3acab9172f88dd3f6f",
"status": "DELIVERED",
"enqueued": 1562611073426,
"sent": 1562611074138,
"delivered": 1562611077139,
"opened": 1562611083411,
"clicked": 1562611084123,
"recipient": "CC607F6E84A34305AE98B72C",
"event": "my-event",
"notification": "TAFGNB3GNQ4MZVHW4WV4R8Q8ZVN4",
"error": "400 Bad Request",
"reason": "UNSUBSCRIBED",
"providers": [
{
"channel": {},
"sent": 1562611074138,
"delivered": 1562611077139,
"clicked": 1562611084123,
"opened": 1562611083411,
"error": "400 Bad Request",
"provider": "twilio",
"status": "SENT"
}
]
}
{
"message": "Error Message",
"type": "invalid_request_error"
}
{
"message": "Not Found",
"type": "invalid_request_error"
}
Example
Method: GET
URL: https://api.courier.com/messages/1-5e2b2615-05efbb3acab9172f88dd3f6f