Skip to main content

Lambda bot

Project description

Xavier is a bot framework. Specially built to operate on AWS Lambda.

Example

import os
import logging
import sys

from xavier.active import register_bot
from xavier.bot import Bot
from xavier.aws.func import build_lambda_router_for_bot
from xavier.slack.slash import SlashCommandEvent
from xavier.http import Response

xavier_bot = Bot(env=env)
register_bot(xavier_bot)

@xavier_bot.add_route("/slack/commands/hello", methods=['POST'])
def handle_find(request):
    slash_command = SlashCommandEvent.from_request(request)
    if slash_command.text == 'Hi':
        slash_command.respond({'text': "Howdy"})
        else:
                slash_command.respond({'text': "Hi"})

    return Response(204, "")

lambda_http_handler = build_lambda_router_for_bot(xavier_bot)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xavier-0.0.2.tar.gz (6.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page