Get Random Joke
AI-generatedOverview
This node integrates with the "Blagues API" to retrieve French jokes. It supports multiple operations such as fetching a random joke, fetching a random joke from a specific category, retrieving a joke by its ID, and getting the total count of jokes available. This node is useful for automating humor content in workflows, such as sending daily jokes via messaging platforms, enriching chatbots with humor, or creating entertainment-based automation.
Practical examples:
- Automatically fetch and post a random joke excluding certain categories to a social media channel.
- Retrieve a joke from a specific category (e.g., developer jokes) to include in a newsletter.
- Get a joke by its unique ID for referencing or reposting.
- Obtain the total number of jokes available to monitor content size or for pagination purposes.
Properties
| Name | Meaning |
|---|---|
| Operation | The action to perform. Options: "Get Random Joke", "Get Random Categorized Joke", "Get Joke by ID", "Get Joke Count". |
| Disallowed Categories | (Only for "Get Random Joke") Categories of jokes to exclude from the random selection. Available categories: GLOBAL, DEV, DARK, LIMIT, BEAUF, BLONDES. Provide as an array of category names. |
| Category | (Only for "Get Random Categorized Joke") The category from which to fetch a random joke. Available categories: GLOBAL, DEV, DARK, LIMIT, BEAUF, BLONDES. |
| Joke ID | (Only for "Get Joke by ID") Numeric identifier of the joke to retrieve. |
Output
The node outputs JSON data representing the joke(s) retrieved from the API. The structure depends on the operation:
- For joke retrieval operations (
getRandom,getRandomCategorized,getById), the output contains joke details such as the joke text, category, and possibly other metadata as returned by the Blagues API. - For the
getCountoperation, the output contains the total number of jokes available.
The output is always returned as an array of JSON objects, one per input item processed.
The node does not output binary data.
Dependencies
- Requires an API key credential for the Blagues API to authenticate requests.
- Uses the external
blagues-apinpm package to interact with the Blagues API. - Requires proper configuration of the API key credential within n8n.
Troubleshooting
- Missing API Token: If the API key credential is not set or missing, the node will throw an error indicating that the API token is missing. Ensure the API key is correctly configured in the node credentials.
- Invalid Category: When using the "Get Random Categorized Joke" operation, providing an invalid category name will cause an error. Use only the supported categories listed in the properties.
- Missing Required Parameters: Operations like "Get Joke by ID" require the joke ID parameter; omitting it will result in an error.
- API Errors: Network issues or invalid API keys may cause request failures. Check connectivity and credential validity.
- Continue On Fail: If enabled, the node will continue processing subsequent items even if some fail, returning error details in the output.
Links and References
- Blagues API GitHub Repository (for more info about the joke API)
- n8n Documentation (for general usage of custom nodes and credentials)