Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(blocks): add a generic webhook block #9584

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

ntindle
Copy link
Member

@ntindle ntindle commented Mar 6, 2025

I want to be able to insert data into the graph as a webhook from various services without making a provider specific webhook for things like discord, slack, uptime bots, etc.

Changes 🏗️

  • Adds a generic webhook block that others can use

Checklist 📋

For code changes:

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • Test the endpoint that is generated with a graph, making sure to pass data and consts to it

@ntindle ntindle requested a review from a team as a code owner March 6, 2025 03:58
@ntindle ntindle requested review from Swiftyos and majdyz and removed request for a team March 6, 2025 03:58
@github-actions github-actions bot added platform/backend AutoGPT Platform - Back end platform/blocks labels Mar 6, 2025
Copy link

qodo-merge-pro bot commented Mar 6, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 Security concerns

Potential JSON Injection:
The webhook accepts arbitrary JSON data from external sources without validation. This could potentially lead to unexpected behavior if malicious data is sent. Consider adding validation or sanitization for the incoming payload, especially if this data will be used in database operations or passed to other systems.

⚡ Recommended focus areas for review

Incorrect Description

The block description mentions "compass transcription" which seems to be copied from another block and doesn't match the purpose of this generic webhook block.

description="This block will output the contents of the compass transcription.",
Typo in Variable

The variable name example_paylod has a typo (should be example_payload) and is referenced in multiple places.

example_paylod = {"message": "Hello, World!"}

@github-actions github-actions bot added the size/m label Mar 6, 2025
Copy link

netlify bot commented Mar 6, 2025

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
🔨 Latest commit 4738a5e
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs-dev/deploys/67ca9405320ef90008e21a57

Copy link

deepsource-io bot commented Mar 6, 2025

Here's the code health analysis summary for commits 9210d44..4738a5e. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗
DeepSource Python LogoPython✅ Success
❗ 2 occurences introduced
View Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@AutoGPT-Agent
Copy link

The PR does not meet all requirements. Issues found: 1) The PR template contains a partial checklist (configuration section is present but not filled out, should be removed if not applicable). 2) The PR appears to be related to webhook functionality but there's no mention or explanation of potential user_id handling impacts for data/.py files (though in this case there don't appear to be any data/.py changes). However, the core functionality and purpose is clearly explained, the changes are well-scoped, and the test plan is appropriate for the changes being made.

Copy link

netlify bot commented Mar 6, 2025

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 4738a5e
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/67ca94054515a1000827fe51

@AutoGPT-Agent
Copy link

The PR appears to be insufficient based on the provided rules. While it has a proper conventional commit title format and the changes appear to be in scope, the PR template is only partially filled out. The PR is missing important sections like configuration changes (which should be removed if not applicable rather than left unchecked), and the test plan is very minimal with only one test item compared to the example provided.

@AutoGPT-Agent
Copy link

The PR appears to be insufficient based on the required criteria. While it has a proper conventional commit style title with scope and the changes are focused (not exceeding 20% out of scope), there are several issues: 1) The changes in data/*.py were not applicable to review for user_id concerns as no such files were modified. 2) The description is quite minimal and could be more detailed. 3) The test plan is very basic with only one test point, compared to the template example which shows much more comprehensive testing scenarios. 4) The checklist sections for configuration changes was not removed despite being not applicable, it was just left unchecked.

@AutoGPT-Agent
Copy link

The PR appears to be insufficient based on the provided rules. Issues include: 1) Not enough details in the 'Changes' section - it only mentions adding a generic webhook block without specifics about the implementation details or affected components 2) The test plan is very minimal and only includes one test case, where more comprehensive testing would be expected for a new webhook feature 3) The code changes include new files and modifications to existing ones which are not properly documented in the changes section.

@AutoGPT-Agent
Copy link

The PR fails several requirements: 1) The PR title has a scope but it's too generic ('blocks' should be more specific), 2) The test plan is minimal and doesn't follow the example format provided in the template, 3) The configuration section of the checklist wasn't removed despite being not applicable. Also, the description of changes could be more detailed about what exactly was added and how it works.



class GenericWebhookType(StrEnum):
PLAIN = "plain"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what is it for ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to specify one i think?

@@ -15,6 +16,7 @@
CompassWebhookManager,
GithubWebhooksManager,
Slant3DWebhooksManager,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does simple webhook manager like Slant3DWebhooksManager still be needed if we already have the generic one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compass can go away but I think slant has custom data

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but idk maybe having it wiht custom outputs would be cool so we get typed data out

def __init__(self):
super().__init__(
id="8fa8c167-2002-47ce-aba8-97572fc5d387",
description="This block will output the contents of the compass transcription.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compass transcription?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

super().__init__(
id="8fa8c167-2002-47ce-aba8-97572fc5d387",
description="This block will output the contents of the compass transcription.",
categories={BlockCategory.HARDWARE},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardware ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOPS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🆕 Needs initial review
Development

Successfully merging this pull request may close these issues.

3 participants