Description
Overview
This country code lookup automation workflow enables real-time retrieval of country information via a no-code integration pipeline. Designed for developers and system integrators, it resolves country details including name, phone calling code, and flag emoji from a standardized country code input. The workflow is initiated by an HTTP webhook trigger that accepts a query parameter representing the country code.
Key Benefits
- Automates country data retrieval using a GraphQL query to a public API for reliable information.
- Processes and formats country details into a concise string for easy consumption downstream.
- Supports dynamic input via HTTP webhook, enabling flexible integration with external systems.
- Reduces manual lookup steps by delivering structured country info in a single response cycle.
Product Overview
This country code lookup automation pipeline begins with an HTTP POST request to a webhook node configured to accept a query parameter named code. Upon receiving a request, the workflow triggers a GraphQL node that queries the public endpoint https://countries.trevorblades.com/ using the uppercase country code provided. The GraphQL query requests the country’s name, phone calling code, and emoji flag symbol. The response is returned as a raw JSON string.
Next, a Function node parses this JSON string to extract the nested country object, replacing the raw response with structured data. Subsequently, a Set node formats this data into a string that states the country’s name, emoji, and phone code in a human-readable sentence. The workflow returns this formatted string as a JSON object in the HTTP response, ensuring synchronous delivery. The workflow does not persist any data and relies on the availability of the external GraphQL API for information retrieval.
Features and Outcomes
Core Automation
This no-code integration pipeline accepts a country code input, applies a GraphQL query for data retrieval, and formats the results into a structured string. The Function node ensures parsed data integrity before the final formatted output is generated.
- Single-pass evaluation from input to formatted output without intermediate storage.
- Deterministic data extraction using JSON parsing for consistent output structure.
- Synchronous response model ensures immediate delivery upon query completion.
Integrations and Intake
The orchestration pipeline integrates with a public GraphQL API using an HTTP GET request authenticated implicitly by endpoint availability. The webhook node listens for HTTP requests carrying a country code as a query parameter, which serves as the dynamic input for the GraphQL query.
- Webhook node for HTTP intake and event-driven trigger based on query parameter.
- GraphQL node executing a country data query against a public API endpoint.
- Function node for JSON parsing and data extraction to prepare structured output.
Outputs and Consumption
The workflow outputs a JSON object containing a single string field that concatenates country name, emoji, and phone code. This synchronous response is designed for immediate consumption by clients or downstream systems requiring country metadata.
- Output format: JSON with a single
datastring field. - Response is synchronous, returning data immediately after processing.
- Output includes country name, flag emoji, and phone calling code in natural language.
Workflow — End-to-End Execution
Step 1: Trigger
The workflow is triggered by an HTTP webhook node configured to listen for incoming requests at the /webhook path. It requires a query parameter code containing a two-letter country code, which initiates the downstream query process.
Step 2: Processing
The GraphQL node performs a GET request querying the public countries API, dynamically inserting the uppercase country code from the webhook. The response is returned as a raw JSON string without schema validation beyond the API’s native response format.
Step 3: Analysis
A Function node parses the raw JSON string and extracts the nested country object, replacing the raw data with structured JSON containing the country’s name, phone code, and emoji. This ensures downstream nodes operate on clean data.
Step 4: Delivery
The Set node formats the extracted data into a human-readable string stating the country name, emoji, and phone code. The webhook node returns this string as a JSON response in the field data, completing the synchronous request-response cycle.
Use Cases
Scenario 1
When building a global directory application, developers need to display country metadata based on user input codes. This workflow automates the retrieval of country name, flag emoji, and phone code, returning a formatted response in one request cycle, eliminating manual API querying.
Scenario 2
Customer support systems require quick verification of country codes to route calls correctly. This orchestration pipeline performs instant country code lookup and returns call-related metadata, enabling automated routing decisions without manual reference checks.
Scenario 3
Localization engines need to enrich user profiles with country-specific details. By integrating this workflow, profiles can be automatically appended with country name, emoji, and phone code from a simple country code input, ensuring consistency and reducing manual enrichment tasks.
How to use
To deploy this country code lookup automation workflow in n8n, import the workflow JSON and configure the webhook node for your desired endpoint path. No additional credentials are required as the GraphQL API is publicly accessible. After activation, send HTTP requests with the code query parameter set to a valid two-letter country code. The workflow will synchronously return a JSON response containing the country’s name, flag emoji, and phone code formatted in a single string.
Comparison — Manual Process vs. Automation Workflow
| Attribute | Manual/Alternative | This Workflow |
|---|---|---|
| Steps required | Multiple manual lookups and data formatting steps. | Single automated workflow from input to formatted output. |
| Consistency | Variation due to manual transcription errors. | Deterministic and consistent JSON parsing and output formatting. |
| Scalability | Limited by manual throughput and human capacity. | Scales automatically with HTTP request volume. |
| Maintenance | Requires frequent updates to reference data and format. | Minimal; relies on external API availability and node configuration. |
Technical Specifications
| Environment | n8n workflow automation platform |
|---|---|
| Tools / APIs | Webhook node, GraphQL node, Function node, Set node; Public GraphQL API (countries.trevorblades.com) |
| Execution Model | Synchronous HTTP request-response via webhook trigger |
| Input Formats | HTTP query parameter: ISO 3166-1 alpha-2 country code |
| Output Formats | JSON object with formatted string in data field |
| Data Handling | Transient in-memory processing; no persistence |
| Known Constraints | Depends on availability and response of the external public GraphQL API |
| Credentials | None required for public API access |
Implementation Requirements
- n8n instance with webhook accessibility to receive HTTP requests.
- Network access allowing outbound HTTPS GET requests to the public GraphQL API endpoint.
- Clients must supply a valid two-letter country code as a query parameter in requests.
Configuration & Validation
- Deploy the workflow in n8n and activate the webhook node with a defined HTTP path.
- Send test HTTP requests with the
codeparameter set to valid ISO 3166-1 alpha-2 country codes. - Verify that the JSON response contains the correctly formatted string with country name, emoji, and phone code.
Data Provenance
- Triggered by the Webhook node receiving HTTP query parameter
code. - Country data fetched via the GraphQL node querying
https://countries.trevorblades.com/API. - Data parsed and formatted through Function and Set nodes before synchronous response.
FAQ
How is the country code lookup automation workflow triggered?
The workflow is triggered by an HTTP webhook node configured to listen for requests containing the code query parameter with a two-letter country code.
Which tools or models does the orchestration pipeline use?
The pipeline uses a GraphQL node to query a public API for country data, a Function node to parse JSON, and a Set node to format output into a readable string.
What does the response look like for client consumption?
The response is a synchronous JSON object containing a single data field with a string that states the country name, flag emoji, and phone calling code.
Is any data persisted by the workflow?
No data is persisted; all processing is transient and occurs in-memory during request execution.
How are errors handled in this integration flow?
The workflow relies on n8n’s default error handling; there are no explicit retry or backoff mechanisms configured.
Conclusion
This country code lookup automation workflow provides a deterministic method to retrieve and format country metadata based on user-provided codes. It ensures consistent, synchronous delivery of country name, flag emoji, and phone calling code in a human-readable string. The workflow’s operation depends on the availability of the external public GraphQL API and requires no credentials. Its streamlined design reduces manual lookup errors and supports scalable, event-driven integration scenarios.








Reviews
There are no reviews yet.