Inbound message

In this building block you will see how to handle an inbound message.


Ensure that your inbound message webhook is set in the Dashboard.


Create an application

Write the code

Add the following to

Copy to Clipboard
#!/usr/bin/env python3
from flask import Flask, request, jsonify
from pprint import pprint

app = Flask(__name__)

@app.route("/webhooks/inbound-message", methods=['POST'])
def inbound_message():
    data = request.get_json()
    return "200"

if __name__ == '__main__':"", port=3000)

View full source 

Run your code

Save this file to your machine and run it:

$ python3

Try it out

The webhook will be invoked on inbound message and the message details and data printed to the console.