AWS Event Bridge
Using Event Bridge
Blitline has integrated with AWS so that instead of postbacks or polling, you can use AWS Events generated by Blitline.com as notification that you job has completed.
AWS Events can be connected to Lambda functions (or other AWS services such as SQS and DynamoDB). The simplest setup is for you to have AWS Events call a Lambda function where you can handle the Blitline callback without ever needing a public callback endpoint. This makes receiving callbacks from Blitline as easy as writing a Lambda function, and it all happens within the privacy of your VPC.
Setup Instructions
To setup Blitline Events, you will need to do the following:
-
Create a Lambda function to receive the Event. For now, it can just be a default Lambda function, you can add the code for handling the Blitline callback later.
-
Log in to Blitline.com and click the "Configuration" tab from the home page. Scroll down to Event Bridge and enter your AWS Account ID (which you can find on your AWS "My Account" page from the AWS Console). Make sure you have your desired region and click the Update Button.
- Once you have updated your Account ID, you will need to go to your AWS Console and go to your Event Bridge page and activate this connection. You can find this page at:
https://console.aws.amazon.com/events/home?region=us-east-1#/partners
- Associate with an Event Bus
- You then need to click associate
- Create a new rule
(https://console.aws.amazon.com/events/home?region=us-east-1#/rules)
- Fill out form
- Once you create this rule, all Blitline postbacks should now go directly to your Lambda function. The Lambda function will receive event from Blitline from jobs submitted to Blitline.
Callback Data
You Lambda function will get an Event data with a "detail" containing:
{
"base64_json": "eyJyZXN1bHRzIjp7Im9yaWdpbmFsX21ldGEiOnsid2lkdGgiOjcyMCwiaGVpZ2h0Ijo1NDB9LCJpbWFnZXMiOlt7ImltYWdlX2lkZW50aWZpZXIiOiJNWV9DTElFTlRfSUQiLCJzM191cmwiOiJodHRwOi8vYmxpdGxpbmUuczMuYW1hem9uYXdzLmNvbS8yMDIwMDMyODIzLzc2L3RoaXNfZmlsZV93aWxsX2JlX2F1dG9kZWxldGVkX2luXzI0aHJzXzk5QmJkU2gtVUY0bE5jX0hBWm9WSmtRLmpwZyIsIm1ldGEiOnsid2lkdGgiOjEwMCwiaGVpZ2h0Ijo3NX19XSwiam9iX2lkIjoiN2EyM3pndXJsVUxtSWlrb0hIdmktMkRnIn19Cg="
}
Where you will have to Base64 decode the value of "base64_json". The result of this will be your "Postback" data you would have received during a postback call.
You have to base64 decode the node yourself because Event bridge requires a fixed JSON schema, and the results from Blitline is not fixed by design.
Updated over 3 years ago