logo

Ejemplos

Last update: 3 days ago by Jimena Acevedo - JC

Generar token de administración de grupos

curl --location 'https://{{url}}/authorization-server/services/v1/auth/token' \
--header 'Api-Key: {{api-key}}' \
--header 'Api-Token: {{api-token}}'


Crear grupo

curl --location 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{wa_phone_number}}' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
"subject": "Support Team",
"description": "Group for customer support coordination",
"join_approval_mode": "approval_required"
}'


Eliminar grupo

curl --location --request DELETE 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}' \
--header 'Authorization: Bearer {{token}}'


Aceptar solicitudes para unirse al grupo

curl --location 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}/join_requests' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
"join_requests": [
"{{join_request_id}}"
]
}'


Obtener solicitudes para unirse al grupo

curl --location 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}/join_requests' \
--header 'Authorization: Bearer {{token}}'


Rechazar solicitudes para unirse al grupo

curl --location --request PUT 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}/join_requests' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
"join_requests": [
"{{join_request_id}}"
]
}'


Obtener enlace de invitación del grupo

curl --location 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}/invite_link' \
--header 'Authorization: Bearer {{token}}'


Restablecer enlace de invitación del grupo

curl --location --request PUT 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}/invite_link' \
--header 'Authorization: Bearer {{token}}'


Eliminar participantes del grupo

curl --location --request PUT 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}/participants' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
"participants": [
{ "user": "5212722159801" }
]
}'


Obtener información del grupo

curl --location 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}?fields=subject,description,participants,join_approval_mode' \
--header 'Authorization: Bearer {{token}}'


Actualizar configuración del grupo

curl --location --request PUT 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
"subject": "Watch Enthusiasts",
"description": "Join our community to discuss the latest timepieces."
}'


Actualizar foto de perfil del grupo

curl --location --request PUT 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{group_id}}' \
--header 'Authorization: Bearer {{token}}' \
--form 'file=@"/ruta/local/imagen.jpg"'


Obtener grupos activos

curl --location 'https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/group/{{waba}}/{{wa_phone_number}}/groups?limit=25' \
--header 'Authorization: Bearer {{token}}'


Enviar mensaje a un grupo

curl --location 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
"from": "{{wa_phone_number}}",
"to": "{{group_id}}",
"recipient_type": "group",
"type": "text",
"text": "Hello group!"
}'


Fijar mensaje en un grupo

curl --location 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
"from": "{{wa_phone_number}}",
"to": "{{group_id}}",
"recipient_type": "group",
"type": "pin",
"pin": {
"type": "pin",
"message_id": "{{pin_message_id}}",
"expiration_days": "30"
}
}'


Desfijar mensaje en un grupo

curl --location 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
"from": "{{wa_phone_number}}",
"to": "{{group_id}}",
"recipient_type": "group",
"type": "pin",
"pin": {
"type": "unpin",
"message_id": "{{pin_message_id}}"
}
}'
Whatsapp — Anterior
Conexión HTTP
Siguiente — Whatsapp
Respuestas