Criar uma nova etiqueta
curl --request POST \
--url https://{host}/api/{session}/labels \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "Lead",
"colorHex": "#ff9485",
"color": null
}
'import requests
url = "https://{host}/api/{session}/labels"
payload = {
"name": "Lead",
"colorHex": "#ff9485",
"color": None
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Lead', colorHex: '#ff9485', color: null})
};
fetch('https://{host}/api/{session}/labels', 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://{host}/api/{session}/labels",
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([
'name' => 'Lead',
'colorHex' => '#ff9485',
'color' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <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://{host}/api/{session}/labels"
payload := strings.NewReader("{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<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://{host}/api/{session}/labels")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/labels")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"label": {
"id": "label123",
"name": "Clientes VIP",
"color": 1
}
}
Etiquetas
Criar Novo Rótulo
Criar um novo rótulo para organizar e categorizar chats
POST
/
api
/
{session}
/
labels
Criar uma nova etiqueta
curl --request POST \
--url https://{host}/api/{session}/labels \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "Lead",
"colorHex": "#ff9485",
"color": null
}
'import requests
url = "https://{host}/api/{session}/labels"
payload = {
"name": "Lead",
"colorHex": "#ff9485",
"color": None
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Lead', colorHex: '#ff9485', color: null})
};
fetch('https://{host}/api/{session}/labels', 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://{host}/api/{session}/labels",
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([
'name' => 'Lead',
'colorHex' => '#ff9485',
'color' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <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://{host}/api/{session}/labels"
payload := strings.NewReader("{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<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://{host}/api/{session}/labels")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/labels")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"label": {
"id": "label123",
"name": "Clientes VIP",
"color": 1
}
}
Descrição
Este endpoint permite criar um novo rótulo (label) para organizar seus chats. Rótulos são úteis para categorizar conversas por temas, prioridades ou qualquer critério personalizado.Parâmetros de URL
string
required
ID único da sessão WhatsApp
Corpo da Requisição
string
ID personalizado do rótulo (opcional)
string
required
Nome do rótulo
number
required
Código numérico da cor do rótulo
Resposta
boolean
Indica se o rótulo foi criado com sucesso
{
"success": true,
"label": {
"id": "label123",
"name": "Clientes VIP",
"color": 1
}
}
Códigos de Status
200- Rótulo criado com sucesso400- Parâmetros inválidos401- Não autorizado
Exemplo de Uso
curl -X POST https://api.wappfy.com.br/api/my-session/labels \
-H "Content-Type: application/json" \
-d '{
"label": {
"name": "Clientes VIP",
"color": 1
}
}'
const session = 'my-session';
const response = await fetch(`https://api.wappfy.com.br/api/${session}/labels`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
label: {
name: 'Clientes VIP',
color: 1
}
})
});
const data = await response.json();
console.log(data);
import requests
session = 'my-session'
response = requests.post(
f'https://api.wappfy.com.br/api/{session}/labels',
json={
'label': {
'name': 'Clientes VIP',
'color': 1
}
}
)
data = response.json()
print(data)
Authorizations
Sua chave de API do Wappfy (obtenha em dash.wappfy.com.br)
Path Parameters
Nome da sessão (instanceName)
Body
application/json
