Ejemplos
Last update: 7 months ago by Irais Aguirre
Texto
Petición HTTP texto
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "text","text": "~Texto tachado~ \n _Texto en cursivas_ \n *Texto en negritas* \n Emojis 😋",}'
Body texto
{"from": "5215500000001","to": "5215500000002","type": "text","text": "~Texto tachado~ \n _Texto en cursivas_ \n *Texto en negritas* \n Emojis 😋"}
Texto con vista previa de URL
Petición HTTP vista previa
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "text","text": "https://www.ejemplo.com","preview_url": true}'
Body vista previa
{"from": "5215500000001","to": "5215500000002","type": "text","text": "https://www.ejemplo.com""preview_url": true}
Contenido multimedia
Imagen
Petición HTTP imagen
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "image","link": "https://www.ejemplo.com/ejemplo_imagen.png","caption": "Este es caption de tipo image"}'
Body imagen
{"from": "5215500000001","to": "5215500000002","type": "image","link": "https://www.ejemplo.com/ejemplo_imagen.png","caption": "Este es caption de tipo image"}
Documento
Petición HTTP documento
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "document","link": "https://www.ejemplo.com/ejemplo_documento.pdf","caption":"Este es el caption de tipo document","filename":"ejemplo_documento.pdf"}'
Body documento
{"from": "5215500000001","to": "5215500000002","type": "document","link": "https://www.ejemplo.com/ejemplo_documento.pdf","caption": "Este es caption de tipo document","filename": "ejemplo_documento.pdf",}
Video
Petición HTTP video
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "video","link": "https://www.ejemplo.com/ejemplo_video_3.7_MB.mp4"}'
Body video
{"from": "5215500000001","to": "5215500000002","type": "video","link": "https://www.ejemplo.com/ejemplo_video_3.7_MB.mp4"}
Sticker
Petición HTTP sticker
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "sticker","link": "https://www.ejemplo.com/ejemplo_sticker.webp"}'
Body sticker
{"from": "5215500000001","to": "5215500000002","type": "sticker","link": "https://www.ejemplo.com/ejemplo_sticker.webp"}
Audio
Petición HTTP audio
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "audio","link": "https://www.ejemplo.com/ejemplo_audio.ogg"}'
Body audio
{"from": "5215500000001","to": "5215500000002","type": "audio","link": "https://www.ejemplo.com/ejemplo_audio.ogg"}
Ubicación
Petición HTTP ubicación
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "location","longitude": -122.425332,"latitude": 37.758056,"name": "Facebook HQ","address": "1 Hacker Way, Menlo Park, CA 94025"}'
Body ubicación
{"from": "5215500000001","to": "5215500000002","type": "location","longitude": -122.425332,"latitude": 37.758056,"name": "Facebook HQ","address": "1 Hacker Way, Menlo Park, CA 94025"}
Contactos
Petición HTTP contactos
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "contacts","contacts":[{"addresses": [{"city": "México city","country": "México","country_code": "mx","state": "MX","street": "Paseo de la Reforma","type": "HOME","zip": "00000"}],"birthday": "1970-01-01","emails": [{"email": "test@test.com","type": "WORK"}],"name": {"first_name": "John","formatted_name": "John Williams","last_name": "Williams"},"org": {"company": "Facebook"},"phones": [{"phone": "525536493568","type": "HOME"}],"urls": [{"url":"https://facebook.com","type":"WORK"}]}]}'
Body contactos
{"from": "5215500000001","to": "5215500000002","type": "contacts","contacts": [{"addresses": [{"city": "Mexico city","country": "Mexico","country_code": "mx","state": "MX","street": "Calzada de Guadalupe","type": "HOME","zip": "00000"}],"birthday": "1989-10-11","emails": [{"email": "test@mail.com","type": "WORK"}],"name": {"first_name": "Juan","last_name": "Pérez","formatted_name": "Juan Pérez",},"org": {"company": "Concepto Movil"},"phones": [{"phone": "5500000001","type": "HOME"}],"urls": [{"url": "https://google.com","type": "WORK"}]}]}
Responder a un mensaje
Petición HTTP responder mensaje
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "image","text": "Hola, ¡buenos días! ¿En que le puedo ayudar?","context":{"message_id": "wamid.HBgNNTIxNTUyMDc3NzA1OBUCABIYFDNBRjYyNjE2MUFGQkMxMTkxOTI0AA=="}}'
Body responder mensaje
{"from": "5215500000001","to": "5215500000002","type": "image","text": "Hola, ¡buenos días! ¿En que le puedo ayudar?","context":{"message_id": "wamid.HBgNNTIxNTUyMDc3NzA1OBUCABIYFDNBRjYyNjE2MUFGQkMxMTkxOTI0AA=="}}
Reacción
Petición HTTP reacción
curl -X POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \-H 'Authorization: Bearer {{wa-msg-api-token}}' \-H 'Content-Type: application/json' \-d '{"from": "5215500000001","to": "5215500000002","type": "reaction","reaction":{"message_id": "wamid.HBgNNTIxNTUyMDc3NzA1OBUCABIYFDNBRjYyNjE2MUFGQkMxMTkxOTI0AA==","emoji": "👍🏻"}}'
Body reacción
{"from": "5215500000001","to": "5215500000002","type": "reaction","reaction":{"message_id": "wamid.HBgNNTIxNTUyMDc3NzA1OBUCABIYFDNBRjYyNjE2MUFGQkMxMTkxOTI0AA==","emoji": "👍🏻"}}