import requests
url = 'https://api.simplex.sh/workflow'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
}
data = {
'name': 'My New Workflow',
'url': 'https://example.com',
'metadata': 'production, automated',
'actions': [
{
'function': 'navigate',
'params': {'url': 'https://example.com/login'}
},
{
'function': 'type',
'params': {'text': '{{username}}'}
},
{
'function': 'click',
'params': {'element_description': 'submit button'}
}
],
'variables': {
'username': {
'type': 'string',
'required': True
}
}
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
if result['succeeded']:
print(f"Created workflow with ID: {result['workflow']['id']}")