logo

Ejemplos

Last update: 3 days ago by Irais Aguirre

Texto

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

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

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"
}
]
}
]
}
}

WhatsApp Flows

Petición HTTP con Body y Button

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": "en_US",
"name": "FLOW_TEMPLATE",
"components": [
{
"type": "body",
"parameters": [
{
"text": "This is a flows as template demo",
"type": "text"
}
]
},
{
"type": "button",
"subtype": "quick_reply",
"index": 0,
"parameters": [
{
"type": "action",
"action": {
"flow_token":"AQAAAAACS5FpgQ_cAAAAAD0QI3s.",
"flow_action_data": {
"product_name": "name",
"product_description": "description",
"product_price": 100
}
}
}
]
}
]
}
}'

Body con header texto

{
"from": "5215500000001",
"to": "5215500000002",
"type": "template",
"template": {
"language": "en_US",
"name": "FLOW_TEMPLATE",
"components": [
{
"type": "body",
"parameters": [
{
"text": "This is a flows as template demo",
"type": "text"
}
]
},
{
"type": "button",
"subtype": "quick_reply",
"index": 0,
"parameters": [
{
"type": "action",
"action": {
"flow_token":"AQAAAAACS5FpgQ_cAAAAAD0QI3s.",
"flow_action_data": {
"product_name": "name",
"product_description": "description",
"product_price": 100
}
}
}
]
}
]
}
}

Secuencia

Petición HTTP

curl --location --request POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \
-H 'Authorization: Bearer Your_Token' \
-H 'Content-Type: application/json' \
-d '{
"from": "{{wa-phone-number}}",
"to": "{{recipient-wa-id}}",
"type": "template",
"template":
{
"language": "es_MX",
"name": "concepto_movil_carrusel_products",
"components":
[
{
"type": "body",
"parameters":
[
{
"type": "text",
"text": "25OFF"
},
{
"type": "text",
"text": "25%"
}
]
},
{
"type": "carousel",
"cards":
[
{
"card_index": 0,
"components":
[
{
"type": "header",
"parameters":
[
{
"type": "image",
"imageId": "966046148378667"
}
]
}
]
},
{
"card_index": 1,
"components":
[
{
"type": "header",
"parameters":
[
{
"type": "image",
"imageId": "448282164313965"
}
]
}
]
},
{
"card_index": 2,
"components":
[
{
"type": "header",
"parameters":
[
{
"type": "image",
"imageId": "1583971738812030"
}
]
}
]
},
{
"card_index": 3,
"components":
[
{
"type": "header",
"parameters":
[
{
"type": "image",
"imageId": "1104222870702261"
}
]
}
]
}
]
}
]
}
}'

Body

{
"from": "{{wa-phone-number}}",
"to": "{{recipient-wa-id}}",
"type": "template",
"template": {
"language": "es_MX",
"name": "concepto_movil_carrusel_products",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "25OFF"
},
{
"type": "text",
"text": "25%"
}
]
},
{
"type": "carousel",
"cards": [
{
"card_index": 0,
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"imageId": "966046148378667"
}
]
}
]
},
{
"card_index": 1,
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"imageId": "448282164313965"
}
]
}
]
},
{
"card_index": 2,
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"imageId": "1583971738812030"
}
]
}
]
},
{
"card_index": 3,
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"imageId": "1104222870702261"
}
]
}
]
}
]
}
]
}
}

Cupones

Petición HTTP

curl --location --request POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \
-H 'Authorization: Bearer Your_Token' \
-H 'Content-Type: application/json' \
-d '{
"from": "5215541697885",
"to": "5614782109",
"type": "template",
"template": {
"language": "en",
"name": "concepto_movil_cupones_products",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "25OFF"
},
{
"type": "text",
"text": "25%"
}
]
},
{
"type": "button",
"subtype": "COPY_CODE",
"index": "1",
"parameters": [
{
"type": "coupon_code",
"coupon_code": "25OFF"
}
]
}
]
}
}'

Body

{
"from": "5215541697885",
"to": "5614782109",
"type": "template",
"template": {
"language": "en",
"name": "concepto_movil_cupones_products",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "25OFF"
},
{
"type": "text",
"text": "25%"
}
]
},
{
"type": "button",
"subtype": "COPY_CODE",
"index": "1",
"parameters": [
{
"type": "coupon_code",
"coupon_code": "25OFF"
}
]
}
]
}
}

Oferta por tiempo limitado

Petición HTTP

curl --location --request POST 'http://{{url}}/whatsapp-bsp-api-endpoint-ws/services/v1/messaging' \
-H 'Authorization: Bearer Your_Token' \
-H 'Content-Type: application/json' \
-d '{
"from": "5215541697885",
"to": "5614782109",
"type": "template",
"template": {
"language": "en",
"name": "concepto_movil_olt_products",
"components": [
{
"type": "header",
"parameters": [
{
"link": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/1200px-WhatsApp.svg.png",
"type": "image"
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Pablo"
},
{
"type": "text",
"text": "CARIBE25"
}
]
},
{
"type": "limited_time_offer",
"parameters": [
{
"type": "limited_time_offer",
"limited_time_offer": {
"expiration_date_time": "2024-12-04 15:20"
}
}
]
},
{
"type": "button",
"subtype": "copy_code",
"index": "0",
"parameters": [
{
"type": "coupon_code",
"coupon_code": "CARIBE25"
}
]
},
{
"type": "button",
"subtype": "url",
"index": "1",
"parameters": [
{
"type": "text",
"text": "n3mtql"
}
]
}
]
}
}'

Body

{
"from": "5215541697885",
"to": "5614782109",
"type": "template",
"template": {
"language": "en",
"name": "concepto_movil_olt_products",
"components": [
{
"type": "header",
"parameters": [
{
"link": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/WhatsApp.svg/1200px-WhatsApp.svg.png",
"type": "image"
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Pablo"
},
{
"type": "text",
"text": "CARIBE25"
}
]
},
{
"type": "limited_time_offer",
"parameters": [
{
"type": "limited_time_offer",
"limited_time_offer": {
"expiration_date_time": "2024-12-04 15:20"
}
}
]
},
{
"type": "button",
"subtype": "copy_code",
"index": "0",
"parameters": [
{
"type": "coupon_code",
"coupon_code": "CARIBE25"
}
]
},
{
"type": "button",
"subtype": "url",
"index": "1",
"parameters": [
{
"type": "text",
"text": "n3mtql"
}
]
}
]
}
}
Whatsapp — Anterior
Objetos
Siguiente — Whatsapp
Respuesta