Send a test event
Beta POST /v1/monitors/{monitor_id}/test
POST /v1/monitors/{monitor_id}/test
Send a signed test event ("type": "test") to the monitor's webhook now and report what the receiver answered. Free; nothing is stored.
- Cost: Free
- Status: Beta. Built and tested against recorded responses; the shape may still gain fields.
- Cache: Not cached.
Parameters#
| Name | Type | Required | Description | In |
|---|---|---|---|---|
monitor_id | string | yes | Monitor id. | path |
Example request#
Set your key in the environment first (see Authentication).
curl
curl -X POST "https://api.socialscrape.io/v1/monitors/mon_0123456789abcdef/test" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY"Python
import os
import requests
res = requests.post(
"https://api.socialscrape.io/v1/monitors/mon_0123456789abcdef/test",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])TypeScript
const res = await fetch("https://api.socialscrape.io/v1/monitors/mon_0123456789abcdef/test", {
method: "POST",
headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();
if (body.ok) {
console.log(body.data);
} else {
console.error(body.error.code, body.error.message);
}Example response#
This is a sample with illustrative values. Status 200.
{
"ok": true,
"credits_charged": 0,
"credits_remaining": 5000,
"cached": false,
"cached_at": null,
"request_id": "req_125748a7f0deee6f71dc2c2a",
"data": {
"object": "webhook_test",
"monitor_id": "mon_0123456789abcdef",
"delivered": true,
"status_code": 200,
"error": null
},
"cursor": null,
"has_more": null
}Response#
A WebhookTest object in data.
See Data models for every field. The envelope around data is described in Responses.
Errors#
Failures are free: credits_charged is 0. Branch on error.code, never on the message.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
Every request can also fail with the account and platform errors listed on the Errors page.
Related endpoints#
- Create a monitor (
POST /v1/monitors) - List monitors (
GET /v1/monitors) - Delete a monitor (
DELETE /v1/monitors/{monitor_id}) - Webhook delivery log (
GET /v1/monitors/{monitor_id}/deliveries) - Send an event again (
POST /v1/monitors/events/{event_id}/redeliver) - Monitor events (
GET /v1/monitors/events)