Criar webhook de engajamento
curl --request POST \
--url https://api.taximachine.com.br/api/v2/integracao/engajamento \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"url": "<string>",
"headers": {},
"janela_estimativa_segundos": 165
}
'import requests
url = "https://api.taximachine.com.br/api/v2/integracao/engajamento"
payload = {
"url": "<string>",
"headers": {},
"janela_estimativa_segundos": 165
}
headers = {
"Authorization": "Basic <encoded-value>",
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({url: '<string>', headers: {}, janela_estimativa_segundos: 165})
};
fetch('https://api.taximachine.com.br/api/v2/integracao/engajamento', 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.taximachine.com.br/api/v2/integracao/engajamento",
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([
'url' => '<string>',
'headers' => [
],
'janela_estimativa_segundos' => 165
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.taximachine.com.br/api/v2/integracao/engajamento"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"headers\": {},\n \"janela_estimativa_segundos\": 165\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.taximachine.com.br/api/v2/integracao/engajamento")
.header("Authorization", "Basic <encoded-value>")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"headers\": {},\n \"janela_estimativa_segundos\": 165\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.taximachine.com.br/api/v2/integracao/engajamento")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"headers\": {},\n \"janela_estimativa_segundos\": 165\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Webhook de engajamento criado com sucesso."
}Engajamento
Criar webhook de engajamento
Cria um webhook de engajamento a partir de uma URL. Regras importantes:
- Só a central principal cadastra webhooks de engajamento. A central associada recebe
403e passa a receber os eventos quando é vinculada a um webhook da central principal emPOST /engajamento/{id}/permissoes; - Os Headers são opcionais e limitados a 10 chaves;
- Não é possível criar 2 webhooks com a mesma URL;
- É possível cadastrar até 100 webhooks de engajamento por central;
janela_estimativa_segundosé opcional e só vale para o eventoestimativa_passageiro_app_nao_solicitada: os demais eventos de engajamento continuam saindo na hora. Ausente ou nula, vale 30 segundos.
POST
/
engajamento
Criar webhook de engajamento
curl --request POST \
--url https://api.taximachine.com.br/api/v2/integracao/engajamento \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"url": "<string>",
"headers": {},
"janela_estimativa_segundos": 165
}
'import requests
url = "https://api.taximachine.com.br/api/v2/integracao/engajamento"
payload = {
"url": "<string>",
"headers": {},
"janela_estimativa_segundos": 165
}
headers = {
"Authorization": "Basic <encoded-value>",
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({url: '<string>', headers: {}, janela_estimativa_segundos: 165})
};
fetch('https://api.taximachine.com.br/api/v2/integracao/engajamento', 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.taximachine.com.br/api/v2/integracao/engajamento",
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([
'url' => '<string>',
'headers' => [
],
'janela_estimativa_segundos' => 165
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.taximachine.com.br/api/v2/integracao/engajamento"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"headers\": {},\n \"janela_estimativa_segundos\": 165\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.taximachine.com.br/api/v2/integracao/engajamento")
.header("Authorization", "Basic <encoded-value>")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"headers\": {},\n \"janela_estimativa_segundos\": 165\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.taximachine.com.br/api/v2/integracao/engajamento")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"headers\": {},\n \"janela_estimativa_segundos\": 165\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Webhook de engajamento criado com sucesso."
}Authorizations
Body
application/json
Só vale para o evento estimativa_passageiro_app_nao_solicitada: os demais eventos de engajamento continuam saindo na hora, sem janela. Segundos de espera, a partir da criação da estimativa, antes de entregar esse evento a este webhook (Opcional). Inteiro de 30 a 300. Ausente ou nulo vale 30. Texto, decimal ou valor fora da faixa é recusado com 400.
Required range:
30 <= x <= 300