Envio de mensagens

Para enviar uma mensagem de texto, faça uma chamada POST para o endpoint api/Messages com um objeto de mensagem correlacionado conforme os exemplos abaixo:

curl --request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"text": {
		"body": "Chamando"
	},
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "text",
	"recipient_type": "individual"
}'

Se a mensagem for bem-sucedida, será retornado um objeto JSON com estas informações:

{
	"messages": [
		{
			"id": "wamid.HBgNNTUxMTk0ODQ4OTUwMBUCABEYEjhFNzNBRUUwMEQzNEQ4NTkwQgA="
		}
	]
}

Exemplos de mensagens

Text
curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"text": {
	"body": "Chamando Dioniso beta via Kong"
	},
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "text",
	"recipient_type": "individual"
}'
Template
curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"template": {
	"name": "beta_abandoncart_link_v1_1",
		"language": {
		"policy": "deterministic",
			"code": "pt_BR"
		},
		"components": [
			{
		"type": "body",
				"parameters": [
					{
			"type": "text",
						"text": "[name]"
					}
				]
			},
			{
		"type": "button",
				"sub_type": "url",
				"index": "0",
				"parameters": [
					{
			"type": "text",
						"text": "[target_url]"
					}
				]
			}
		]
	},
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "template",
	"recipient_type": "individual"
}'
Interactive
curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"interactive": {
	"type": "button",
		"header": null,
		"body": {
		"text": "Olá, o que você gostaria de fazer? teste às 15:59"
		},
		"footer": null,
		"action": {
		"button": null,
			"buttons": [
				{
			"type": "reply",
					"reply": {
				"id": "OLÁ, QUERO RECEBER MEU BENEFÍCIO.",
						"title": "Obter benefício"
					}
		},
				{
			"type": "reply",
					"reply": {
				"id": "#FALARCOMALOJA",
						"title": "Falar com a loja"
					}
		}
			],
			"catalog_id": null,
			"product_retailer_id": null,
			"sections": null
		}
},
	"Id": "4edad171-75f0-4ab9-becd-642586ab9e1e",
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "interactive",
	"recipient_type": "individual"
}'
Contacts
curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "contacts",
	"recipient_type": "individual",
	"contacts": [
		{
			"addresses": [
				{
					"street": "STREET",
					"city": "CITY",
					"state": "STATE",
					"zip": "ZIP",
					"country": "COUNTRY",
					"country_code": "COUNTRY_CODE",
					"type": "HOME"
				},
				{
	"street": "STREET",
					"city": "CITY",
					"state": "STATE",
					"zip": "ZIP",
					"country": "COUNTRY",
					"country_code": "COUNTRY_CODE",
					"type": "WORK"
				}
			],
			"birthday": "1985-02-25",
			"emails": [
				{
					"email": "EMAIL",
					"type": "WORK"
				},
				{
	"email": "EMAIL",
					"type": "HOME"
				}
			],
			"name": {
	"formatted_name": "NAME",
				"first_name": "FIRST_NAME",
				"last_name": "LAST_NAME",
				"middle_name": "MIDDLE_NAME",
				"suffix": "SUFFIX",
				"prefix": "PREFIX"
			},
			"org": {
	"company": "COMPANY",
				"department": "DEPARTMENT",
				"title": "TITLE"
			},
			"phones": [
				{
					"phone": "PHONE_NUMBER",
					"type": "HOME"
				},
				{
	"phone": "PHONE_NUMBER",
					"type": "WORK",
					"wa_id": "PHONE_OR_WA_ID"
				}
			],
			"urls": [{
          "url": "URL",
          "type": "WORK"
        },
        {
	"url": "URL",
          "type": "HOME"

		}]
		}
	]
}'
Localization
curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "{phone}",
  "type": "location",
  "recipient_type": "individual",
  "location": {
	"longitude": "0.1",
    "latitude": "0.0",
    "name": "<Location Name>",
    "address": "<Location'\''s Address>"
  }
}'

Image
curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "image",
	"recipient_type": "individual",
	"image": {
	"id" : "515056594160172"
	}
}
'
Audio
curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "audio",
	"recipient_type": "individual",
	"audio": {
	"id" : "515056594160172"
	}
}
'
Video
curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "video",
	"recipient_type": "individual",
	"video": {
	"id" : "515056594160172"
	}
}'
Document
curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "document",
	"recipient_type": "individual",
	"document": {
	"caption": "doc",
		"id" : "515056594160172",
		"filename": "myNameDoc.pdf"
	}
}
'
Sticker
curl --request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 4.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "{phone}",
	"type": "sticker",
	"recipient_type": "individual",
	"sticker": {
		"id" : "515056594160172"
	}
}'
Language
Click Try It! to start a request and see the response here!