#Email Routing, API To Setup Addresses

5 messages · Page 1 of 1 (latest)

winged breach
#

Howdy,
Looking through the docs I don't see a progrmattic way to setup email addresses for email routing. I need to setup dynamic mailbox for workers to process each one. Is there no way to do this through an API? Logging inot the dashboard to setup the email is just silly. Am I missing something here? Here is my high level use case

pjoect_id@mydomain.com --> Routes to Email Worker --> email worker does some tasks on email, logs it to D1 and then is displayed in my web application.

I know email workers can handle everything I need but GETTING the mailbox configured does not see to be an easy API call or again am I missing something?

subtle wave
# winged breach Howdy, Looking through the docs I don't see a progrmattic way to setup email add...

The API is create routing rules: https://developers.cloudflare.com/api-next/resources/email_routing/subresources/rules/methods/create/
The dashboard uses the same api for this, inspecting it is a good way of learning how it does stuff. In this case the action if of type 'worker' and the value is just the worker name, rest of the matching syntax is the same

You could also just configure a wildcard to your worker and handle the validation within

winged breach
#

I see. But this just allows me to create the desitnation, like another email or worker:
https://developers.cloudflare.com/api-next/resources/email_routing/subresources/addresses/methods/create/
But just so I am clear there is not a way to create an actual custom address. That I have to do through the dashboard is that correct?

Are you saying just create a wildcard address to an email worker and I then check for all the logic, for example the "procect_id" in my example? I supposes that can work. Not a horrible idea but I do find it odd that there is no API to provision custom addresses for email.

subtle wave