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: 5.0' \
  --data '{
	"text": {
		"body": "Chamando"
	},
	"messaging_product": "whatsapp",
	"to": "5511999999999",
	"type": "text",
	"recipient_type": "individual"
}'

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

 {
 	"messaging_product": "whatsapp",
 	"contacts": [
 		{
 			"input": "5511999999999",
 			"wa_id": "5511999999999"
 
         }
 	],
 	"messages": [
 		{
 			"id": "wamid.HBgNNTUxMTk0ODQ4OTUwMBUCABEYEjFBOTczMjAzOUM0QkU0NkQwMAA="
 
         }
 	]
 }

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: 5.0' \
  --data '{
	"text": {
	"body": "Chamando Dioniso beta via Kong"
	},
	"messaging_product": "whatsapp",
	"to": "5511999999999",
	"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: 5.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": "5511999999999",
	"type": "template",
	"recipient_type": "individual"
}'

Interativa com botões

curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 5.0' \
  --data '{
	    "interactive": {
	        "type": "button",
		    "body": {
		        "text": "Olá, o que você gostaria de fazer?"
		    },
		    "footer": null,
		    "action": {
		        "buttons": [
		        	{
		                "type": "reply",
		        		"reply": {
		        	        "id": "#SUBSCRIBE.",
		        			"title": "Cadastrar"
		        		}
		            },
		        	{
		                "type": "reply",
		        		"reply": {
		        	        "id": "#UNSUBSCRIBE",
		        			"title": "Descadastrar"
		        		}
		            }
		        ]
		    }
     },
 	"messaging_product": "whatsapp",
 	"to": "5511999999999",
 	"type": "interactive",
 	"recipient_type": "individual"
}'

Interativa com seções

curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 5.0' \
  --data '{
 	"messaging_product": "whatsapp",
 	"to": "{{ _.ToPhoneNumberWill }}",
 	"type": "interactive",
 	"recipient_type": "individual",
 	"interactive": {
     "type": "list",
     "header": {
       "type": "text",
       "text": "HEADER_TEXT"
     },
     "body": {
       "text": "BODY_TEXT"
     },
     "footer": {
       "text": "FOOTER_TEXT"
     },
     "action": {
       "button": "BUTTON_TEXT",
       "sections": [
         {
           "title": "SECTION_1_TITLE",
           "rows": [
             {
               "id": "SECTION_1_ROW_1_ID",
               "title": "SECTION_1_ROW_1_TITLE",
               "description": "SECTION_1_ROW_1_DESCRIPTION"
             },
             {
               "id": "SECTION_1_ROW_2_ID",
               "title": "SECTION_1_ROW_2_TITLE",
               "description": "SECTION_1_ROW_2_DESCRIPTION"
             }
           ]
         },
         {
           "title": "SECTION_2_TITLE",
           "rows": [
             {
               "id": "SECTION_2_ROW_1_ID",
               "title": "SECTION_2_ROW_1_TITLE",
               "description": "SECTION_2_ROW_1_DESCRIPTION"
             },
             {
               "id": "SECTION_2_ROW_2_ID",
               "title": "SECTION_2_ROW_2_TITLE",
               "description": "SECTION_2_ROW_2_DESCRIPTION"
             }
           ]
         }
       ]
     }
   }
 }'

Contacts

curl--request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 5.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "5511999999999",
	"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: 5.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "5511999999999",
  "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: 5.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "5511999999999",
	"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: 5.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "5511999999999",
	"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: 5.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "5511999999999",
	"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: 5.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "5511999999999",
	"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: 5.0' \
  --data '{
	"messaging_product": "whatsapp",
	"to": "5511999999999",
	"type": "sticker",
	"recipient_type": "individual",
	"sticker": {
		"id" : "515056594160172"
	}
}'

Reações à mensagens

curl --request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 5.0' \
  --data '{
		"messaging_product": "whatsapp",
	    "to": "5511999999999",
     "type": "reaction",
     "reaction": {
         "message_id": "wamid.wM...",
         "emoji": "\uD83D\uDE00"
      },
     "recipient_type": "individual",
}'

Marcar mensagem como lida

curl --request POST \
  --url https://api-cerberus-kong.socialminer.tech/api/Messages \
  --header 'Content-Type: application/json' \
  --header 'apikey: {APIKEY}' \
  --header 'version: 5.0' \
  --data '{
		"messaging_product": "whatsapp",
     "status": "read",
     "message_id": "wamid.wM..." 
}'
Language
Click Try It! to start a request and see the response here!