Webhooks
Add an endpoint
Adds an endpoint that Postploy calls when the events you pick happen. A team can have up to 10.
The response holds the endpoint’s signing secret. It’s shown only this once, so store it now. You need it to verify requests.
POST
/
webhooks
Add an endpoint
curl --request POST \
--url https://api.postploy.com/public/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/postploy/webhooks",
"events": [
"post.published",
"post.failed"
],
"description": "Posts to our Slack"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/postploy/webhooks',
events: ['post.published', 'post.failed'],
description: 'Posts to our Slack'
})
};
fetch('https://api.postploy.com/public/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.postploy.com/public/v1/webhooks"
payload = {
"url": "https://example.com/postploy/webhooks",
"events": ["post.published", "post.failed"],
"description": "Posts to our Slack"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "9d8c7b6a-5f4e-4d3c-a2b1-0f9e8d7c6b5a",
"url": "https://example.com/postploy/webhooks",
"description": "Posts to our Slack",
"events": [
"post.published",
"post.failed"
],
"enabled": true,
"disabledReason": null,
"createdAt": "2030-01-10T12:00:00.000Z",
"secret": "whsec_3q2-7wEXAMPLEsecretDoNotUse_Kd9vL0pQ"
}
}{
"statusCode": 400,
"message": "Scheduled date and time must be in the future",
"errors": [
{
"message": "Scheduled date and time must be in the future",
"path": [
"posts",
0,
"scheduledAt"
],
"cause": "custom"
}
],
"timestamp": "2030-01-10T12:00:00.000Z",
"route": "/public/v1/posts"
}{
"statusCode": 401,
"message": "Invalid API key",
"errors": null,
"timestamp": "2030-01-10T12:00:00.000Z",
"route": "/public/v1/accounts"
}{
"statusCode": 123,
"message": "<string>",
"errors": [
{
"message": "<string>",
"path": [
"<string>"
],
"cause": "<string>",
"code": "<string>",
"platform": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z",
"route": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"errors": [
{
"message": "<string>",
"path": [
"<string>"
],
"cause": "<string>",
"code": "<string>",
"platform": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z",
"route": "<string>"
}Authorizations
Body
application/json
⌘I
Add an endpoint
curl --request POST \
--url https://api.postploy.com/public/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/postploy/webhooks",
"events": [
"post.published",
"post.failed"
],
"description": "Posts to our Slack"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com/postploy/webhooks',
events: ['post.published', 'post.failed'],
description: 'Posts to our Slack'
})
};
fetch('https://api.postploy.com/public/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.postploy.com/public/v1/webhooks"
payload = {
"url": "https://example.com/postploy/webhooks",
"events": ["post.published", "post.failed"],
"description": "Posts to our Slack"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"id": "9d8c7b6a-5f4e-4d3c-a2b1-0f9e8d7c6b5a",
"url": "https://example.com/postploy/webhooks",
"description": "Posts to our Slack",
"events": [
"post.published",
"post.failed"
],
"enabled": true,
"disabledReason": null,
"createdAt": "2030-01-10T12:00:00.000Z",
"secret": "whsec_3q2-7wEXAMPLEsecretDoNotUse_Kd9vL0pQ"
}
}{
"statusCode": 400,
"message": "Scheduled date and time must be in the future",
"errors": [
{
"message": "Scheduled date and time must be in the future",
"path": [
"posts",
0,
"scheduledAt"
],
"cause": "custom"
}
],
"timestamp": "2030-01-10T12:00:00.000Z",
"route": "/public/v1/posts"
}{
"statusCode": 401,
"message": "Invalid API key",
"errors": null,
"timestamp": "2030-01-10T12:00:00.000Z",
"route": "/public/v1/accounts"
}{
"statusCode": 123,
"message": "<string>",
"errors": [
{
"message": "<string>",
"path": [
"<string>"
],
"cause": "<string>",
"code": "<string>",
"platform": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z",
"route": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"errors": [
{
"message": "<string>",
"path": [
"<string>"
],
"cause": "<string>",
"code": "<string>",
"platform": "<string>"
}
],
"timestamp": "2023-11-07T05:31:56Z",
"route": "<string>"
}