Simplify Testing with Temporary Email Account Management API

The Temporary Email Account Management API is designed to streamline the testing and automation processes by providing developers with the ability to manage temporary email accounts effortlessly. This API offers a range of functionalities that allow you to create, manage, and utilize temporary email addresses, making it ideal for scenarios where you need to avoid spam or maintain privacy during testing. By leveraging this API, developers can save time and simplify workflows, ensuring they focus on building robust applications.
Prerequisites
To get started with the Temporary Email Account Management API, you will need an API key. Familiarity with general API call structures will also be beneficial for integrating these actions into your applications.
Retrieve Available System Domains
The "Retrieve Available System Domains" action allows developers to fetch a list of system domains that are available for selection when creating temporary email accounts. This functionality is particularly useful for applications that require multiple disposable email addresses for testing purposes, enabling developers to choose from a variety of domain options tailored for inboxes.com temporary email accounts.
Input Requirements:
This action does not require any specific input parameters, as it is designed to return a comprehensive list of available domains.
Expected Output:
The output will be a list of domain names, each represented as a qualified domain name (QDN). For example:
[
{"qdn": "guysmail.com"},
{"qdn": "chapsmail.com"},
{"qdn": "blondmail.com"},
...
]
Use Cases for this specific action:
- Testing User Registration: When developing applications that require user registration, developers can utilize temporary email addresses to test the registration process without cluttering their personal inboxes.
- Spam Prevention: By using temporary email addresses, developers can prevent spam in their primary email accounts during testing phases.
- Automation Scripts: Integrate this action into automation scripts that require email verification processes, allowing for seamless testing of workflows that involve email communications.
import requests
import json
# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"
action_id = "21c9941d-773c-4d96-8a8f-f806bbc6c3d0" # Action ID for: Retrieve Available System Domains
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {}
headers = {
"Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
"Content-Type": "application/json",
# Add any other required headers for the Cognitive Actions API
}
# Prepare the request body for the hypothetical execution endpoint
request_body = {
"action_id": action_id,
"inputs": payload
}
print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")
try:
response = requests.post(
COGNITIVE_ACTIONS_EXECUTE_URL,
headers=headers,
json=request_body
)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
result = response.json()
print("Action executed successfully. Result:")
print(json.dumps(result, indent=2))
except requests.exceptions.RequestException as e:
print(f"Error executing action {action_id}: {e}")
if e.response is not None:
print(f"Response status: {e.response.status_code}")
try:
print(f"Response body: {e.response.json()}")
except json.JSONDecodeError:
print(f"Response body (non-JSON): {e.response.text}")
print("------------------------------------------------")
Conclusion
The Temporary Email Account Management API provides valuable tools for developers looking to enhance their testing and automation processes. By utilizing the "Retrieve Available System Domains" action, you can easily access a variety of disposable email domains, ensuring your testing environment remains clean and efficient. As you integrate this API into your projects, consider exploring other functionalities it offers to further streamline your development workflows.