Criação de novo webhook para notificação
curl --request POST \
--url https://api.malga.io/v1/webhooks \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"event": "transaction.authorized",
"endpoint": "https://enuqkxq2lu8be0y.m.pipedream.net",
"version": 1.1,
"status": true
}
'const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: 'transaction.authorized',
endpoint: 'https://enuqkxq2lu8be0y.m.pipedream.net',
version: 1.1,
status: true
})
};
fetch('https://api.malga.io/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.malga.io/v1/webhooks"
payload := strings.NewReader("{\n \"event\": \"transaction.authorized\",\n \"endpoint\": \"https://enuqkxq2lu8be0y.m.pipedream.net\",\n \"version\": 1.1,\n \"status\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-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))
}{
"id": "324d35fe-86da-4a7d-96f4-370b338d9c5e",
"event": "transaction.authorized",
"endpoint": "https://enuqkxq2lu8be0y.m.pipedream.net",
"version": 1.1,
"publicKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAnFQSIT7Mwg5QLeJLAwhAJx9wS+XsQvnyph/Lz7AJyQA=\n-----END PUBLIC KEY-----\n",
"status": true,
"clientId": "d353deef-dacb-40a0-8cab-931ff773f274",
"createdAt": "2021-07-06T21:03:36.590Z",
"updatedAt": "2021-07-06T21:03:36.590Z"
}{
"statusCode": 123,
"message": "<string>"
}Webhooks
Criação de novo webhook para notificação
POST
/
v1
/
webhooks
Criação de novo webhook para notificação
curl --request POST \
--url https://api.malga.io/v1/webhooks \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"event": "transaction.authorized",
"endpoint": "https://enuqkxq2lu8be0y.m.pipedream.net",
"version": 1.1,
"status": true
}
'const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: 'transaction.authorized',
endpoint: 'https://enuqkxq2lu8be0y.m.pipedream.net',
version: 1.1,
status: true
})
};
fetch('https://api.malga.io/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.malga.io/v1/webhooks"
payload := strings.NewReader("{\n \"event\": \"transaction.authorized\",\n \"endpoint\": \"https://enuqkxq2lu8be0y.m.pipedream.net\",\n \"version\": 1.1,\n \"status\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-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))
}{
"id": "324d35fe-86da-4a7d-96f4-370b338d9c5e",
"event": "transaction.authorized",
"endpoint": "https://enuqkxq2lu8be0y.m.pipedream.net",
"version": 1.1,
"publicKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAnFQSIT7Mwg5QLeJLAwhAJx9wS+XsQvnyph/Lz7AJyQA=\n-----END PUBLIC KEY-----\n",
"status": true,
"clientId": "d353deef-dacb-40a0-8cab-931ff773f274",
"createdAt": "2021-07-06T21:03:36.590Z",
"updatedAt": "2021-07-06T21:03:36.590Z"
}{
"statusCode": 123,
"message": "<string>"
}Body
application/json
Evento que deseja receber notificações no seu webhook conforme descrito na seção Eventos suportados para notificação via webhooks. Deve ser criado um webhook para cada evento, podendo ser utilizado o wildcard * no lugar do evento para receber todos os eventos em um único webhook.
Response
Created.
Was this page helpful?