Deploy
curl --request POST \
--url https://macaly.com/api/chat/{chatId}/deploy \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat/{chatId}/deploy"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat/{chatId}/deploy', 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://macaly.com/api/chat/{chatId}/deploy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat/{chatId}/deploy"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://macaly.com/api/chat/{chatId}/deploy")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat/{chatId}/deploy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyEndpoints
Deploy
Implementa um chat em produção
POST
/
api
/
chat
/
{chatId}
/
deploy
Deploy
curl --request POST \
--url https://macaly.com/api/chat/{chatId}/deploy \
--header 'Authorization: Bearer <token>'import requests
url = "https://macaly.com/api/chat/{chatId}/deploy"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://macaly.com/api/chat/{chatId}/deploy', 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://macaly.com/api/chat/{chatId}/deploy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://macaly.com/api/chat/{chatId}/deploy"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://macaly.com/api/chat/{chatId}/deploy")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://macaly.com/api/chat/{chatId}/deploy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyImplementa um chat em produção. Inicia uma implementação na Vercel e devolve a resposta imediatamente.
Pedido
POST /api/chat/{chatId}/deploy
Cabeçalhos
| Cabeçalho | Obrigatório | Descrição |
|---|---|---|
Authorization | Sim | Bearer macaly_... |
Parâmetros de caminho
| Parâmetro | Tipo | Descrição |
|---|---|---|
chatId | string | O ID do chat a implementar |
Exemplo de pedido
curl -X POST https://www.macaly.com/api/chat/abc123/deploy \
-H "Authorization: Bearer macaly_abc123..."
const response = await fetch(
`https://www.macaly.com/api/chat/${chatId}/deploy`,
{
method: 'POST',
headers: {
'Authorization': 'Bearer macaly_abc123...',
},
}
);
const data = await response.json();
console.log(data.url);
import requests
response = requests.post(
f'https://www.macaly.com/api/chat/{chat_id}/deploy',
headers={
'Authorization': 'Bearer macaly_abc123...',
},
)
data = response.json()
print(data['url'])
Resposta
{
"id": "jzga0sttml37v6mbizb8tk1x",
"url": "https://macaly-staging-abc123.macaly.app",
"status": "QUEUED",
"deploymentId": "dpl_HKLBd2QDTwq58AMUJiaMyUzk8WUw"
}
Campos de resposta
| Campo | Tipo | Descrição |
|---|---|---|
id | string | ID da implementação na base de dados |
url | string | URL da implementação |
status | "QUEUED" | "BUILDING" | Estado inicial |
deploymentId | string | ID da implementação na Vercel |
Códigos de estado
| Estado | Descrição |
|---|---|
| 200 | Implementação iniciada |
| 400 | Pedido inválido (por exemplo, o chat não tem mensagens) |
| 401 | Chave API inválida ou em falta |
| 403 | Sem permissão para implementar OU o chat não pertence à equipa |
| 404 | Chat não encontrado |
| 500 | Erro do servidor |
Notas
Este endpoint devolve a resposta imediatamente após iniciar a implementação. A implementação acontece de forma assíncrona na Vercel.
- Usa
GET /api/chat/{chatId}/deploymentcom oiddevolvido comodeploymentIdpara acompanhar o progresso - Requer a permissão
hosting.publish_macaly
Próximos passos
Depois de iniciares uma implementação:- Acompanha o progresso com
GET /api/chat/{chatId}/deployment, passando oiddevolvido comodeploymentId - Espera que
statuspasse aREADY
Esta página foi útil?