Actions2
Overview
This node integrates with JokeAPI to retrieve jokes either randomly or by a specific joke ID. It supports multilingual and category-based filtering, allowing users to fetch jokes tailored to their preferences. Common use cases include adding humor to chatbots, automating content generation for social media, or simply fetching jokes programmatically for entertainment apps.
For example:
- Fetching a random programming joke in English.
- Retrieving a specific joke by its unique numeric ID.
Properties
Name | Meaning |
---|---|
Operation | The action to perform: "Get Random Joke" or "Get Joke by ID". |
Categories | (Only for "Get Random Joke") Select one or more joke categories to include (e.g., Programming, Dark). Defaults to all if none selected. |
Exclude Categories | (Only for "Get Random Joke") Select categories to exclude from the results. |
Language | (Only for "Get Random Joke") Choose the language of the joke. Options: English, German, Spanish, French, Portuguese, Czech. |
Joke Type | (Only for "Get Random Joke") Choose joke format: "Single" (one-liner) or "Two Part" (setup and delivery). |
Safe Mode | (Only for "Get Random Joke") If enabled, excludes jokes flagged as NSFW, Religious, Political, Racist, Sexist, or Explicit. |
Joke ID | (Only for "Get Joke by ID") Numeric identifier of the joke to retrieve. Required for this operation. |
Output
The node outputs JSON data representing the joke(s) retrieved from JokeAPI. The structure depends on the joke type:
- For single-part jokes, the JSON includes fields like
category
,type
(single),joke
(the text),id
,lang
, etc. - For two-part jokes, it includes
setup
anddelivery
fields instead of a single joke string. - If multiple jokes are returned (in some scenarios), the output is an array of such objects.
No binary data output is produced by this node.
Dependencies
- External API: JokeAPI
- Optional API key credential can be configured but is not mandatory.
- Requires internet access to call the JokeAPI endpoints.
- Uses Axios HTTP client internally for API requests.
Troubleshooting
- Missing Joke ID: When using "Get Joke by ID" operation, if the Joke ID is not provided or zero, the node throws an error indicating that the Joke ID is required.
- Unknown Operation: If an unsupported operation value is set, the node will throw an error specifying the unknown operation.
- API Errors: If JokeAPI returns an error (e.g., invalid ID, no joke found), the node surfaces the error message from the API.
- Network Issues: Failures to reach JokeAPI due to network problems will cause execution errors.
- To handle errors gracefully, enable "Continue On Fail" in the node settings to process subsequent items even if one fails.
Links and References
- JokeAPI Documentation: https://jokeapi.dev/
- JokeAPI GitHub Repository: https://github.com/Sv443/JokeAPI