I made a function to check if the webhook is received in Lambda for the time being

Motivation

When I tried LINE Beacon with M5 STICKC the other day, When I tried to use GAS which I have never used the webhook destination, I'm not sure where I'm addicted to.

It may be better to fix the Webhook destination every time because it is caused by trying out unknown functions together.

What I made

So, I personally created an environment that can be used as a webhook destination for general purposes.

The environment is AWS Lambda (and API Gateway) as the most familiar one.

The contents of the Lambda function are as follows, so that it can be output to the log regardless of whether it is received by POST or GET.

import json

def lambda_handler(event, context):
    #Argument: Display the contents of event
    print("Received event: " + json.dumps(event))
    # rawQueryString
    rawQueryString = event['rawQueryString']
    if(len(rawQueryString) != 0):
        queryStringParameters = event['queryStringParameters']
        print(queryStringParameters)
    
    # body
    body = event.get('body')
    if(not body is None):
        json_body = json.dumps(body)
        print(json_body)

    return {
        'isBase64Encoded': False,
        'statusCode': 200,
        'headers': {},
        'body': json.dumps('Hello from Lambda!')
    }

Recommended Posts

I made a function to check if the webhook is received in Lambda for the time being
I want to create a Dockerfile for the time being.
I made a program to check the size of a file in Python
Check if the string is a number in python
I created a script to check if English is entered in the specified position of the JSON file in Python.
I made a command to wait for Django to start until the DB is ready
I want to move selenium for the time being [for mac]
For the time being, I want to convert files with ffmpeg !!
I made a command to display a colorful calendar in the terminal
[Golang] Check if a specific character string is included in the character string
If you are a beginner in programming, why not make a "game" for the time being? The story
For the first time in Numpy, I will update it from time to time
Python: I want to measure the processing time of a function neatly
I made a function to see the movement of a two-dimensional array (Python)
I want to receive the configuration file and check if the JSON file generated by jinja2 is a valid JSON
I want to use Ubuntu's desktop environment on Android for the time being (Termux version-Japanese input in desktop environment)
Make a histogram for the time being (matplotlib)
I played with Floydhub for the time being
virtualenv For the time being, this is all!
I made a tool to estimate the execution time of cron (+ PyPI debut)
I made an appdo command to execute a command in the context of the app
I searched for the skills needed to become a web engineer in Python
I thought I could make a nice gitignore editor, so I tried to make something like MVP for the time being
Create a python script to check if the link at the specified URL is valid 2
I will try to summarize the links that seem to be useful for the time being
Flow memo to move LOCUST for the time being
Register a task in cron for the first time
Molecular dynamics simulation to try for the time being
I made a script to put a snippet in README.md
How to use any or all to check if it is in a dictionary (Hash)
Check if it is Unix in the scripting language
How to unit test a function containing the current time using freezegun in python
I don't know what HEIC is. But for the time being, let's use PNG!
I want to create a lunch database [EP1] Django study for the first time
I want to create a lunch database [EP1-4] Django study for the first time
I will install Arch Linux for the time being.
Next to Excel, for the time being, jupyter notebook
I made a command to markdown the table clipboard
Check if it is Unix in the scripting language
[Python] Make sure the received function is a user-defined function
How to test the current time with Go (I made a very thin library)
I tried to make a function to judge whether the major stock exchanges in the world are daylight saving time with python
I want to win if there is the most useless visualization grand prix in the world ・ Learn visualization by evolving the OP function
I made a program in Python that changes the 1-minute data of FX to an arbitrary time frame (1 hour frame, etc.)
"Stop committing Japanese files to git on Mac> <" For the time being, I wrote a script to search for incompatible Japanese files on Mac and Linux.
Is it a problem to eliminate the need for analog human resources in the AI era?
I made a script in Python to convert a text file for JSON (for vscode user snippet)
I made a class to get the analysis result by MeCab in ndarray with python
I want to use the Ubuntu desktop environment on Android for the time being (Termux version)
I made a function to crop the image of python openCV, so please use it.
I want to use Ubuntu's desktop environment on Android for the time being (UserLAnd version)
I also tried to imitate the function monad and State monad with a generator in Python
The story I was addicted to when I specified nil as a function argument in Go
I want to initialize if the value is empty (python)
[python] How to check if the Key exists in the dictionary
Test code to check for broken links in the page
I made a package to filter time series with python
I tried running PIFuHD on Windows for the time being
I made a command to generate a table comment in Django
I tried to illustrate the time and time in C language
How to check if a value exists in an enum