Learn how to send MySQL data via email using Pabbly Connect. This tutorial covers step-by-step integration with AI Agent and Gmail to automate your workflow.
Watch Step By Step Video Tutorial Below
1. Accessing Pabbly Connect to Set Up Your AI Agent
To start sending MySQL data via email, first, access Pabbly Connect. Go to your browser and search for Pabbly Connect. You will reach the landing page where you can sign up or sign in if you already have an account. Signing up is straightforward and takes just a couple of minutes.
After logging in, you will see the ‘All Apps’ page. Click on ‘Access Now’ under Pabbly Connect. This will take you to the dashboard where you can create a workflow for your AI agent. Click on the ‘Create Workflow’ button and name your workflow, for example, ‘Create Table from MySQL Data’. Select the folder where you want to store this workflow and click on create.
2. Setting Up the Trigger in Pabbly Connect
In this section, you will set up the trigger for your AI agent using Pabbly Connect. The trigger will be scheduled to run at specific times. For instance, you can set it to run every day from Monday to Saturday at 9:00 AM. This ensures that the AI agent fetches data from your MySQL database at the desired intervals.
- Select ‘Scheduled by Pabbly’ as the trigger.
- Choose the trigger event as ‘Schedule Workflow’.
- Specify the days (Monday to Saturday) and the time (9:00 AM).
After entering these details, click on save. This configuration allows your AI agent to fetch appointment details from your MySQL database every morning at the specified time.
3. Fetching Data from MySQL Database
Next, you will configure the action step in Pabbly Connect to fetch data from your MySQL database. For this, select MySQL as your action app and choose ‘Custom Query’ as the action event. You will need to connect your MySQL account by entering your database credentials such as username, password, host, and database name.
Once connected, you will input your SQL query to fetch today’s appointment details. For example, you might use a query like: ‘SELECT * FROM appointments WHERE appointment_date = CURDATE();’. This query retrieves all appointments scheduled for the current date.
After entering the query, turn off the ‘Simple Response’ option and click on ‘Save and Send Test Request’. You should receive a response confirming that data has been successfully fetched from your MySQL database.
4. Creating an HTML Email with OpenAI
After fetching the data, the next step is to create an HTML email using Pabbly Connect and OpenAI. Add an action step and select OpenAI as your app. Choose ‘Chat GPT’ as the action event and connect your OpenAI account using your API key.
- Select the model you want to use, such as GPT-4.
- Input a prompt detailing how you want the HTML email to be formatted.
- Map the JSON data fetched from MySQL into the prompt.
After setting up the prompt, click ‘Save and Send Test Request’. You should receive an HTML response that contains the email body with the table of appointment details formatted correctly.
5. Sending the Email via Gmail
Finally, you will send the generated HTML email using Gmail through Pabbly Connect. Add another action step and select Gmail as your app, choosing ‘Send Email’ as the action event. Connect your Gmail account and specify the recipient’s email address.
In the email setup, enter the subject line, sender name, and the HTML content generated from OpenAI. Make sure to select ‘HTML’ as the email content type. After filling in all the necessary details, click on ‘Save and Send Test Request’. You should receive a confirmation that the email has been sent successfully.
Check your inbox to verify that the email containing the appointment details in table format has been received. This entire process showcases how Pabbly Connect allows for seamless integration between MySQL, OpenAI, and Gmail to automate your email workflows.
Conclusion
In this tutorial, we demonstrated how to send MySQL data via email using Pabbly Connect and AI Agent. By following the steps outlined, you can automate the process of fetching data from your MySQL database and sending it in a well-formatted HTML email. This integration simplifies your workflow and enhances productivity.
Ensure you check out Pabbly Connect to create business automation workflows and reduce manual tasks. Pabbly Connect currently offer integration with 2,000+ applications.
- Check out Pabbly Connect – Automate your business workflows effortlessly!
- Sign Up Free – Start your journey with ease!
- 10,000+ Video Tutorials – Learn step by step!
- Join Pabbly Facebook Group – Connect with 21,000+ like minded people!