AI emails: achieve effective communications in the workplace

Managing staff communications in an organisation can be a difficult task. For example, crafting emails that are relevant, meaningful, and effective requires time and effort. To ease that task, it’s helpful to look at internal documents, these can be a great source of information to use when crafting employee emails.

From Job descriptions to internal policy documents and exit interviews, these internal resources can be used to create more personalised and informative emails for employees.

Possibilities are endless when it comes to AI applications in business, they span from creating a full business plan and even reach a company’s internal communications so, let’s have a look at how to leverage internal documents to create emails using Azure functions and explore how OpenAI can be used to generate content from these documents for the emails.

AI in the workplace

The proposed solution revolves around an HTTP trigger function that processes the request for a question of role change or employee churn reason. It retrieves relevant information and sends this information as an email to the user. The introduction of OpenAI in content generation provides a new dimension to leveraging internal documents. OpenAI can analyse and extract information from various internal resources, allowing organisations to automate HR processes by automatically generating content for employee emails. This can save time and effort while still ensuring the emails are relevant, informative, and personalised. In this context, artificial intelligence and data work together.

Creating the email content is the initial step. This can be accomplished by implementing Azure OpenAI on your data. The solution can be found at the GitHub repository, where you can also find a comprehensive guide on how to integrate Azure OpenAI with your data to utilise the /ask API, the guide contains the complete code and supplementary resources. This solution utilises the /ask API.

The /ask API uses the Retrieve Then Read Approach to answer the user’s question by performing a search on Azure Cognitive Search and generating a response using OpenAI’s ChatGPT model, based on the search results. It performs the search on Azure Cognitive Search depending on the retrieval mode which can be text, vector or hybrid. If the semantic ranker is enabled, it uses the semantic search feature of Azure Cognitive Search. The search results are formatted into a string, with each result consisting of the source page and content. It calls the OpenAI’s ChatCompletion API with these messages to generate a response.

You can call the /ask API via a POST service, where the request consists of any relevant information required in the question. For instance, in a role change situation, the API utilises the old role and the new role and extracts pertinent policies from the internal policies provided. This can be an example of artificial intelligence for managers when it comes to an employee churn alert situation. In that case, the churn_category (for example: burnout, lack of support) is sent to the /ask API in the form of a question, it can examine exit records and return documents that also state the same churn_category and uses this information to draft an email warning managers if employees are at risk of churn.

ai email example

The response from the API is processed, and the content from the assistant is extracted, cleaned, and formatted in the required format into HTML content that needs to be inputted in the email.

artificial intelligence for managers

In addition to the main content the /ask API also sends the file name and file Path using which the content was created, these files can be used as attachments for the email. These documents are pulled from Microsoft’s blob storage using the file path. Once downloaded, these documents are encoded into base64, a format that is widely used in emails, and then appended to the email as attachments. Attachment lists contain the name of the attachments, the base64 encoded content and the content type which contains the appropriate content Type, in this case “application/pdf” is used for a PDF document. By providing the possibility of creating attachments, this solution shows how automation in human resources can become a way for businesses to save a decent amount of time.

automation human resources

The final step is sending the email. In the context of our solution, Azure communication service is used to send emails. Azure Communication Service is a platform that facilitates various modes of communication, including emails, SMS, voice, and video calling. To connect to the Azure Communication Service, we utilise the EmailClient from the Azure Communication Email Library. The EmailClient is initialised using a connection string. The communication service generates a domain ID which can be used in creating the senders’ address. The email consists of the user’s name, content produced via the /ask API, and any attachments. Images can also be incorporated into the email content.

azure communication service ai business

ai emails example

The email is then sent using the begin_send method of the EmailClient, and the result of the operation is printed out. The begin_send method returns a poller object, which can be used to check the status of the operation. The image provided below is an example of the email that has been sent.

ai technologies in business

automate hr processes

In conclusion, by utilising the capabilities of the Azure cognitive services and OpenAI, organisations can automatically generate content for emails based on internal resources such as job descriptions, policy documents, and exit interview notes. This not only ensures the relevance and personalisation of the emails but also significantly reduces the time and effort involved. By integrating these technologies, we can create a robust and efficient system for managing employee communications and take advantage of AI technologies in business. Whether it’s a role change scenario or an employee churn situation, this solution ensures that the right information reaches the right people at the right time.


Related CONTENT by Industry
Services & Solutions

More Content