Skip to content

nickjabs/Dynamic_Targeted_Advertisement_Content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

what`s about ? 

The provided code is a Node.js implementation of an AWS Lambda function. 
It utilizes various AWS services such as SNS (Simple Notification Service), S3 (Simple Storage Service), Rekognition (image recognition service),
and DynamoDB (NoSQL database service).
The purpose of the code analyzing the detected faces in an image and triggering different actions based on the detected attributes.

Here's a breakdown of the code:

The required AWS SDK and other dependencies are imported.
The AWS configuration is set, specifying the desired region.
Instances of AWS services (SNS, S3, Rekognition, DynamoDB) are created.
The Lambda function is exported as the handler.
The handler function receives the event, context, and callback parameters.
The configuration variables are defined, including the source bucket, manager's phone number, and DynamoDB table name.
The source key (filename) is extracted from the event.
A rekognition.detectFaces request is made using the Rekognition service to detect faces in the specified image.
If an error occurs during the face detection process, an error message is logged, and the callback function is invoked with an appropriate error message.
If faces are successfully detected in the image, the result is logged, and a unique ID is generated using uuidV4.
The detected face information is then stored in DynamoDB using the docClient.put method.
Based on the detected attributes, various conditions are checked to determine the appropriate action to take. These conditions involve emotions, age range, gender, and facial features.
If the conditions are met, an HTTP request is made to generate a shortened URL using TinyURL API.
The shortened URL is used to compose a message containing information about the customer's attributes and the image URL.
The message is sent as an SMS to the manager's phone number using the SNS service.
If the SMS sending is successful, the callback function is invoked with the filename of the corresponding ad image. Otherwise, an appropriate error message is passed to the callback.

The code demonstrates a basic implementation of a Lambda function that utilizes AWS services for face detection and analysis. 

Follow the Steps :

1. Create 2x S3 Buckets and Secure them
2. Setup Dynamo DB
3. Create Lambda function with Node.js
4. expose API w. API Gateway
5. Code a Web Client

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published