To receive incoming emails, you’ll need to configure a webhook that will notify your application when new emails arrive. This section guides you through setting up and testing webhooks in your development environment.
To receive emails in your inbox, you need to expose your local webhook endpoint to the internet. You can use ngrok to do this.
Run the following command in your CLI to start ngrok:
Now that you’ve confirmed your inbox can receive emails, you can start sending emails as that email address.
Sending an Email via API
Use the following API call to send your first email:
Copy
Ask AI
curl --location 'https://api.a1base.com/v1/emails/{account_id}/send' \--header 'X-API-Key: YOUR_API_KEY' \--header 'X-API-Secret: YOUR_API_SECRET' \--header 'Content-Type: application/json' \--data '{ "from": "[email protected]", "to": "[email protected]", "subject": "My First A1Mail Email", "text": "Hello from my AI agent! This is my first email sent through A1Mail."}'
With these steps completed, your AI agent now has a fully functional email inbox! You can send and receive emails programmatically, enabling your agent to communicate with users through email.
We’d love to hear from you!Don’t hesitate to reach out to [email protected] or [email protected] if there’s any features you’d like to see or prioritised!