In some cases, for security or internal policy reasons, you may prefer not to give Aissist direct access to your information systems.
A simple solution is to create a lightweight API that grants restricted access, controls what data can be retrieved, filters or processes it as needed, and defines exactly what output Aissist can use.
One great tool for this is AWS Lambda β a serverless platform that lets you run code without worrying about server management, scaling, or load balancing.
Itβs cost-effective (you only pay for what you use) and easy to set up, making it a perfect choice for creating a simple RESTful API for Aissist.
In this tutorial, we'll show you how to build a basic AWS Lambda function that fetches booking information from your internal database.
π οΈ Step-by-Step Guide
Step 1: Write Your Data Retrieval Code
Create a simple Python script to pull booking details using a booking ID:
import mysql.connector
def lambda_handler(event, context):
secrets = dict()
with open("secrets.json") as input_fp:
secrets = json.load(input_fp)
database = mysql.connector.connect(
host=secrets["host"],
database=secrets["database"],
user=secrets["user"],
password=secrets["password"]
)
query = """ SELECT * FROM cr_booking WHERE id = %s """
cursor = database.cursor()
cursor.execute(query, (json.loads(event['body'])["booking_id"],))
column_names = [col[0] for col in cursor.description]
bookings = [dict(zip(column_names, row)) for row in cursor.fetchall()]
return {"book_details": bookings}
Step 2: Package Your Code for AWS Lambda
You'll need to package your code, your secrets.json file, and any required Python libraries into a zip file.
Install the MySQL connector package:
pip3 install --target ./packages mysql-connector
Create the deployment package:
cd ./packages
zip -r ../deployment_package.zip .
cd ..
zip deployment_package.zip lambda_function.py
zip deployment_package.zip secrets.json
Step 3: Create Your AWS Lambda Function
Go to the AWS Lambda Console.
Create a new Lambda function.
For simplicity, enable Function URL and set Auth Type to None (or use AWS API Gateway for extra security if needed).
Upload your deployment_package.zip created in Step 2.
After upload, your Lambda function will have a public URL β this will act as your new RESTful API.
β Now your lightweight, secure API is ready!
Step 4: Connect Lambda to Aissist
Finally, connect your new API to Aissist:
Use the Function URL from Lambda as the API endpoint
π Why Use AWS Lambda for Integration?
π Secure Access Control β Only expose the necessary data.
β‘ Fast and Scalable β Lambda scales automatically with no server setup.
π° Cost-Effective β Pay only for the compute time you use.
π§ Flexible β Customize your output for exactly what Aissist needs.
Follow the usual steps for create integration first then the action
After setting up the Shopify integration and actions, you can use the to test and verify that everything is working correctly.