Appearance
Send Quoted Message
About 810 wordsAbout 3 min
Send Quoted Messages
Send a message that quotes or replies to a previous message. This is useful for maintaining conversational context.
To send a quoted message, include the quoted_message_id parameter with the ID of the message you want to reply to. The message ID (msgId) is returned in the success response of any message you send.
You can reply to any type of message (text, image, document, etc.) by providing quoted_message_id along with the content of your new message. If the original message is not found in the store, you can include the quoted_message parameter as a fallback text to display in the quoted bubble.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
number | string | Yes | Recipient phone number in any format (digits only extracted internally). |
message | string | Yes | Text content of the message. Required for text, buttons, interactive, and optional for others. |
message_type | string | Yes | Type of message to send. One of: text, image, video, audio, document, location, buttons, interactive. |
media_url | string | No | URL of media file (image/video/audio/document) to send, depending on message_type. |
file_name | string | No | File name for documents (e.g. document.pdf). |
mimetype | string | No | MIME type of media, e.g., image/jpeg, video/mp4, audio/mp4, application/pdf. |
latitude | number | No | Latitude coordinate for location messages. |
longitude | number | No | Longitude coordinate for location messages. |
buttons | array | No | Array of button objects for interactive messages. Each button should have buttonId and displayText. |
quoted_message_id | string | Yes | ID of the message to quote (reply to). |
quoted_message | string | Yes | Fallback text content for the quoted message if the original message is not found in the store. |
API Endpoint
POST https://app.rapiwa.com/api/send-messageHeader
Content-Type: application/json
Authorization: Bearer Your_Device_KeyBody
{
"number": "88017XXXXXXXX",
"message_type": "text",
"message": "This is my reply!",
"quoted_message_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"quoted_message": "Original message text here"
}###Response:
{
"success": true,
"message_type": "text",
"message_id": "XXXXXXXXXXXXXXXXXXXXX",
"to": "88017XXXXXXXX"
}Code examples
bash
curl -X POST "https://app.rapiwa.com/api/send-message" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Your_Device_Key" \
-d '{"number":"88017XXXXXXXX","message_type":"text","message":"This is my reply!","quoted_message_id":"XXXXXXXXXXXXXXXXXXXXXXXXXXXX","quoted_message":"Original message text here"}'python
import requests
url = "https://app.rapiwa.com/api/send-message"
headers = {"Content-Type": "application/json", "Authorization": "Bearer Your_Device_Key"}
payload = {"number": "88017XXXXXXXX", "message_type": "text", "message": "This is my reply!", "quoted_message_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "quoted_message": "Original message text here"}
requests.post(url, json=payload, headers=headers)javascript
await fetch('https://app.rapiwa.com/api/send-message', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer Your_Device_Key' },
body: JSON.stringify({ number: '88017XXXXXXXX', message_type: 'text', message: 'This is my reply!', quoted_message_id: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX', quoted_message: 'Original message text here' })
});php
<?php
$data = ['number' => '88017XXXXXXXX', 'message_type' => 'text', 'message' => 'This is my reply!', 'quoted_message_id' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'quoted_message' => 'Original message text here'];
$options = ['http' => ['header' => "Content-Type: application/json\r\nAuthorization: Bearer Your_Device_Key\r\n", 'method' => 'POST', 'content' => json_encode($data)]];
file_get_contents('https://app.rapiwa.com/api/send-message', false, stream_context_create($options));ruby
require 'net/http'
require 'json'
uri = URI('https://app.rapiwa.com/api/send-message')
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer Your_Device_Key'
request.body = { number: '88017XXXXXXXX', message_type: 'text', message: 'This is my reply!', quoted_message_id: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX', quoted_message: 'Original message text here' }.to_json
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |h| h.request(request) }go
payload := map[string]interface{}{"number": "88017XXXXXXXX", "message_type": "text", "message": "This is my reply!", "quoted_message_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "quoted_message": "Original message text here"}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://app.rapiwa.com/api/send-message", bytes.NewBuffer(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer Your_Device_Key")
http.DefaultClient.Do(req)csharp
var payload = new { number = "88017XXXXXXXX", message_type = "text", message = "This is my reply!", quoted_message_id = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", quoted_message = "Original message text here" };
var content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Authorization", "Bearer Your_Device_Key");
await client.PostAsync("https://app.rapiwa.com/api/send-message", content);java
HttpRequest.newBuilder()
.uri(URI.create("https://app.rapiwa.com/api/send-message"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer Your_Device_Key")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"number\":\"88017XXXXXXXX\",\"message_type\":\"text\",\"message\":\"This is my reply!\",\"quoted_message_id\":\"XXXXXXXXXXXXXXXXXXXXXXXXXXXX\",\"quoted_message\":\"Original message text here\"}"))
.build();swift
var request = URLRequest(url: URL(string: "https://app.rapiwa.com/api/send-message")!)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("Bearer Your_Device_Key", forHTTPHeaderField: "Authorization")
request.httpBody = try? JSONEncoder().encode(["number": "88017XXXXXXXX", "message_type": "text", "message": "This is my reply!", "quoted_message_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "quoted_message": "Original message text here"])
URLSession.shared.dataTask(with: request).resume()powershell
$body = @{ number = "88017XXXXXXXX"; message_type = "text"; message = "This is my reply!"; quoted_message_id = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"; quoted_message = "Original message text here" } | ConvertTo-Json
Invoke-RestMethod -Uri "https://app.rapiwa.com/api/send-message" -Method Post -Headers @{"Content-Type"="application/json"; "Authorization"="Bearer Your_Device_Key"} -Body $bodytypescript
await fetch('https://app.rapiwa.com/api/send-message', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer Your_Device_Key' },
body: JSON.stringify({ number: '88017XXXXXXXX', message_type: 'text', message: 'This is my reply!', quoted_message_id: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX', quoted_message: 'Original message text here' })
});rust
let payload = json!({"number": "88017XXXXXXXX", "message_type": "text", "message": "This is my reply!", "quoted_message_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX", "quoted_message": "Original message text here"});
client.post("https://app.rapiwa.com/api/send-message").header("Authorization", "Bearer Your_Device_Key").json(&payload).send().await?;💡 Tip: Keep your Device Key secure. Never share it publicly.
