Create a new label
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": "VIP Clients",
"color": 1
}
}
Labels
Create New Label
Create new label to organize and categorize chats
POST
/
api
/
{session}
/
labels
Create a new label
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": "VIP Clients",
"color": 1
}
}
Description
This endpoint allows you to create a new label to organize your chats. Labels are useful for categorizing chats by themes, priorities or any custom criteria.URL Parameters
Request Body
Response
{
"success": true,
"label": {
"id": "label123",
"name": "VIP Clients",
"color": 1
}
}
Status Codes
200- Label created successfully400- Invalid parameters401- Unauthorized
Usage Example
curl -X POST https://api.wappfy.com.br/api/my-session/labels \
-H "Content-Type: application/json" \
-d '{
"label": {
"name": "VIP Clients",
"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: 'VIP Clients',
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': 'VIP Clients',
'color': 1
}
}
)
data = response.json()
print(data)
Body
application/json
