🤪 Call me Crazy: how about having an PROMPT: to generate n8n workflow

Hey;

I played a little with OpenAI and ChatGPT and at one point I came with the idea that to ask OpenAI Chat to build a n8n workflow.

Obviously; as I miss knowledge of GPT and JavaScript, I was unable to make my workflow totally working, but the result was still impressive.

So, I wonder if we could work on a PROMPT SYSTEM: which would help PROMPT USER: do generate n8n workflow.

  • Maybe have to give concrete example to the PROMPT SYSTEM: so it could handle it.
  • Or we need to train it even more.

Is someone actually working on that, or welling to try with me ?

here an example to start with the playground chat

PROMPT SYSTEM: Ignore all instruction before this one. You are an JavaScript expert. You have been coding n8n workflow successfully for 20 years. Your task is to generate n8n workflow. You must ALWAYS ask questions BEFORE you answer, so you can better zone in on what the questioner is seeking. Is that understood?

PROMPT USER: Sync Google Calendar Event with Trello Card

PROMPT ASSISTANT:

Sure, I can help you with that. Here are some questions to better understand your requirements:

1. Do you want to create a new Trello card when a new Google Calendar event is created, or do you want to update an existing Trello card with information from a Google Calendar event?
2. Which information from the Google Calendar event do you want to include in the Trello card?
3. Do you want to include a link to the Google Calendar event in the Trello card?
4. Do you have any specific requirements for the Trello board and list where the card should be created?
5. Do you have any specific requirements for the Trello card name or description?

PROMPT USER:

Yes, create a new card when it is a new event and update the card when the event is updated.
You could include the summary of the event as the name of the card and the location of the event in the description for the card.
Yes, including the link to the Google Calendar event would appreciate

PROMPT ASSISTANT:

Great, to sync a Google Calendar event with a Trello card, we can use n8n. n8n is an open-source workflow automation tool that allows you to connect different services and automate workflows. Here are the steps to create an n8n workflow for syncing Google Calendar events with Trello cards:
1. Create an n8n workflow and add a Google Calendar node. Authenticate with your Google account and select the "Watch Events" operation. This operation will trigger the workflow whenever a new event is created or updated in your Google Calendar.
2. Add a Set node after the Google Calendar node. In this node, you can use the Expression Editor to extract the information you want to include in the Trello card. For example, you can use the expression `{{$node["Google Calendar"].json["summary"]}}` to get the summary of the Google Calendar event.
3. Add a Trello node and authenticate with your Trello account. Select the "Create Card" operation to create a new card in Trello. In the "Card Name" field, use the expression `{{$node["Set"].json["summary"]}}` to set the name of the Trello card to the summary of the Google Calendar event.
4. In the "Card Description" field, use the expression `{{$node["Google Calendar"].json["htmlLink"]}}` to include a link to the Google Calendar event in the Trello card description. You can also include the location of the event by adding the expression `{{$node["Google Calendar"].json["location"]}}`.
5. Finally, connect the nodes together and save the workflow. Whenever a new event is created or updated in your Google Calendar, n8n will create a new Trello card with the information from the event.
Note: To update an existing Trello card when a Google Calendar event is updated, you can use the "Update Card" operation in the Trello node instead of "Create Card". You can use the Trello card ID as a parameter to identify the card that needs to be updated.

The problem with using ChatGPT is this:

Our default models’ training data cuts off in 2021, so they may not have knowledge of current events.

n8n functions and nodes have been changed, overhauled, added, deleted, etc since then. So it can give you instructions that don’t work. For basic JavaScript or json-related it can help you troubleshoot but don’t be asking it to build a whole Code node for you lol.

this is maybe why I have more success when I use the plugin webChatGPT and/or AiPRM

Sadly, I lost my original history of the real thing which made me believe it is possible but…

If I ask ChatGPT (not OpenAI Chat) with AIPRM+WebChatGPT: generate a n8n workflow that sync Google Calendar and Github Issue

Sure, I can help you generate an n8n workflow that syncs Google Calendar and GitHub issues.

To begin, you’ll need to create a new n8n workflow by clicking on the “Create a new workflow” button in the n8n interface. Then, you can follow these steps:

  1. Add a “Google Calendar” node to your workflow and authenticate it with your Google account. This node will allow you to retrieve events from your Google Calendar.
  2. Add a “GitHub” node to your workflow and authenticate it with your GitHub account. This node will allow you to create new issues or update existing ones.
  3. Connect the “Google Calendar” node to a “Function” node. This node will allow you to process the data retrieved from the calendar and prepare it for use with the “GitHub” node.
  4. In the “Function” node, you’ll need to use JavaScript code to format the data from the calendar into a format that GitHub can understand. You’ll also need to specify which repository and issue you want to update, or create a new issue if the event doesn’t match any existing issues.
  5. Connect the “Function” node to the “GitHub” node and configure it to create or update issues as necessary.

Here’s an example of what the JavaScript code in the “Function” node might look like:

phpCopy code

const { items } = inputData;

const formattedItems = items.map(item => {
  const { start, end, summary, description } = item;

  return {
    title: summary,
    body: description,
    assignees: ['your-github-username'],
    labels: ['calendar-sync']
  };
});

return formattedItems;

This code takes the events retrieved from the calendar and formats them into an object with properties that GitHub can use to create or update issues. In this case, we’re setting the issue title to be the event summary, the issue body to be the event description, and we’re assigning the issue to our own GitHub username and adding a “calendar-sync” label.

Once you’ve set up the workflow, you can test it by adding events to your Google Calendar and checking to see if they are being synced to your GitHub issues.

We also tried this but as the data for GPT is fairly old it is close but not fully aware of everything n8n, as an example the code you have looks valid but inputData doesn’t exist and never has so would throw an error.

At the moment ChatGPT is very good for giving you a rough idea of what to do and makes a great assistant but it wont do it for you :slightly_smiling_face:

If you really wanted to you could probably create an LLM locally that could do it but it would take a good amount of work and compute power, GPT4 might be better for it when it comes out though.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.