POST
/api/webhooksTo create a new Webhook send POST request with body containing a JSON hash of the required fields. The url must be secure, https protocol needs to be used.
Only one webhook per client app is currently allowed. Basic auth type is currently the only supported auth type.
Each payload delivered to your endpoint is signed (HMAC-SHA256). You will receive the signature key in this request response. You need to store it.
Password: Strong password required. Min length 8 chars. At least one character from [a-z], [A-Z], [0-9],
Headers
| Name | Example | Description |
|---|---|---|
Content-Type |
application/json | — |
Authorization |
Bearer demo_access_token | — |
Request body
{
"url": "{{webhook_url}}",
"auth_credentials": {
"auth_type": "basic",
"username": "integrator@example.com",
"password": "demo_password"
},
"settings": {
"notification_email": "integrator@example.com",
"event_types": [
"EXTRACTION_FINISHED"
]
}
}Code examples
curl --request POST 'https://app.datamolino.com/api/webhooks' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer demo_access_token' \
--data '{
"url": "{{webhook_url}}",
"auth_credentials": {
"auth_type": "basic",
"username": "integrator@example.com",
"password": "demo_password"
},
"settings": {
"notification_email": "integrator@example.com",
"event_types": [
"EXTRACTION_FINISHED"
]
}
}'POST /api/webhooks HTTP/1.1
Host: app.datamolino.com
Content-Type: application/json
Authorization: Bearer demo_access_token
{
"url": "{{webhook_url}}",
"auth_credentials": {
"auth_type": "basic",
"username": "integrator@example.com",
"password": "demo_password"
},
"settings": {
"notification_email": "integrator@example.com",
"event_types": [
"EXTRACTION_FINISHED"
]
}
}const response = await fetch("https://app.datamolino.com/api/webhooks", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer demo_access_token"
},
body: JSON.stringify({
"url": "{{webhook_url}}",
"auth_credentials": {
"auth_type": "basic",
"username": "integrator@example.com",
"password": "demo_password"
},
"settings": {
"notification_email": "integrator@example.com",
"event_types": [
"EXTRACTION_FINISHED"
]
}
}),
});
const data = await response.json();import axios from "axios";
const response = await axios({
method: "post",
url: "https://app.datamolino.com/api/webhooks",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer demo_access_token"
},
data: {
"url": "{{webhook_url}}",
"auth_credentials": {
"auth_type": "basic",
"username": "integrator@example.com",
"password": "demo_password"
},
"settings": {
"notification_email": "integrator@example.com",
"event_types": [
"EXTRACTION_FINISHED"
]
}
}
});
console.log(response.data);import requests
url = "https://app.datamolino.com/api/webhooks"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer demo_access_token"
}
payload = {
"url": "{{webhook_url}}",
"auth_credentials": {
"auth_type": "basic",
"username": "integrator@example.com",
"password": "demo_password"
},
"settings": {
"notification_email": "integrator@example.com",
"event_types": [
"EXTRACTION_FINISHED"
]
}
}
response = requests.request("POST", url, headers=headers, json=payload)
response.raise_for_status()
print(response.json())require 'json'
require 'net/http'
uri = URI("https://app.datamolino.com/api/webhooks")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer demo_access_token"
request.body = <<~JSON
{
"url": "{{webhook_url}}",
"auth_credentials": {
"auth_type": "basic",
"username": "integrator@example.com",
"password": "demo_password"
},
"settings": {
"notification_email": "integrator@example.com",
"event_types": [
"EXTRACTION_FINISHED"
]
}
}
JSON
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts JSON.parse(response.body)# app/services/datamolino_client.rb
require 'json'
require 'net/http'
class DatamolinoClient
BASE_URL = "https://app.datamolino.com"
def initialize(access_token: Rails.application.credentials.dig(:datamolino, :access_token))
@access_token = access_token
end
def request_create_a_webhook
uri = URI("#{BASE_URL}/api/webhooks")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer #{@access_token}"
request.body = <<~JSON
{
"url": "{{webhook_url}}",
"auth_credentials": {
"auth_type": "basic",
"username": "integrator@example.com",
"password": "demo_password"
},
"settings": {
"notification_email": "integrator@example.com",
"event_types": [
"EXTRACTION_FINISHED"
]
}
}
JSON
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
JSON.parse(response.body)
end
end<?php
use GuzzleHttp\Client;
$client = new Client();
$response = $client->request('POST', 'https://app.datamolino.com/api/webhooks', [
'headers' => json_decode('{"Content-Type":"application/json","Authorization":"Bearer demo_access_token"}', true),
'json' => json_decode('{"url":"{{webhook_url}}","auth_credentials":{"auth_type":"basic","username":"integrator@example.com","password":"demo_password"},"settings":{"notification_email":"integrator@example.com","event_types":["EXTRACTION_FINISHED"]}}', true)
]);
echo $response->getBody();OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create("{\n \"url\": \"{{webhook_url}}\",\n \"auth_credentials\": {\n \"auth_type\": \"basic\",\n \"username\": \"integrator@example.com\",\n \"password\": \"demo_password\"\n },\n \"settings\": {\n \"notification_email\": \"integrator@example.com\",\n \"event_types\": [\n \"EXTRACTION_FINISHED\"\n ]\n }\n}", MediaType.parse("application/json"));
Request request = new Request.Builder()
.url("https://app.datamolino.com/api/webhooks")
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer demo_access_token")
.method("POST", body)
.build();
Response response = client.newCall(request).execute();using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://app.datamolino.com/api/webhooks");
request.Headers.Add("Authorization", "Bearer demo_access_token");
request.Content = new StringContent("{\n \"url\": \"{{webhook_url}}\",\n \"auth_credentials\": {\n \"auth_type\": \"basic\",\n \"username\": \"integrator@example.com\",\n \"password\": \"demo_password\"\n },\n \"settings\": {\n \"notification_email\": \"integrator@example.com\",\n \"event_types\": [\n \"EXTRACTION_FINISHED\"\n ]\n }\n}", Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());client := &http.Client{}
req, err := http.NewRequest("POST", "https://app.datamolino.com/api/webhooks", strings.NewReader("{\n \"url\": \"{{webhook_url}}\",\n \"auth_credentials\": {\n \"auth_type\": \"basic\",\n \"username\": \"integrator@example.com\",\n \"password\": \"demo_password\"\n },\n \"settings\": {\n \"notification_email\": \"integrator@example.com\",\n \"event_types\": [\n \"EXTRACTION_FINISHED\"\n ]\n }\n}"))
if err != nil { panic(err) }
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer demo_access_token")
res, err := client.Do(req)
if err != nil { panic(err) }
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil { panic(err) }
fmt.Println(string(body))import Foundation
var request = URLRequest(url: URL(string: "https://app.datamolino.com/api/webhooks")!)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("Bearer demo_access_token", forHTTPHeaderField: "Authorization")
request.httpBody = "{\n \"url\": \"{{webhook_url}}\",\n \"auth_credentials\": {\n \"auth_type\": \"basic\",\n \"username\": \"integrator@example.com\",\n \"password\": \"demo_password\"\n },\n \"settings\": {\n \"notification_email\": \"integrator@example.com\",\n \"event_types\": [\n \"EXTRACTION_FINISHED\"\n ]\n }\n}".data(using: .utf8)
let (data, _) = try await URLSession.shared.data(for: request)
print(String(data: data, encoding: .utf8)!)Responses
201 Created
Content type: application/json; charset=utf-8
{
"id": "demo_identifier",
"signature_key": "whsec_demo_signature_key"
}