Blagues API icon

Blagues API

Récupère des blagues françaises depuis Blagues API. Opérations disponibles: getRandom (aléatoire, exclure catégories), getRandomCategorized (aléatoire par catégorie), getById (par ID), getCount (nombre total).

Get Random Categorized Joke

AI-generated

Overview

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.

A common use case is to add humor or lighten up workflows by automatically fetching jokes based on user preferences or categories. For example, you could use it in a chatbot to deliver categorized jokes on demand or in an automated email campaign to include a daily joke.

Specifically, the Get Random Categorized Joke operation fetches a random joke from a selected category like "DARK", "DEV", or "BLONDES".

Properties

Name Meaning
Category The category of the joke to receive. Options: GLOBAL, DEV, DARK, LIMIT, BEAUF, BLONDES. Required.

Output

The node outputs JSON data representing the joke retrieved from the API. The structure typically includes fields such as the joke's text, its ID, category, and possibly other metadata depending on the API response.

No binary data output is produced by this node.

Example output JSON (simplified):

{
  "id": 123,
  "category": "dark",
  "joke": "Why did the chicken cross the road? To get to the other side!"
}

Dependencies

  • Requires an API key credential for the Blagues API.
  • The node uses the external blagues-api npm package to interact with the API.
  • Proper configuration of the API key credential in n8n is necessary for successful execution.

Troubleshooting

  • Missing API Token: If the API key credential is not set or invalid, the node will throw an error indicating the missing token. Ensure the API key is correctly configured in the node credentials.
  • Invalid Category: Selecting a category not recognized by the API will cause an error. Use only the provided categories: GLOBAL, DEV, DARK, LIMIT, BEAUF, BLONDES.
  • Network or API Errors: Failures in reaching the API or unexpected responses will result in errors. Check network connectivity and API service status.
  • Joke Not Found: When using other operations like Get Joke by ID, providing an invalid ID may cause errors or empty results.

Links and References

Discussion