Ejemplos
Last update: a year ago by Irais Aguirre
Texto
Header
Petición HTTP con header 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": "template","template":{"language": "es","name": "header_text","components":[{"type":"header","parameters":[{"type":"text","text":"123456"}]}]}}'
Body con header texto
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "header_text","components": [{"type": "header","parameters": [{"text": "123456","type": "text"}]},]}}
Body
Petición HTTP con body 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": "template","template":{"language": "es","name": "body_text","components":[{"type":"body","parameters":[{"type":"text","text":"123456"}]}]}}'
Body con body texto
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "body_text","components": [{"type": "body","parameters": [{"text": "123456","type": "text"}]},]}}
Currency
Header
Petición HTTP con header currency
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": "template","template":{"language": "es","name": "template_utility_23","components":[{"type":"header","parameters": [{"type": "currency","currency": {"fallback_value": "$100.99","code": "MXN","amount": 222990}},]}]}}'
Body con header currency
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "header","parameters": [{"type": "currency","currency": {"fallback_value": "$100.99","code": "MXN","amount": 222990}},]}]}}
Body
Petición HTTP con body currency
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": "template","template":{"language": "es","name": "template_utility_23","components":[{"type":"body","parameters": [{"type": "currency","currency": {"fallback_value": "$100.99","code": "MXN","amount": 222990}},]}]}}'
Body con body currency
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "body","parameters": [{"type": "currency","currency": {"fallback_value": "$100.99","code": "MXN","amount": 222990}},]}]}}
Date time
Header
Petición HTTP con header date time
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": "template","template":{"language": "es","name": "header_date_time","components":[{"type":"header","parameters": [{"type": "date_time","date_time": {"fallback_value": "Octubre 2, 1990","day_of_month": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}'
Body con header date time
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "header_date_time","components": [{"type": "header","parameters": [{"type": "date_time","date_time": {"fallback_value": "Octubre 2, 1990","day_of_month": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}
Body
Petición HTTP con body date time
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": "template","template":{"language": "es","name": "body_date_time","components":[{"type":"body","parameters": [{"type": "date_time","date_time": {"fallback_value": "Octubre 2, 1990","day_of_month": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}'
Body con body date time
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "body_date_time","components": [{"type": "body","parameters": [{"type": "date_time","date_time": {"fallback_value": "Octubre 2, 1990","day_of_month": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}
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": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "header","parameters": [{"link": "http:ejemplo.jpg","type": "image"}]},{"type": "body","parameters": [{"text": "ejemplo de texto","type": "text"}]},]}}'
Body imagen
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "header","parameters": [{"link": "http:ejemplo.jpg","type": "image"}]},{"type": "body","parameters": [{"text": "ejemplo de texto","type": "text"}]},]}}
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": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "header","parameters": [{"link": "http://victormoran.me/leo/Broadcaster-RCS_API_v1.0.pdf","type": "document","filename": "RCS Documentation"}]},{"type": "body","parameters": [{"text": "ejemplo de texto","type": "text"}]},]}}'
Body documento
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "header","parameters": [{"link": "http://victormoran.me/leo/Broadcaster-RCS_API_v1.0.pdf","type": "document","filename": "RCS Documentation"}]},{"type": "body","parameters": [{"text": "ejemplo de texto","type": "text"}]},]}}
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": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "header","parameters": [{"link": "https://victormoran.me/leo/PruebasWhatsApp/video_3.7_MB.mp4","type": "video","filename": "video"}]},{"type": "body","parameters": [{"text": "ejemplo de texto","type": "text"}]},]}}'
Body video
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "header","parameters": [{"link": "https://victormoran.me/leo/PruebasWhatsApp/video_3.7_MB.mp4","type": "video","filename": "video"}]},{"type": "body","parameters": [{"text": "ejemplo de texto","type": "text"}]},]}}
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": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "header","parameters": [{"type": "location","location": {"longitude": -99.1841566,"latitude": 19.4260393,"name": "Concepto Móvil","address": "Shakespeare 39-piso 3, Anzures, Miguel Hidalgo, 11590 Ciudad de México, CDMX"}}]},{"type": "body","parameters": [{"text": "ejemplo de texto","type": "text"}]},]}}'
Body ubicación
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "bienvenida","components": [{"type": "header","parameters": [{"type": "location","location": {"longitude": -99.1841566,"latitude": 19.4260393,"name": "Concepto Móvil","address": "Shakespeare 39-piso 3, Anzures, Miguel Hidalgo, 11590 Ciudad de México, CDMX"}}]},{"type": "body","parameters": [{"text": "ejemplo de texto","type": "text"}]},]}}
Botones
Quick reply
Petición HTTP quick reply
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": "template","template": {"language": "es","name": "calificacion_servicio","components": [{"type": "body","parameters": [{"text": "Juan","type": "text"}]},{"type": "button","subtype": "quick_reply","index": "0","parameters": [{"type": "payload","payload": "12345765"}]},{"type": "button","subtype": "quick_reply","index": "1","parameters": [{"type": "payload","payload": "12345765"}]},{"type": "button","subtype": "quick_reply","index": "2","parameters": [{"type": "payload","payload": "12345765"}]},]}}'
Body quick reply
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "calificacion_servicio","components": [{"type": "body","parameters": [{"text": "Juan","type": "text"}]},{"type": "button","subtype": "quick_reply","index": "0","parameters": [{"type": "payload","payload": "12345765"}]},{"type": "button","subtype": "quick_reply","index": "1","parameters": [{"type": "payload","payload": "12345765"}]},{"type": "button","subtype": "quick_reply","index": "2","parameters": [{"type": "payload","payload": "12345765"}]},]}}
Contraseña de un solo uso
Petición HTTP contraseña
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": "template","template": {"language": "es","name": "confirmacion_codigo_02","components": [{"type": "body","parameters": [{"type": "text","text": "54321"}]},{"type": "button","subtype": "url","index": "0","parameters":[{"type": "text","text": "54321"}]}]}}'
Body contraseña
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "confirmacion_codigo_02","components": [{"type": "body","parameters": [{"type": "text","text": "54321"}]},{"type": "button","subtype": "url","index": "0","parameters":[{"type": "text","text": "54321"}]}]}}
Acción de realizar llamada
Petición HTTP realizar llamada
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": "template","template": {"language": "es","name": "test_call_to_action_04","components": [{"type": "body","parameters":[{"type": "text","text": "now"}]}]}}'
Body realizar llamada
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "test_call_to_action_04","components": [{"type": "body","parameters":[{"type": "text","text": "now"}]}]}}
Acción de abrir URL
Acción de abrir URL estático
Petición HTTP url estático
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": "template","template": {"language": "es","name": "template_call_to_action"}}'
Body url estático
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "template_call_to_action"}}
Acción de abrir URL dinámico
Petición HTTP url dinámico
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": "template","template": {"language": "es","name": "template_example_account_button_call_to_action_url","components": [{{"type": "button","subtype": "url","index": "0","parameters":[{"type": "text","text": "producto_api.html"}]}]}}'
Body url dinámico
{"from": "5215500000001","to": "5215500000002","type": "template","template": {"language": "es","name": "template_example_account_button_call_to_action_url","components": [{"type": "button","subtype": "url","index": "0","parameters":[{"type": "text","text": "producto_api.html"}]}]}}