Retrive a message

Get a messages from a specific id.

get
message/:_id

https://api.mercury.chat/sdk/v1/whatsapp/message/:_id?api_token=tokenAPI&instance=instance_number
Get a messages from a specific id (message._id).
Request
Response
Request
Path Parameters
_id
required
string
The id message (like message._id)
Query Parameters
instance
required
string
The instance number
api_token
required
string
The API token
Response
200: OK
In "data" there is the message object
{
"object": "message_whatsapp",
"data": {
"_id": "5cece1ef9ce23ae3e3cc001d",
"message_id": "false_4437367744@c.us_3AB22E9A006308D9A806",
"istance_number": "43279",
"body": "https://storage.googleapis.com/393245903518/2019%252F5%252F28%252F06a6a304-bade-47f8-ad35-a14a90006dfc.jpeg",
"body_translate": null,
"type": "image",
"senderName": "george",
"fromMe": false,
"author": "44575647748@c.us",
"time": 1559028200,
"chatId": "44575647748@c.us",
"messageNumber": 198,
"queueNumber": null,
"status_queued": null,
"status_queued_time": null,
"status_sent": null,
"status_sent_time": null,
"status_delivered": null,
"status_delivered_time": null,
"status_viewed": null,
"status_viewed_time": null
},
"has_more": false,
"count_api": 1,
"reset_count_api": 61
}
400: Bad Request
GENERIC ERROR

Example:

cURL
C#
Go
Java
NodeJs
Objective-C
PHP
Python
Ruby
Swift
cURL
curl -X GET \
'https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313?api_token=tokenAPI&instance=instance_number'
C#
var client = new RestClient("https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313?api_token=tokenAPI&instance=instance_number");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Go
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313?api_token=tokenAPI&instance=instance_number"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Java
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313?api_token=tokenAPI&instance=instance_number")
.get()
.build();
Response response = client.newCall(request).execute();
NodeJs
var request = require("request");
var options = { method: 'GET',
url: 'https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313',
qs: { api_token: 'tokenAPI', instance: 'instance_number' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
Objective-C
#import <Foundation/Foundation.h>
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313?api_token=tokenAPI&instance=instance_number"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
PHP
<?php
$request = new HttpRequest();
$request->setUrl('https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(array(
'api_token' => 'tokenAPI',
'instance' => 'instance_number'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
Python
import requests
url = "https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313"
querystring = {"api_token":"tokenAPI","instance":"instance_number"}
payload = ""
response = requests.request("GET", url, data=payload, params=querystring)
print(response.text)
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313?api_token=tokenAPI&instance=instance_number")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
Swift
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercury.chat/sdk/v1/whatsapp/message/5cecf1cd9ce23ae3e3cca313?api_token=tokenAPI&instance=instance_number")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()