Crear grupo
curl --request POST \
--url https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"autoInvite": true,
"groupName": "Grupo Z-API",
"phones": [
"5544999999999",
"5544888888888"
]
}
'import requests
url = "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group"
payload = {
"autoInvite": True,
"groupName": "Grupo Z-API",
"phones": ["5544999999999", "5544888888888"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
autoInvite: true,
groupName: 'Grupo Z-API',
phones: ['5544999999999', '5544888888888']
})
};
fetch('https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group', 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://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group",
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([
'autoInvite' => true,
'groupName' => 'Grupo Z-API',
'phones' => [
'5544999999999',
'5544888888888'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group"
payload := strings.NewReader("{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"phone": "120363019502650977-group",
"phonesNotAdded": [
"2111897971174599@lid",
"5544777777777"
],
"invitationLink": "https://chat.whatsapp.com/GONwbGGDkLe8BifUWwLgct"
}{
"error": "invalid path parameter"
}{
"error": "instance subscription is not active"
}{
"error": "internal server error"
}{
"error": "failed to reach the META_WHATSAPP channel"
}{
"error": "<string>"
}Crear y editar
Crear grupo
Crea un grupo con los participantes indicados
POST
/
create-group
Crear grupo
curl --request POST \
--url https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"autoInvite": true,
"groupName": "Grupo Z-API",
"phones": [
"5544999999999",
"5544888888888"
]
}
'import requests
url = "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group"
payload = {
"autoInvite": True,
"groupName": "Grupo Z-API",
"phones": ["5544999999999", "5544888888888"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
autoInvite: true,
groupName: 'Grupo Z-API',
phones: ['5544999999999', '5544888888888']
})
};
fetch('https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group', 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://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group",
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([
'autoInvite' => true,
'groupName' => 'Grupo Z-API',
'phones' => [
'5544999999999',
'5544888888888'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group"
payload := strings.NewReader("{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/create-group")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"autoInvite\": true,\n \"groupName\": \"Grupo Z-API\",\n \"phones\": [\n \"5544999999999\",\n \"5544888888888\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"phone": "120363019502650977-group",
"phonesNotAdded": [
"2111897971174599@lid",
"5544777777777"
],
"invitationLink": "https://chat.whatsapp.com/GONwbGGDkLe8BifUWwLgct"
}{
"error": "invalid path parameter"
}{
"error": "instance subscription is not active"
}{
"error": "internal server error"
}{
"error": "failed to reach the META_WHATSAPP channel"
}{
"error": "<string>"
}Conceptos
Método que crea un grupo con sus participantes. No es posible enviar la imagen al crear el grupo: agrégala después con Actualizar imagen del grupo. No incluyas el número conectado en la lista de participantes. Como en WhatsApp Web, se necesita al menos un contacto para crear el grupo. Usa solo números de teléfono. El identificador@lid no es compatible con la creación de grupos: si se envía, el grupo se crea, pero el participante con @lid no se incluye y el identificador vuelve en phonesNotAdded.
En WhatsApp Oficial, nadie se agrega al crear: los números de
phones vuelven en phonesNotAdded, porque Meta no permite agregar participantes manualmente, y la entrada es solo por el invitationLink. El grupo tiene como máximo 8 participantes. Para exigir aprobación de entrada, envía requireAdminApproval true.Autorizaciones
Cuerpo
application/json