Amazon Web Services, also known as AWS, is the world's largest cloud service. market nowadays. Thinking about three main concepts that permeate our company: agility, ease and practicality; we help you integrate your serverless ecosystem with Pix.
We will clearly explain to you how to do this integration process. Our platform has as a philosophy to be focused on the concept of event-driven, so we give you the possibility to associate this future integration of Lambda to a certain type of specific event on our platform, for example: a charge created, a charge paid, etc.
Integrating with AWS Lambda
First of all, as a requirement for us to continue the process, it is necessary:
- An AWS account. If you don't have one, create one. aqui;
- An Woovi account. If you don't have one, create one. aqui;
In case you have already created or created now and saw that it is everything ok, we can move on.
Remembering that: both us and AWS provide test accounts on their respective platforms, so that there is no cost to the customer. You can see the quotas of the Lambda service.
Creating the Lambda Function in AWS (via Console)
To create the Lambda function, we will need two services: API Gateway e Lambda. Ambos disponibilizados pela cloud em questão.
-
Access the dashboard of Lambda and check if everything is ok (mainly the region that AWS consumes).
-
Click the Create button function;
-
Follow the step-by-step process right there on the form, entering the information as you wish. If you have any questions in the creation process, feel free to contact us in the chat. There are also some tutorials that can help you, such as:
-
Create an API Gateway. In case you don't know what it works for, it will serve as an intermediary between your Lambda and our platform. It will provide an endpoint for us, like an API, and it will report with the function in question.
- Similar to Lambdas functions, there are also specific tutorials going deeper into the topic of API Gateway. In case you're curious: Creating an HTTP API - API Gateway.
Okay, in theory you have everything working within your AWS.
Automating function creation
If you want to automate the flow within AWS, creating both the Lambda function, as for API Gateway with a single command, we have a repository containing a boilerplate using the AWS CDK (Cloud Development Kit). Essa é uma ferramenta de Infra as Code.
Access aqui o nosso repositório, caso queria dar uma olhada.
Creating a webhook
Now, within our platform, you will need to create a new webhook. all our architecture event-based is solidified and supported through webhooks.
- On our platform go to the area of API/Plugins. On the upper right side there is a button called "New webhook". Press it.
- After clicking, you will see a form for creating a new webhook. This form contains important information for proper operation.
of your webhook, such as: URL to make the request, the event we will be waiting for and also custom HTTP headers for your request.
Feel free to put any headers you like, like the
x-api-key
, a fairly common authorization header in applications within AWS. - For the URL of your webhook, just pass the endpoint that API Gateway made available to us, with the respective endpoint, if any.
If everything went well, it is likely that you have received a test request with the following payload:
{
"data_criacao": "<data em ISO string do momento em que criou o webhook>",
"evento": "teste_webhook"
}
This is an initial request we make to check the health of the endpoint e ver que tudo está OK!
Now congratulations, you have quickly and easily integrated our platform events with your serverless environment. Easy, fast and practical.
If you have any further questions about integrations, take a look at our documentation!
Tags: