Skip to content

Sample code to accelerate client's adoption of Lead Ads and Conversion Leads products, by integrating with our advertising platform. Developers can also take this as reference when building integrations, without having to start from scratch.

License

Notifications You must be signed in to change notification settings

fbsamples/lead-ads-webhook-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lead Ads Webhook Sample on AWS

This is a sample code (C# ASP.NET Core) for Facebook's Webhook and Lead Ads's products, focused on retrieving the leads. This sample code was also used in an internal training here at Facebook, as a demo session. You also have a Postman collection in the postman folder for testing purposes.

This repo is related to the (C#) REST webservice module (Back-End), leveraging AWS SAM accelerator. I believe this can be easily ported to other cloud providers, because the focus is on the webhook's endpoints.

Based on the ASP.NET Core Web API Serverless Application template.

Created by M. França - Solutions Architect (Solutions Engineering team LATAM).

TL;DR;

Get this source code...

git clone

Install the AWS templates and tools for your VS Code installation...

dotnet new --install Amazon.Lambda.Templates
dotnet tool install –g Amazon.Lambda.Tools

Retrieve the project's dependencies, compile everything, and run it locally...

dotnet restore
dotnet run

Validate the SAM yaml file, then package everything, and finally deploy it to the AWS cloud...

sam validate --template-file aws_iaac.yaml
dotnet lambda package --output-package .aws-sam\build\MyAWSomeLambda\prjFBLeadAds.zip
sam deploy --guided --template-file aws_iaac.yaml

Monitor the logs to find the id of your new lead...

sam logs -n MyAWSomeLambda --stack-name fra-fbleadads-back-stk --tail --region sa-east-1

Setup

If you want to create it from scratch...

dotnet new serverless.AspNetCoreWebAPI --name prjFBLeadAds –o .
dotnet restore

Testing Locally (Running)

dotnet run

Package & Deploy (on AWS)...

dotnet lambda package --output-package .aws-sam\build\MyAWSomeLambda\prjFBLeadAds.zip
sam deploy --guided --template-file aws_iaac.yaml

Decomissioning

aws cloudformation delete-stack --stack-name sam-app --region region

References

Additional Info

License

This source code is licensed under the MIT License. See the LICENSE file.

Contributions

This project is waiting for your contribution. See the CONTRIBUTING.md file.

Contact

Marcelo França - www.linkedin.com/in/mafranca

About

Sample code to accelerate client's adoption of Lead Ads and Conversion Leads products, by integrating with our advertising platform. Developers can also take this as reference when building integrations, without having to start from scratch.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages