Adds a contact to the address book
curl --request POST \
--url https://api.wppfy.com/contact/add \
--header 'Content-Type: application/json' \
--header 'token: <api-key>' \
--data '
{
"number": "+55 (21) 99999-9999",
"name": "John Doe"
}
'import requests
url = "https://api.wppfy.com/contact/add"
payload = {
"number": "+55 (21) 99999-9999",
"name": "John Doe"
}
headers = {
"token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({number: '+55 (21) 99999-9999', name: 'John Doe'})
};
fetch('https://api.wppfy.com/contact/add', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wppfy.com/contact/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'number' => '+55 (21) 99999-9999',
'name' => 'John Doe'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wppfy.com/contact/add"
payload := strings.NewReader("{\n \"number\": \"+55 (21) 99999-9999\",\n \"name\": \"John Doe\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wppfy.com/contact/add")
.header("token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"+55 (21) 99999-9999\",\n \"name\": \"John Doe\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wppfy.com/contact/add")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"number\": \"+55 (21) 99999-9999\",\n \"name\": \"John Doe\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Contact added successfully",
"contact": {
"jid": "5511999999999@s.whatsapp.net",
"name": "John Doe",
"phone": "5511999999999"
}
}{
"error": "Invalid number"
}{
"error": "No session"
}{
"error": "Error adding contact"
}Contacts
Adds a contact to the address book
Adds a new contact to the phone’s address book.
The endpoint:
- Adds the contact to the address book using WhatsApp
- Uses the ‘name’ field for both the full name and the first name
- Saves the contact information in the WhatsApp address book
- Returns information about the added contact
POST
/
contact
/
add
Adds a contact to the address book
curl --request POST \
--url https://api.wppfy.com/contact/add \
--header 'Content-Type: application/json' \
--header 'token: <api-key>' \
--data '
{
"number": "+55 (21) 99999-9999",
"name": "John Doe"
}
'import requests
url = "https://api.wppfy.com/contact/add"
payload = {
"number": "+55 (21) 99999-9999",
"name": "John Doe"
}
headers = {
"token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({number: '+55 (21) 99999-9999', name: 'John Doe'})
};
fetch('https://api.wppfy.com/contact/add', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wppfy.com/contact/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'number' => '+55 (21) 99999-9999',
'name' => 'John Doe'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wppfy.com/contact/add"
payload := strings.NewReader("{\n \"number\": \"+55 (21) 99999-9999\",\n \"name\": \"John Doe\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wppfy.com/contact/add")
.header("token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"+55 (21) 99999-9999\",\n \"name\": \"John Doe\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wppfy.com/contact/add")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"number\": \"+55 (21) 99999-9999\",\n \"name\": \"John Doe\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Contact added successfully",
"contact": {
"jid": "5511999999999@s.whatsapp.net",
"name": "John Doe",
"phone": "5511999999999"
}
}{
"error": "Invalid number"
}{
"error": "No session"
}{
"error": "Error adding contact"
}Authorizations
Body
application/json
Phone number in international format with mandatory country code. For Brazil, it must start with 55. Accepts variations with/without the + symbol, with/without parentheses, with/without hyphens, and with/without spaces. Also accepts the WhatsApp JID format (@s.whatsapp.net). Does not accept business contacts (@lid) or groups (@g.us).
Examples:
"+55 (21) 99999-9999"
"+55 21 99999-9999"
"+55 21 999999999"
"+5521999999999"
"5521999999999"
"5521999999999@s.whatsapp.net"
Contact's full name (will be used as first name and full name)
Example:
"John Doe"
