Set Global Webhook URL - API Reference
Used to set webhook URL that will be used for all monitors that don’t have a monitor-specific webhook_url
set
POST https://api.socialdata.tools/user/webhook
Headers
Authorization string required
Authorization Bearer header containing your SocialData API key
Example: Bearer YOUR_API_KEY
Body
url string required
New webhook URL that will be used for all monitors that don't have an individual webhook_url set
Example: https://my-website.com/webhook
Code Examples
curl -X POST "https://api.socialdata.tools/user/webhook" -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{"url": "https://my-website.com/webhook"}'
const API_KEY = 'YOUR_API_KEY_HERE';const webhookUrl = 'https://my-website.com/webhook';
fetch('https://api.socialdata.tools/user/webhook', { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify({ url: webhookUrl })}).then(response => response.json()).then(response => console.log(response)).catch(err => console.error(err));
import requests
API_KEY = 'YOUR_API_KEY_HERE'webhook_url = 'https://my-website.com/webhook'
url = 'https://api.socialdata.tools/user/webhook'
headers = { 'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json', 'Accept': 'application/json'}
payload = {'url': webhook_url}
response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200: data = response.json() print(data)else: print(f"Error: {response.status_code}") print(response.text)
$API_KEY = 'YOUR_API_KEY_HERE';$webhook_url = 'https://my-website.com/webhook';
$url = "https://api.socialdata.tools/user/webhook";
$ch = curl_init();
curl_setopt_array($ch, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode(['url' => $webhook_url]), CURLOPT_HTTPHEADER => [ "Authorization: Bearer $API_KEY", "Content-Type: application/json", "Accept: application/json" ]]);
$response = curl_exec($ch);$data = json_decode($response, true);print_r($data);
curl_close($ch);
Example Responses
{ "status": "success", "message": "Webhook URL updated"}
{ "status": "error", "message": "Not found"}
Response Codes
- 200 OK - request succeeded
- 404 Not Found - requested tweet does not exist
- 422 Unprocessable Content - validation failed (e.g. one of the required parameters was not provided)
- 500 Internal Error - API internal error, typically means that SocialData API failed to obtain the requested information and you should try again later