-
-
Notifications
You must be signed in to change notification settings - Fork 2
Add support for ASP.NET Core hosting #340
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
Conversation
…ore hosting support Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
| Throw.IfNull(endpoints); | ||
|
|
||
| // POST /whatsapp - Main webhook endpoint for receiving messages | ||
| endpoints.MapPost("/whatsapp", (Delegate)HandleMessageAsync); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this pattern. Much better to place the required dependencies as part of the delegate/method signature for each Handle message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored in e402c29. Now using proper minimal API parameter binding with [FromBody], [FromQuery], [FromHeader] attributes instead of resolving from HttpContext.RequestServices.
src/WhatsApp.AspNetCore/WhatsAppEndpointRouteBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/WhatsApp.Functions/WhatsAppFunctionsServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
… and move AddWhatsApp to each hosting project Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
…ve documentation Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
🧪 Details on Ubuntu 24.04.3 LTSfrom retest v1.1.0 on .NET 10.0.2 with 💜 by @devlooped |
kzu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the Sample.csproj is just the Functions-based sample, we need to improve things by:
- Create a SampleWeb.csproj: showcases ASP.NET Core integration
- Rename Sample.csproj (and the containing folder too) to SampleFunctions.csproj: showcases the Azure Fucntions integration.
…e showcase Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Done in aadba3b. Renamed |
|
@copilot revisit your latest changes based on the updated instructions in copilot-instructions.md |
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Ran Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot try again with the updated instructions. all tests should pass when you review code |
Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Ran Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
The new functions builder extension methods make it more intuitive and less error-prone
[FromBody],[FromQuery],[FromHeader]instead ofHttpContext.RequestServicesAddWhatsAppmethods to each hosting project (ASP.NET Core and Functions)AddWhatsAppCoreinternal, visible to hosting projects.UseAzureFunctions()needed)Any()for existence checks, improve documentation)SampletoSampleFunctionsfor Azure Functions showcaseSampleWebfor ASP.NET Core integration showcaseOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.