Email Controller
All about the endpoints
Endpoints
| METHOD | API ENDPOINT | FUNCTION |
|---|---|---|
| GET | /v1/open/processemail | processEmail() |
processEmail()
- When the api is hit, the flow goes to ‘emailservice.processEmails()’ then the flow goes to ‘emaildao.getEmailMessages()’ and gets a list of email messages.
- For every email message, contact is fetched using sender and from name [ ‘getContact(sender, fromname)’ ] and if contact is not null then incident is fetched using subject [ ‘getIncidentByReferenceNumber(subject)’ ]
- A new incident is created using the details of fetched incident using ‘getIncidentByReferenceNumber(subject)’ and if the new incident is created then reference number is generated and if incident is not null then new thread and message are created using ‘crudservice.create(thread)’ and ‘crudservice.create(message)’
- At last the number of total mails , number of processed mails and status are added to the map of response and are returned.