Learning Timeline
Key Insights
Fine-Tuning with a System Prompt
For more accurate results, add a 'System Prompt' (Assistant) before the 'User Prompt'. This allows you to define specific criteria for what is considered 'Urgent' so that Slack isn't flooded with unimportant messages.
Messaging Platform Flexibility
If your team doesn't use Slack, the same drag-and-drop expression technique can be applied to Microsoft Teams, Discord, or WhatsApp (via other providers) without changing the underlying OpenAI logic.
Prompts
Email Severity Analysis
Target:
OpenAI (GPT-4 or GPT-3.5)
Analyze the severity of the content of the email we received without given context or pretext, just return the message text regarding its urgency.
Step by Step
Configuring OpenAI for Email Urgency Analysis
- Click the '+' icon on the n8n canvas to add a new node.
- Search for and select 'OpenAI'.
- Select 'Message a Model' from the list of available operations.
- Ensure your 'Credentials' are connected to a valid OpenAI account.
- In the 'Messages' section, select 'Add Message' and set the 'Role' to 'User'.
- In the 'Content' box, write a prompt to have the AI analyze the email's severity level.
- Open the 'Input Data' panel from the 'Gmail Trigger' on the left side.
- Drag and drop the 'From', 'To', 'Subject', and 'Body Content' fields into the OpenAI 'Content' box to provide full context to the AI.
- Click 'Test Step' to see the AI's analysis results based on sample email data.
Connecting AI Output to Slack Notifications
- Click the '+' icon after the OpenAI node and search for 'Slack'.
- Select 'Send a Message' as the primary 'Action'.
- Choose a 'Channel' or 'User' as the delivery destination (e.g., select your own account for initial testing).
- In the 'Message' section, click the gear icon or the 'Expression' (JS) symbol to insert dynamic data.
- Locate the 'OpenAI' node in the output list on the left.
- Drag and drop the 'content' field (the text generated by the AI) into the 'Message' area.
- Click 'Test Step' at the top of the Slack node to send an instant alert.
- Verify that the notification has been received in your Slack app.