Webhook URL Setup
Steps to Set Up Your URL
To use the webhook feature, you need to provide a publicly accessible URL. This URL will receive POST requests containing JSON data. Ensure that your server is configured to accept POST requests and process the JSON payload.
- Create an Endpoint: Create a route on your server to handle POST requests.
- Secure Your Endpoint: Add validation mechanisms, such as token-based authentication or IP whitelisting, to ensure only authorized requests are processed.
- Provide the URL: Submit your webhook URL in the designated section of your user dashboard.
Example URL: https://your-domain.com/webhook-endpoint
Data Payload Structure
The webhook will send a JSON payload with the following structure:
{
"x": "xcanner",
"tweets": [
{
"keyword": "keyword_text">,
"text": "tweet_text",
"url": "tweet_url",
"created_at": "tweet_created_at",
"username": "tweet_username",
"sentiment": "sentiment_value",
"type": "tweet_type"
}
]
}
Key Descriptions:
Key | Type | Description |
---|---|---|
x |
String | Identifier for the webhook source (e.g., "xcanner"). |
tweets |
Array | A list of tweet objects matching the monitored keywords. |
Each object in the tweets
array includes:
Key | Type | Description |
---|---|---|
keyword |
String | The keyword that triggered the match. |
text |
String | The text content of the tweet. |
url |
String | The URL of the tweet. |
created_at |
String | The timestamp when the tweet was created. |
username |
String | The username of the tweet author. |
sentiment |
String | The sentiment analysis result (e.g., positive, negative, neutral). |
type |
String | The type of tweet (e.g., original, reply, retweet). |
Example Payload
Below is an example of a webhook payload:
{
"x": "xcanner",
"tweets": [
{
"keyword": "Python">,
"text": "Learning Python is fun!",
"url": "https://twitter.com/example/status/1234567890",
"created_at": "1734501600",
"username": "tech_guru",
"sentiment": "positive",
"type": "original"
}
]
}
Testing Your Webhook
- You can test your webhook by using tools like Postman or Webhook.site.
- Then send a POST request with the example payload to your URL.
Troubleshooting
- Invalid Payload: Ensure your server parses the JSON correctly.
- No Response: Verify that your URL is publicly accessible and accepts POST requests.
- Authentication Errors: Check your authentication logic if implemented.
- For further assistance, contact our support team.