Get by ID
Retrieves a specific GIF from Giphy using its unique ID. This node is essential when you need to fetch a particular GIF that you've previously identified, stored, or referenced.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- ID - The unique Giphy GIF ID. This is a required field and cannot be empty. Example: "FiGiRei2ICzzG" or "3o7btPCcdNniyf0ArS".
Options
- Rating - Content rating filter to restrict results. Options:
- g - Suitable for all audiences (default)
- pg - Parental guidance suggested
- pg-13 - Parents strongly cautioned
- r - Restricted to adults
- API Key - Your Giphy API key credential for authentication. Required for all requests.
Output
- resp - API response object containing:
data- A single GIF object with complete metadata, all image formats, and user informationmeta- API status information
How It Works
The Get by ID node retrieves a specific GIF using its unique identifier:
- Validates that the ID parameter is not empty
- Retrieves authentication credentials from the credential manager
- Constructs API request to Giphy's GIF endpoint with the specific ID
- Sends GET request to retrieve the GIF data
- Parses JSON response containing complete GIF information
- Stores the response in the output variable
Example Usage
Retrieve Known GIF
// Fetch a specific GIF by ID
msg.ID = "FiGiRei2ICzzG";
// After node execution:
let gifUrl = msg.resp.data.images.original.url;
let gifTitle = msg.resp.data.title;
Retrieve from Database
// Get GIF ID from database
let favoriteGifId = database.getUserFavoriteGif(userId);
msg.ID = favoriteGifId;
// After node execution, send to user
sendMessage(msg.resp.data.images.downsized.url);
Validate GIF Exists
// Check if a GIF ID is still valid
msg.ID = storedGifId;
// After node execution:
if (msg.resp.data && msg.resp.data.id) {
msg.gifExists = true;
} else {
msg.gifExists = false;
}
Get Multiple Formats
// Retrieve a GIF and get different size formats
msg.ID = "3o7btPCcdNniyf0ArS";
// After execution, access various formats:
msg.original = msg.resp.data.images.original.url; // Full size
msg.mobile = msg.resp.data.images.downsized.url; // Mobile-friendly
msg.thumbnail = msg.resp.data.images.fixed_height_small.url; // Thumbnail
Batch Processing
// Process array of GIF IDs
let gifIds = ["FiGiRei2ICzzG", "xT9IgDEI1iZyb2wqo8", "3o7btPCcdNniyf0ArS"];
msg.gifDetails = [];
// Use Loop node to iterate through IDs
for (let id of gifIds) {
msg.ID = id;
// Run Get by ID node
msg.gifDetails.push({
id: id,
title: msg.resp.data.title,
url: msg.resp.data.images.original.url
});
}
Common Use Cases
- Favorites System - Retrieve user's favorite GIFs stored by ID in a database
- Content Management - Fetch specific GIFs for scheduled social media posts
- Verification - Validate that stored GIF IDs are still active and accessible
- Deep Linking - Resolve GIF IDs from URLs or QR codes to display content
- Caching - Store GIF IDs instead of URLs (which may change) and retrieve on-demand
- Collections - Build curated GIF collections by storing and retrieving specific IDs
- Attribution - Get complete GIF metadata including creator information
Tips
- Store IDs, Not URLs - GIF IDs are permanent, but URLs may change; always store IDs in your database
- Extract ID from URL - You can extract GIF IDs from Giphy URLs:
https://giphy.com/gifs/ID-HERE - Validate Before Use - Check that
msg.resp.dataexists before accessing properties - Use for Consistency - When you need the exact same GIF every time, use Get by ID instead of Search
- Combine with Search - Search first, store the IDs of good results, then retrieve them later
- Check Rating - Even with a known ID, verify the rating matches your requirements
- Handle Deleted GIFs - Some GIFs may be removed; implement error handling for missing content
Error Handling
The node will return errors in the following cases:
- ErrInvalidArg - ID parameter is empty or missing
- ErrCredentials - API key is missing, invalid, or credential retrieval failed
- ErrRuntime - Network error, API timeout, invalid API response, or GIF not found
Common Errors and Solutions
| Error | Cause | Solution |
|---|---|---|
| ID cannot be empty | No ID provided | Ensure msg.ID is set before the node executes |
| Failed to get API key | Credential not configured | Add Giphy API key to credential manager |
| Failed to call Giphy API | Network/connectivity issue | Check internet connection and retry |
| Failed to decode API response | Invalid API response | Verify GIF ID is correct and still exists |
| 404 Not Found | GIF ID doesn't exist | Verify the ID is correct; GIF may have been deleted |
| 403 Forbidden | Invalid API key | Verify API key is correct and active |
Response Structure
{
"data": {
"type": "gif",
"id": "FiGiRei2ICzzG",
"url": "https://giphy.com/gifs/FiGiRei2ICzzG",
"slug": "funny-cat-FiGiRei2ICzzG",
"bitly_url": "http://gph.is/1bAzL7B",
"embed_url": "https://giphy.com/embed/FiGiRei2ICzzG",
"images": {
"original": {
"url": "https://media.giphy.com/media/FiGiRei2ICzzG/giphy.gif",
"width": "500",
"height": "281",
"size": "245123"
},
"downsized": { ... },
"fixed_height": { ... },
"fixed_width": { ... },
"preview_gif": { ... }
},
"title": "Funny Cat GIF",
"rating": "g",
"create_datetime": "2014-03-15 12:00:00",
"update_datetime": "2024-01-15 08:30:00",
"username": "username",
"user": {
"avatar_url": "...",
"display_name": "User Name",
"username": "username"
}
},
"meta": {
"status": 200,
"msg": "OK",
"response_id": "..."
}
}
Best Practices
- Always validate that the GIF ID is in the correct format (alphanumeric string)
- Implement error handling for cases where GIFs have been removed or deleted
- Store GIF IDs in your database rather than full URLs for long-term reliability
- Use this node in combination with search to build curated content libraries
- Cache retrieved GIF data if you'll be accessing the same GIF multiple times
- Consider the different image formats available and choose appropriate ones for your use case
- Respect user privacy when storing user-selected GIF IDs
Available Image Formats
When you retrieve a GIF by ID, the response includes multiple image formats:
- original - Full resolution GIF
- downsized - Smaller file size for faster loading
- fixed_height - Standardized height for consistent layouts
- fixed_width - Standardized width for consistent layouts
- fixed_height_small - Thumbnail size with fixed height
- fixed_width_small - Thumbnail size with fixed width
- preview_gif - Very small preview for quick loading
- downsized_still - Static image (first frame)
Choose the appropriate format based on your use case to optimize performance and user experience.