Connect Retool to IBM Watson using a REST API Resource with IBM Cloud IAM token authentication. Generate an IAM access token from your IBM Cloud API key, configure it as a Bearer token in Retool, and build enterprise NLP dashboards that process customer feedback through Watson NLU, manage assistant conversations via Watson Assistant, or run discovery queries through Watson Discovery — all combining Watson's AI outputs with your internal data.
| Fact | Value |
|---|---|
| Tool | IBM Watson |
| Category | AI/ML |
| Method | REST API Resource |
| Difficulty | Intermediate |
| Time required | 30 minutes |
| Last updated | April 2026 |
Build Enterprise NLP Dashboards Powered by IBM Watson in Retool
IBM Watson offers some of the most specialized enterprise NLP capabilities available: Watson Natural Language Understanding (NLU) excels at structured analysis — extracting entities, relations, sentiment, and categories from unstructured text with configurable models. Watson Assistant provides conversational AI that enterprises use for customer service bots. Watson Discovery enables cognitive search across large document collections. Building internal tools that leverage these capabilities alongside operational data is exactly what Retool is designed for.
With a Retool-IBM Watson integration, you can build a customer feedback analysis dashboard that runs support tickets through Watson NLU, extracting sentiment scores and key entities, then combines those AI outputs with ticket status and customer tier data from your CRM. You can build a Watson Discovery query panel where operations teams search internal knowledge bases using natural language, or a Watson Assistant monitoring dashboard that tracks conversation performance metrics and failure points.
The primary integration challenge with IBM Watson is IAM authentication: unlike simple API key headers, IBM Cloud uses short-lived Bearer tokens that must be exchanged from an API key using a separate token endpoint. Retool's Custom Auth feature handles this exchange pattern cleanly. Once configured, querying Watson services works identically to any other REST API Resource in Retool.
Integration method
IBM Watson services are accessed via IBM Cloud's REST APIs, each service having its own base URL that includes the service instance ID. Authentication uses IBM Cloud IAM: you generate an API key from IBM Cloud IAM, exchange it for a short-lived Bearer token via IBM Cloud's token endpoint, and include that token in all Watson API requests. In Retool, you configure a REST API Resource per Watson service (NLU, Assistant, Discovery) with Custom Auth to handle the IAM token exchange automatically. All requests proxy through Retool's server-side infrastructure, keeping IBM API keys off the browser.
Prerequisites
- An IBM Cloud account with Watson services provisioned (NLU, Assistant, or Discovery)
- An IBM Cloud API key generated from IAM → Manage → API keys with access to your Watson service instances
- The service URL for each Watson service instance (found in IBM Cloud → Resource List → select your Watson service → Credentials)
- A Retool account with permission to create Resources
- Basic familiarity with IBM Watson services and which service covers your use case (NLU, Assistant, Discovery)
Step-by-step guide
Generate an IBM Cloud API key and locate Watson service credentials
IBM Cloud uses IAM (Identity and Access Management) for authentication across all Watson services. You will generate an IBM Cloud API key that Retool uses to obtain short-lived access tokens. Log in to IBM Cloud at https://cloud.ibm.com and click 'Manage' in the top navigation, then select 'Access (IAM)'. In the IAM dashboard left sidebar, click 'API keys' under 'IBM Cloud API keys'. Click 'Create an IBM Cloud API key'. Give it a descriptive name such as 'Retool-Watson-Integration' and an optional description. Click Create — IBM Cloud displays the API key value once. Copy it immediately and store it securely; you cannot retrieve it again after closing this dialog. Next, locate your Watson service credentials. In IBM Cloud, click 'Resource List' in the navigation. Find your Watson service instance (e.g., 'Natural Language Understanding-xyz'). Click on it to open the service details. Click 'Credentials' in the left sidebar, then 'New credential' if no credentials exist. Expand the credential to view the API key (specific to this service instance) and the URL. Note the service URL — it has the format https://{region}.ml.cloud.ibm.com for NLU, https://api.{region}.assistant.watson.cloud.ibm.com for Assistant, and https://api.{region}.discovery.watson.cloud.ibm.com for Discovery. Copy the service URL for each Watson service you plan to use.
Pro tip: IBM Cloud has two types of API keys: account-level IAM API keys (manage → access → API keys) and service-specific API keys embedded in service credentials. Either works for authentication, but the account-level IAM key is more flexible if you plan to query multiple Watson services from Retool.
Expected result: You have an IBM Cloud API key and the service URL for each Watson service you plan to integrate with Retool.
Configure IBM Cloud IAM token exchange in Retool using Custom Auth
IBM Cloud IAM requires exchanging your API key for a short-lived Bearer token before making Watson API calls. This token expires after 60 minutes and must be refreshed. Retool's Custom Auth feature handles this pattern cleanly. In Retool, click the Resources tab and then Add Resource. Select REST API. Name the resource for your specific Watson service, for example 'Watson NLU'. In the Base URL field, enter the service URL for that Watson instance (e.g., https://us-south.ml.cloud.ibm.com). Scroll to Authentication and select 'Custom Auth' from the dropdown. In the Custom Auth Login steps, add a 'Make request' step: set the URL to https://iam.cloud.ibm.com/identity/token, Method to POST, set Content-Type header to application/x-www-form-urlencoded, and the body to: grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey={{ YOUR_IBM_API_KEY }} (replace with your actual key or a Configuration Variable reference). Add a second step 'Parse response' and extract access_token from the JSON response body. Add a third step 'Set headers' and set Authorization to Bearer {{ access_token }}. In the 'When to refresh auth' section, set the refresh trigger to 'On 401 response' and also set a proactive refresh interval of 50 minutes (since tokens expire after 60 minutes). Save the resource. This setup means Retool automatically obtains and refreshes IBM IAM tokens transparently before making Watson API calls.
1// Custom Auth Step 1: Exchange IBM API key for IAM access token2// Method: POST3// URL: https://iam.cloud.ibm.com/identity/token4// Content-Type: application/x-www-form-urlencoded5// Body:6grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey={{ retoolContext.configVars.IBM_API_KEY }}Pro tip: Store your IBM API key in Retool Configuration Variables (Settings → Configuration Variables) as a secret named IBM_API_KEY. Reference it in the Custom Auth body as {{ retoolContext.configVars.IBM_API_KEY }} rather than embedding the key directly in the auth configuration.
Expected result: The Watson NLU REST API Resource is configured with Custom Auth that automatically exchanges your IBM API key for a Bearer token. The resource is ready for Watson API queries.
Build a Watson NLU sentiment analysis query
Create your first Watson NLU query to verify the connection and build the core analysis capability. In a Retool app, open the Code panel and click + to add a new query. Select your Watson NLU resource. Name the query 'analyzeText'. Set the Method to POST. For the Path, enter /v1/analyze with a URL parameter 'version' set to 2023-04-15 (or check the Watson NLU documentation for the current version date). Set the Body Type to JSON. In the Body field, construct the analysis request: the 'text' field contains the text to analyze (bind this to a Multiline Text Input component or a database record's text field), and the 'features' object specifies what to extract. A standard configuration requests sentiment (document-level and targeted), entities (with limit 10 and sentiment analysis enabled), keywords (with limit 10 and sentiment enabled), and categories. Run the query with a sample text to verify the response. The response includes document-level sentiment (label: 'positive'/'negative'/'neutral', score: -1 to 1), a list of extracted entities with type, text, sentiment, and relevance, and a list of keywords with relevance scores. Add a JavaScript transformer to extract the most useful fields from the nested response structure for display in Retool Tables.
1{2 "text": {{ JSON.stringify(textInput.value || 'Sample text to analyze') }},3 "features": {4 "sentiment": {5 "document": true6 },7 "entities": {8 "limit": 10,9 "sentiment": true10 },11 "keywords": {12 "limit": 10,13 "sentiment": true14 },15 "categories": {16 "limit": 517 }18 },19 "language": "en"20}Pro tip: Watson NLU bills per API call and per feature used. For dashboards processing large volumes of text, limit the features to only what your use case requires — requesting all features on every call significantly increases costs.
Expected result: The analyzeText query successfully returns Watson NLU analysis results including document sentiment score, extracted entities, and keywords for the input text.
Build the NLP analytics dashboard UI
Assemble the dashboard components around the Watson NLU query. From the component panel, drag a Multiline Text Input onto the canvas for direct text analysis — name it 'textInput'. Drag a Button below it labeled 'Analyze Text' that triggers the analyzeText query on click. Add Statistic components to show the document-level sentiment: one for sentiment label ({{ analyzeText.data.sentiment?.document?.label || 'N/A' }}) and one for sentiment score formatted as a percentage. Drag a Table component and set its data to display the extracted entities: bind to a transformer that formats analyzeText.data.entities into rows with columns for text, type, and sentiment label. Add a second Table for keywords with relevance score. To build a batch analysis workflow — processing multiple texts from a database — create a second query named 'getTicketsForAnalysis'. Configure it to query your PostgreSQL database for support tickets. Then create a JavaScript query named 'batchAnalyze' that iterates through the tickets and calls Watson NLU for each one using .trigger() with text parameters. Collect results into an array and display them in a results Table. Note that batch processing many texts synchronously can be slow — for large batches, use Retool Workflows with a Loop block to process tickets asynchronously and store results back in your database. Add a Chart component showing sentiment distribution across the batch results using a Bar chart configured with 'positive', 'neutral', 'negative' as the x-axis categories and count as the y-axis.
1// Transformer: format Watson NLU entities for Table display2const entities = data.entities || [];3return entities4 .sort((a, b) => b.relevance - a.relevance)5 .map(entity => ({6 text: entity.text,7 type: entity.type,8 relevance: (entity.relevance * 100).toFixed(0) + '%',9 sentiment: entity.sentiment?.label || 'neutral',10 sentiment_score: entity.sentiment?.score?.toFixed(3) || '0.000',11 count: entity.count || 112 }));Pro tip: Add a Select component populated with records from your database (support tickets, reviews, survey responses) and bind the analyzeText query's text parameter to the selected record's text field. This allows one-click analysis of any database record without manual copy-pasting.
Expected result: A Watson NLU analytics dashboard displays sentiment scores, entity extractions, and keyword analysis for any text input, with batch analysis capability for processing database records through Watson.
Extend to Watson Discovery or Watson Assistant
For teams using Watson Discovery or Watson Assistant, create additional REST API Resources following the same IAM auth pattern. Watson Discovery queries are sent as POST requests to /v2/projects/{project_id}/query with a JSON body specifying the natural language query, count (number of results), and passages configuration (to extract relevant text excerpts). The project_id is found in your Watson Discovery service dashboard. Create a query in Retool with Method POST, the Discovery service URL as the resource base, and configure the query body to bind the natural language query text to a Text Input component. Watson Assistant monitoring queries use GET requests to /v2/assistants/{assistant_id}/logs to retrieve conversation logs. The assistant_id is found in your Watson Assistant service settings under 'API details'. Create a query in Retool that retrieves logs with pagination, and add a transformer that extracts session ID, primary intent, confidence score, and conversation outcome from the nested log structure. Add a Chart tracking daily session counts and intent recognition rates. For complex integrations involving multiple Watson services, custom IAM token management, and Retool Workflows that automate batch NLP processing across large document collections, RapidDev's team can help architect and build your Retool AI operations platform.
1// Watson Discovery query request body2{3 "query": {{ JSON.stringify(searchInput.value) }},4 "count": 10,5 "passages": {6 "enabled": true,7 "count": 3,8 "fields": ["text", "body"],9 "characters": 40010 },11 "highlight": true12}Pro tip: Watson Discovery and Watson NLU have different service URLs and separate IAM credentials per service instance. Create a separate Retool REST API Resource for each Watson service — do not attempt to use a single resource with path-based service routing.
Expected result: Additional Retool Resources are configured for Watson Discovery and/or Watson Assistant, enabling a comprehensive IBM Watson operations dashboard covering NLU, Discovery search, and Assistant analytics.
Common use cases
Build a customer feedback sentiment analysis dashboard
Create a Retool panel that reads customer feedback text from your database (support tickets, survey responses, product reviews), sends each piece of text to Watson NLU's analyze endpoint, and displays the resulting sentiment scores, extracted entities, and detected keywords in structured Tables and Charts. Filter feedback by sentiment score ranges to surface the most critical negative feedback quickly. Combine Watson's entity extraction with your internal customer data to show which product features generate the most negative sentiment.
Build a Retool dashboard that retrieves the 50 most recent support tickets from a PostgreSQL database, sends each ticket body to the Watson NLU API for sentiment analysis and entity extraction, and displays the results in a Table with columns for ticket ID, sentiment label, sentiment score, and top extracted entities. Add a Chart showing sentiment distribution by product category.
Copy this prompt to try it in Retool
Build a Watson Discovery knowledge base search panel
Create a Retool search interface that allows operations teams to query internal documents indexed in Watson Discovery using natural language. Display search results with relevance scores, document excerpts, and passage-level answers. Add filters for document type, date range, and confidence score. This gives teams a powerful semantic search capability over internal knowledge bases, policies, or technical documentation without needing to understand Watson Discovery's query syntax.
Build a Retool search panel that takes a natural language query from a Text Input component, sends it to Watson Discovery via the /v2/projects/{project_id}/query endpoint, and displays the top 10 results in a Table with columns for document title, relevance score, and answer passage. Include confidence score filters and a document preview panel for the selected result.
Copy this prompt to try it in Retool
Build a Watson Assistant conversation analytics monitor
Create a Retool monitoring dashboard that queries Watson Assistant logs to track conversation performance — session counts, intent recognition rates, dialog node traversal patterns, and fallback rates. Display conversation volume trends using Charts and surface frequent fallback patterns that indicate gaps in assistant training. Combine conversation analytics with support ticket data to correlate assistant failure rates with incoming support volume.
Build a Retool Watson Assistant analytics panel that queries the /v2/assistants/{assistant_id}/skills/{skill_id}/statistics endpoint for conversation metrics and displays Charts for daily session counts, top 10 recognized intents, and fallback trigger rate over time. Add a Table of recent conversation logs with session ID, primary intent, and conversation outcome.
Copy this prompt to try it in Retool
Troubleshooting
All Watson API requests return 401 Unauthorized despite using the correct API key
Cause: Watson services use IBM Cloud IAM Bearer tokens, not API keys directly in request headers. The API key must first be exchanged for an access token via the IAM token endpoint. If the Custom Auth step is not correctly configured or the token exchange is failing, all requests will be unauthorized.
Solution: Verify the Custom Auth configuration: the token exchange POST request goes to https://iam.cloud.ibm.com/identity/token with Content-Type application/x-www-form-urlencoded and body grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=YOUR_KEY. In Retool's Custom Auth settings, add a debug step to log the token exchange response. Check that the access_token field is being correctly extracted and set as the Bearer token header. Also verify the IBM API key itself is valid by testing the token exchange with a curl command.
1curl -X POST 'https://iam.cloud.ibm.com/identity/token' \2 -H 'Content-Type: application/x-www-form-urlencoded' \3 -d 'grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=YOUR_API_KEY'Watson NLU returns 'feature not available for the specified language' error
Cause: Not all Watson NLU features are available for all languages. Features like sentiment, emotions, and categories have different language support matrices. Specifying unsupported features for a detected language causes this error.
Solution: Add an explicit 'language' field to the NLU request body set to 'en' (or your target language). Review IBM's Watson NLU language support documentation to confirm which features are available for your target language. Remove unsupported features from the 'features' request object — for languages other than English, often only entities and keywords have full support while categories and semantic roles may be limited.
Watson API returns 'not found' for service URL — 404 on all requests
Cause: Each Watson service instance has its own unique URL that includes the region and instance identifier. Using a generic Watson URL rather than the specific instance URL causes 404 errors.
Solution: In IBM Cloud, navigate to Resource List → select your Watson service instance → Credentials. Expand a credential set to view the 'url' field — this is the correct base URL for that specific instance. For Watson NLU, it looks like https://api.us-south.natural-language-understanding.watson.cloud.ibm.com/instances/your-instance-id. Copy this exact URL and set it as the Retool resource's Base URL.
IAM access token expires mid-session causing query failures after 60 minutes
Cause: IBM Cloud IAM access tokens expire after 60 minutes. If Retool's Custom Auth is not configured to proactively refresh the token, queries start failing with 401 errors when the token expires.
Solution: In the Retool Resource Custom Auth settings, set the token refresh to trigger both 'On 401 response' (reactive refresh) and on a proactive 50-minute interval. Retool will re-run the token exchange auth steps automatically. If proactive refresh is not available in your Retool version, configure the 'On 401 response' trigger and set a short query retry setting so one failed request automatically retries after token refresh.
Best practices
- Store your IBM Cloud API key in Retool Configuration Variables as a secret (Settings → Configuration Variables) rather than embedding it in Custom Auth steps directly — this enables rotation without reconfiguring the resource
- Create one Retool REST API Resource per Watson service (separate resources for NLU, Discovery, and Assistant) since each service has its own unique base URL and may have different authentication scope requirements
- Limit Watson NLU feature requests to only what your use case requires — each additional feature (sentiment, entities, categories, emotion, semantic roles) increases per-call cost and latency
- For batch text analysis, use Retool Workflows with a Loop block rather than in-app JavaScript loops — Workflows handle large batches reliably with configurable retries and don't block the user interface
- Cache Watson analysis results in your database by storing the analysis output alongside the original text record — this avoids re-analyzing the same content on every dashboard load and reduces Watson API costs significantly
- Monitor IBM Cloud usage dashboards regularly when processing large volumes of text through Watson NLU or Discovery — unexpected spikes in API calls can lead to significant costs
- Test Watson NLU feature requests with small text samples in the Retool query editor before building batch processing workflows to verify the response structure matches your transformer expectations
Alternatives
OpenAI's API is a better choice for generative text tasks and flexible NLP where you need free-form responses — Watson NLU is better when you need structured, categorized analysis outputs with entity types and confidence scores.
Google Cloud Natural Language API offers similar NLP capabilities to Watson NLU with simpler authentication (service account JSON key) — a good alternative if your team is already in the Google Cloud ecosystem.
Azure Cognitive Services Text Analytics provides sentiment analysis and entity recognition comparable to Watson NLU, with Azure AD service principal authentication — preferred for teams using Microsoft's cloud infrastructure.
Frequently asked questions
Does Retool have a native IBM Watson connector?
No, Retool does not have a native IBM Watson connector. You connect Watson services via a REST API Resource using IBM Cloud IAM token authentication with Retool's Custom Auth feature. Each Watson service (NLU, Assistant, Discovery) requires its own REST API Resource with the service-specific base URL obtained from the service credentials in IBM Cloud.
How does IBM Cloud IAM authentication work with Retool?
IBM Cloud IAM issues short-lived Bearer tokens (valid 60 minutes) that must be obtained by exchanging an IBM Cloud API key via a POST request to https://iam.cloud.ibm.com/identity/token. Retool's Custom Auth feature handles this exchange: you configure auth steps that make the token exchange request, extract the access_token from the response, and set it as the Bearer token header for all subsequent Watson API requests. Retool automatically re-runs these steps when the token expires.
What is the difference between Watson NLU, Watson Discovery, and Watson Assistant?
Watson NLU (Natural Language Understanding) analyzes unstructured text to extract structured information: sentiment, entities, keywords, categories, and relationships. Watson Discovery is a cognitive search and document understanding service that indexes large document collections and enables natural language querying across them. Watson Assistant is a conversational AI platform for building chatbots and virtual agents. Each service has its own API base URL, version parameters, and capabilities — Retool connects to each as a separate REST API Resource.
How much does Watson NLU cost for a Retool integration?
IBM Watson NLU pricing is based on the number of NLU items processed (1 item = 10,000 characters or fraction thereof) and the features requested. IBM offers a free tier of 30,000 NLU items per month. Beyond the free tier, pricing varies by region and volume — check IBM Cloud's current pricing page for current rates. To manage costs in Retool, cache Watson analysis results in your database rather than re-analyzing the same text on every dashboard load.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation