Search Gifs
Searches for GIFs on Giphy using a query term or phrase. This node returns a collection of GIFs matching your search criteria, with support for pagination, rating filters, and multi-language results.
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
- Q - Search query term or phrase. This is a required field and cannot be empty. Use specific keywords for better results (e.g., "happy cat" instead of just "cat").
Options
- Limit - The maximum number of GIFs to return. Default: 25. Maximum recommended: 50. Higher values may impact performance.
- Offset - Results offset for pagination. Default: 0. Use this with Limit to implement pagination (e.g., Offset=25 and Limit=25 for page 2).
- 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
- Language - Language code for localized results. Default: en (English). Supports 30+ languages including es, fr, de, ja, zh-CN, pt, and more.
- Bundle - Rendering optimization type. Options:
- Efficient Clip Grid - Optimized for grid display of video clips
- Quick GIFs - Fast-loading GIFs for messaging (default)
- Efficient Sticker Layering - Optimized for sticker overlays
- Low Data Usage GIFs - Smaller file sizes for bandwidth-constrained environments
- API Key - Your Giphy API key credential for authentication. Required for all requests.
Output
- resp - API response object containing:
data- Array of GIF objects with URLs, metadata, and user informationpagination- Object with total_count, count, and offsetmeta- API status information
How It Works
The Search Gifs node queries the Giphy API with your search term and returns matching GIFs:
- Validates that the search query is not empty
- Retrieves authentication credentials from the credential manager
- Constructs API request with query parameters (search term, limit, offset, rating, language, bundle)
- Sends GET request to Giphy's search endpoint
- Parses JSON response and stores it in the output variable
- Each GIF object in the response includes multiple URL formats (original, downsized, preview, etc.)
Example Usage
Basic Search
// Search for cat GIFs
msg.Q = "funny cats";
// After node execution, access results:
// msg.resp.data[0].images.original.url - First GIF URL
// msg.resp.pagination.total_count - Total results available
Paginated Search
// Get first page
msg.Limit = 10;
msg.Offset = 0;
// Run search...
// Get second page
msg.Offset = 10;
// Run search again...
Filtered Search
// Search with specific filters
msg.Q = "birthday celebration";
msg.Limit = 20;
msg.Rating = "g"; // Family-friendly only
msg.Language = "es"; // Spanish results
Extract GIF URLs
// After search, extract all GIF URLs
let gifUrls = msg.resp.data.map(gif => gif.images.original.url);
msg.gifList = gifUrls;
Common Use Cases
- Social Media Content - Find relevant GIFs for automated social media posts based on trending topics or keywords
- Email Campaigns - Search for GIFs that match campaign themes (e.g., "holiday sale", "thank you")
- Chatbot Responses - Return contextual GIFs based on user input or conversation sentiment
- Content Curation - Build libraries of GIFs organized by category or theme
- A/B Testing - Search for different GIF styles to test engagement in marketing materials
Tips
- Be Specific - Use detailed search terms (e.g., "dog playing piano" vs "dog") for more relevant results
- Use Multiple Keywords - Combine 2-3 keywords for better targeting (e.g., "excited happy dance")
- Check Total Count - Use
msg.resp.pagination.total_countto know if more results are available - Implement Retry Logic - Add error handling for network issues or rate limit errors
- Cache Popular Searches - Store frequently searched GIF URLs to reduce API calls
- Test Different Ratings - The same search term may yield different results with different rating filters
- Language Matters - Some search terms work better in certain languages (e.g., "kawaii" in Japanese)
Error Handling
The node will return errors in the following cases:
- ErrInvalidArg - Query parameter is empty or missing
- ErrCredentials - API key is missing, invalid, or credential retrieval failed
- ErrRuntime - Network error, API timeout, or invalid API response
- Rate Limit Exceeded - Too many requests sent to Giphy API (check your usage limits)
Common Errors and Solutions
| Error | Cause | Solution |
|---|---|---|
| Query cannot be empty | No search term provided | Ensure msg.Q 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 | Check API key validity and Giphy service status |
| 403 Forbidden | Invalid API key | Verify API key is correct and active |
| 429 Too Many Requests | Rate limit exceeded | Implement rate limiting or upgrade API plan |
Response Structure
{
"data": [
{
"type": "gif",
"id": "FiGiRei2ICzzG",
"url": "https://giphy.com/gifs/...",
"images": {
"original": {
"url": "https://media.giphy.com/media/.../giphy.gif",
"width": "500",
"height": "281"
},
"downsized": { ... },
"fixed_height": { ... },
"preview_gif": { ... }
},
"title": "Funny Cat GIF",
"rating": "g",
"user": { ... }
}
],
"pagination": {
"total_count": 157,
"count": 25,
"offset": 0
},
"meta": {
"status": 200,
"msg": "OK"
}
}
Best Practices
- Always validate that
msg.resp.datais not empty before accessing GIF data - Use try-catch blocks when processing response data to handle unexpected formats
- Store GIF IDs rather than URLs for long-term storage (URLs may change)
- Implement pagination when dealing with popular search terms that return many results
- Use the preview or downsized image URLs for thumbnails to save bandwidth
- Monitor your API usage to avoid hitting rate limits
- Consider implementing a local cache for frequently requested searches