cURL
curl --request POST \
--url https://api.cakto.com.br/public_api/webhook/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"url": "<string>",
"products": [
"<string>"
],
"events": []
}
'import requests
url = "https://api.cakto.com.br/public_api/webhook/"
payload = {
"name": "<string>",
"url": "<string>",
"products": ["<string>"],
"events": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', url: '<string>', products: ['<string>'], events: []})
};
fetch('https://api.cakto.com.br/public_api/webhook/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cakto.com.br/public_api/webhook/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'url' => '<string>',
'products' => [
'<string>'
],
'events' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.cakto.com.br/public_api/webhook/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"products\": [\n \"<string>\"\n ],\n \"events\": []\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://api.cakto.com.br/public_api/webhook/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"products\": [\n \"<string>\"\n ],\n \"events\": []\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.cakto.com.br/public_api/webhook/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"products\": [\n \"<string>\"\n ],\n \"events\": []\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": 2863878,
"status": "active",
"name": "Venda Aprovada <Produto 1>",
"url": "https://destination-url-example.com.br/webhook-endpoint",
"products": [
{
"id": "cd287b31-d4b7-4e94-858a-96e05ce2f4r4",
"name": "Produto 1",
"image": "https://image-url-example.com.br",
"description": "Produto 1",
"price": 5,
"type": "unique",
"contentDeliveries": [
"cakto",
"telegram",
"discord"
],
"emailAccessLink": null,
"salesPage": "https://pv.example.com.br/product/",
"status": "active",
"paymentMethods": [
"boleto",
"credit_card",
"picpay"
],
"category": {
"id": "0673d296-1802-45e0-bc93-612f7514dddb",
"name": "Apps & Software"
}
}
],
"events": [
{
"id": 3,
"name": "Compra aprovada",
"custom_id": "purchase_approved"
}
],
"fields": {
"secret": "8a67e42d-08b9-4987-9f40-0fe7bfd15a5a"
},
"createdAt": "2050-11-07T09:11:58.377388-03:00",
"updatedAt": "2050-11-07T09:11:58.377406-03:00"
}Webhooks
Criar Webhook
Cria um novo webhook para receber eventos do Cakto
POST
/
public_api
/
webhook
/
cURL
curl --request POST \
--url https://api.cakto.com.br/public_api/webhook/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"url": "<string>",
"products": [
"<string>"
],
"events": []
}
'import requests
url = "https://api.cakto.com.br/public_api/webhook/"
payload = {
"name": "<string>",
"url": "<string>",
"products": ["<string>"],
"events": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', url: '<string>', products: ['<string>'], events: []})
};
fetch('https://api.cakto.com.br/public_api/webhook/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cakto.com.br/public_api/webhook/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'url' => '<string>',
'products' => [
'<string>'
],
'events' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.cakto.com.br/public_api/webhook/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"products\": [\n \"<string>\"\n ],\n \"events\": []\n}"
response = http.request(request)
puts response.read_bodyHttpResponse<String> response = Unirest.post("https://api.cakto.com.br/public_api/webhook/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"products\": [\n \"<string>\"\n ],\n \"events\": []\n}")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.cakto.com.br/public_api/webhook/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"name\": \"<string>\",\n \"url\": \"<string>\",\n \"products\": [\n \"<string>\"\n ],\n \"events\": []\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": 2863878,
"status": "active",
"name": "Venda Aprovada <Produto 1>",
"url": "https://destination-url-example.com.br/webhook-endpoint",
"products": [
{
"id": "cd287b31-d4b7-4e94-858a-96e05ce2f4r4",
"name": "Produto 1",
"image": "https://image-url-example.com.br",
"description": "Produto 1",
"price": 5,
"type": "unique",
"contentDeliveries": [
"cakto",
"telegram",
"discord"
],
"emailAccessLink": null,
"salesPage": "https://pv.example.com.br/product/",
"status": "active",
"paymentMethods": [
"boleto",
"credit_card",
"picpay"
],
"category": {
"id": "0673d296-1802-45e0-bc93-612f7514dddb",
"name": "Apps & Software"
}
}
],
"events": [
{
"id": 3,
"name": "Compra aprovada",
"custom_id": "purchase_approved"
}
],
"fields": {
"secret": "8a67e42d-08b9-4987-9f40-0fe7bfd15a5a"
},
"createdAt": "2050-11-07T09:11:58.377388-03:00",
"updatedAt": "2050-11-07T09:11:58.377406-03:00"
}Escopo
write webhooks
- Consulte a lista completa de eventos disponíveis Aqui
- Crie webhooks pelo Painel Cakto em Integrações > Webhooks
Ao criar um webhook, você pode selecionar múltiplos eventos.
products é obrigatório: o webhook só recebe eventos dos produtos informados, não de toda a conta.- Certifique-se de que sua URL está preparada para receber requisições POST com conteúdo JSON.
- Sua aplicação deve responder em até 8 segundos para evitar falhas de entrega. Veja a política de retentativas em Guia de Webhooks.
Authorizations
Token de autenticação do tipo Bearer {access_token}, onde {access_token} é o token obtido no fluxo de autenticação.
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Nome do app
Maximum string length:
255URL de destino, onde os eventos serão enviados
Maximum string length:
2048Produtos que utilizam este app
custom_id de eventos para associar ao app webhook
checkout_abandonment- Abandono de Checkoutpurchase_approved- Compra aprovadapurchase_refused- Compra recusadapix_gerado- Pix geradoboleto_gerado- Boleto geradopicpay_gerado- PicPay geradoopenfinance_nubank_gerado- Nubank geradochargeback- Chargebackrefund- Reembolsosubscription_created- Assinatura criadasubscription_canceled- Assinatura canceladasubscription_renewed- Assinatura renovadasubscription_renewal_refused- Renovação de assinatura recusadasubscription_paused- Assinatura pausadasubscription_resumed- Assinatura reativada
Available options:
checkout_abandonment, purchase_approved, purchase_refused, pix_gerado, boleto_gerado, picpay_gerado, openfinance_nubank_gerado, chargeback, refund, subscription_created, subscription_canceled, subscription_renewed, subscription_renewal_refused, subscription_paused, subscription_resumed Status atual do app
active- Ativodisabled- Desativadowaiting_config- Aguardando Configuraçãopaused- Pausado
Available options:
active, disabled, waiting_config, paused Response
Corpo da resposta status 200
Nome do app
Maximum string length:
255Produtos que utilizam este app
Show child attributes
Show child attributes
Eventos que disparam este app
Show child attributes
Show child attributes
Data e hora de criação
Data e hora da última atualização
Status atual do app
active- Ativodisabled- Desativadowaiting_config- Aguardando Configuraçãopaused- Pausado
Available options:
active, disabled, waiting_config, paused URL de destino, onde os eventos serão enviados
Maximum string length:
2048Campos adicionais para o app
Was this page helpful?