Examples
Last update: 5 hours ago by Irais Aguirre
Example requests for sending a template message with the VentaChat API.
HTTP request with text header
curl -X POST 'http://{{url}}/api-template' \-H 'Authorization: Bearer {{api-token}}' \-H 'Content-Type: application/json' \-H 'Accept: */*' \-d '{"from": "5215500000001","to": "5215500000002","userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","workgroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","campaignId": "campaign001","type": "template","message": {"templateId": 9007199254740991,"template": {"components": [{"type": "header","parameters": [{"type":"text","text":"123456"}]}]}}}'
HTTP request with text body
curl -X POST 'http://{{url}}/api-template' \-H 'Authorization: Bearer {{api-token}}' \-H 'Content-Type: application/json' \-H 'Accept: */*' \-d '{"contactName": "Juan","from": "5215500000001","to": "5215500000002","userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","workgroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","campaignId": "campaign001","type": "template","message": {"templateId": 9007199254740991,"template": {"components": [{"type": "body","parameters": [{"type":"text","text":"123456"}]}]}}}'
HTTP request with currency header
curl -X POST 'http://{{url}}/api-template' \-H 'Authorization: Bearer {{api-token}}' \-H 'Content-Type: application/json' \-H 'Accept: */*' \-d '{"contactName": "Juan","from": "5215500000001","to": "5215500000002","userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","workgroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","campaignId": "campaign001","type": "template","message": {"templateId": 9007199254740991,"template": {"components": [{"type": "header","parameters": [{"type":"currency","currency": {"fallbackValue": "$100.99","code": "MXN","amount": 222990}}]}]}}}'
HTTP request with currency body
curl -X POST 'http://{{url}}/api-template' \-H 'Authorization: Bearer {{api-token}}' \-H 'Content-Type: application/json' \-H 'Accept: */*' \-d '{"contactName": "Juan","from": "5215500000001","to": "5215500000002","userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","workgroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","campaignId": "campaign001","type": "template","message": {"templateId": 9007199254740991,"template": {"components": [{"type": "body","parameters": [{"type":"currency","currency": {"fallbackValue": "$100.99","code": "MXN","amount": 222990}}]}]}}}'
HTTP request with date time header
curl -X POST 'http://{{url}}/api-template' \-H 'Authorization: Bearer {{api-token}}' \-H 'Content-Type: application/json' \-H 'Accept: */*' \-d '{"contactName": "Juan","from": "5215500000001","to": "5215500000002","userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","workgroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","campaignId": "campaign001","type": "template","message": {"templateId": 9007199254740991,"template": {"components": [{"type": "header","parameters": [{"type": "date_time","date_time": {"fallbackValue": "Octubre 2, 1990","dayOfMonth": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}}'
HTTP request with date time body
curl -X POST 'http://{{url}}/api-template' \-H 'Authorization: Bearer {{api-token}}' \-H 'Content-Type: application/json' \-H 'Accept: */*' \-d '{"contactName": "Juan","from": "5215500000001","to": "5215500000002","userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","workgroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","campaignId": "campaign001","type": "template","message": {"templateId": 9007199254740991,"template": {"components": [{"type": "body","parameters": [{"type": "date_time","date_time": {"fallbackValue": "Octubre 2, 1990","dayOfMonth": 30,"year": 2021,"month": 3,"hour": 13,"minute": 19}}]}]}}}'
HTTP request with image
curl -X POST 'http://{{url}}/api-template' \-H 'Authorization: Bearer {{api-token}}' \-H 'Content-Type: application/json' \-H 'Accept: */*' \-d '{"contactName": "Juan","from": "5215500000001","to": "5215500000002","userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","workgroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","campaignId": "campaign001","type": "template","message": {"templateId": 9007199254740991,"template": {"components": [{"type": "header","parameters": [{"link": "http://victormoran.me/leo/Broadcaster-RCS_API_v1.0.jpg","type": "image"}]},{"type": "body","parameters": [{"text": "sample text","type": "text"}]}]}}}'
HTTP request with document
curl -X POST 'http://{{url}}/api-template' \-H 'Authorization: Bearer {{api-token}}' \-H 'Content-Type: application/json' \-H 'Accept: */*' \-d '{"contactName": "Juan","from": "5215500000001","to": "5215500000002","userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","workgroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","campaignId": "campaign001","type": "template","message": {"templateId": 9007199254740991,"template": {"components": [{"type": "header","parameters": [{"link": "http://victormoran.me/leo/Broadcaster-RCS_API_v1.0.pdf","type": "document","filename": "RCS Documentation"}]},{"type": "body","parameters": [{"text": "sample text","type": "text"}]}]}}}'
HTTP request with video
curl -X POST 'http://{{url}}/api-template' \-H 'Authorization: Bearer {{api-token}}' \-H 'Content-Type: application/json' \-H 'Accept: */*' \-d '{"contactName": "Juan","from": "5215500000001","to": "5215500000002","userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","workgroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6","campaignId": "campaign001","type": "template","message": {"templateId": 9007199254740991,"template": {"components": [{"type": "header","parameters": [{"link": "http://victormoran.me/leo/Broadcaster-RCS_API_v1.0.mp4","type": "video"}]},{"type": "body","parameters": [{"text": "sample text","type": "text"}]}]}}}'
