Appearance
Send Contact Message
About 549 wordsAbout 2 min
Send Contact Messages
This endpoint enables you to deliver contact cards to a WhatsApp user by specifying their phone number. It supports sending a structured contact message containing the recipient’s name and phone number.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
number | string | Yes | The recipient’s phone number. Any format is accepted (digits are extracted internally). |
message_type | string | Yes | Type of message being sent. For this endpoint, use contact. |
contact_name | string | Yes | Full name of the contact to be shared. |
contact_number | string | Yes | Phone number of the contact to be shared. |
API Endpoint
POST https://app.rapiwa.com/api/send-messageHeader
Content-Type: application/json
Authorization: Bearer Your_Device_KeyBody
{
"number": "88017XXXXXXXXX",
"message_type": "contact",
"contact_name": "Golam Rabbi",
"contact_number": "88017XXXXXXXXXX"
}###Response:
{
"success": true,
"message_type": "contact",
"message_id": "3EB0FAC204D805F0E22293",
"to": "XXXXXXXXXXXXX"
}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":"88017XXXXXXXXX","message_type":"contact","contact_name":"Golam Rabbi","contact_number":"88017XXXXXXXXXX"}'python
import requests
url = "https://app.rapiwa.com/api/send-message"
headers = {"Content-Type": "application/json", "Authorization": "Bearer Your_Device_Key"}
payload = {"number": "88017XXXXXXXXX", "message_type": "contact", "contact_name": "Golam Rabbi", "contact_number": "88017XXXXXXXXXX"}
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: '88017XXXXXXXXX', message_type: 'contact', contact_name: 'Golam Rabbi', contact_number: '88017XXXXXXXXXX' })
});php
<?php
$data = ['number' => '88017XXXXXXXXX', 'message_type' => 'contact', 'contact_name' => 'Golam Rabbi', 'contact_number' => '88017XXXXXXXXXX'];
$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: '88017XXXXXXXXX', message_type: 'contact', contact_name: 'Golam Rabbi', contact_number: '88017XXXXXXXXXX' }.to_json
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |h| h.request(request) }go
payload := map[string]interface{}{"number": "88017XXXXXXXXX", "message_type": "contact", "contact_name": "Golam Rabbi", "contact_number": "88017XXXXXXXXXX"}
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 = "88017XXXXXXXXX", message_type = "contact", contact_name = "Golam Rabbi", contact_number = "88017XXXXXXXXXX" };
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\":\"88017XXXXXXXXX\",\"message_type\":\"contact\",\"contact_name\":\"Golam Rabbi\",\"contact_number\":\"88017XXXXXXXXXX\"}"))
.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": "88017XXXXXXXXX", "message_type": "contact", "contact_name": "Golam Rabbi", "contact_number": "88017XXXXXXXXXX"])
URLSession.shared.dataTask(with: request).resume()powershell
$body = @{ number = "88017XXXXXXXXX"; message_type = "contact"; contact_name = "Golam Rabbi"; contact_number = "88017XXXXXXXXXX" } | 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: '88017XXXXXXXXX', message_type: 'contact', contact_name: 'Golam Rabbi', contact_number: '88017XXXXXXXXXX' })
});rust
let payload = json!({"number": "88017XXXXXXXXX", "message_type": "contact", "contact_name": "Golam Rabbi", "contact_number": "88017XXXXXXXXXX"});
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.
