Skip to content

Commit

Permalink
For onsite_helper, receive incoming messages without sending back a r…
Browse files Browse the repository at this point in the history
…eply (thats what SQS is for) unless its for setting things up. Also updated readme for integrating azure with github actions. Added missing datetime import to onsite_helper
  • Loading branch information
lperezmo authored Jul 13, 2024
1 parent 939a204 commit c889e5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,31 @@ SMS Helper is an AI-powered, function-calling text assistant designed to process

## Deploy on Azure (VS Code)
1. Create an Azure account & create a function with all defaults (Python).
* **(Optional)** You can also just create using the Azure functions extension on VS code, see step 3.
2. Create required environment variables on your function.
- `ACCOUNT_SID`
- `AUTH_TOKEN`
- `OPENAI_API_KEY`
- `SENTRY_DSN`
![Setting Env variables in Azure"](https://github.com/lperezmo/sms-helper/blob/main/images/azure_func_env_variables.png?raw=true)

2. In VS Code, install the Azure Functions extension (this will make it way easier).
3. In VS Code, install the Azure Functions extension (this will make it way easier).

![Extension](https://github.com/lperezmo/sms-helper/blob/main/images/extension.png?raw=true)

3. Open the folder where this repo is located.
4. Open the folder where this repo is located.
* **(Optional)** Edit `__init__.py` code to use alternative helper if you want to send less messages per request.
* **(Optional)** If using the 'schedule reminders' function, edit system message and API call to get the current time and date if you want something different than pacific time.
4. Go to the extension, and under 'Workspace' click on the little thunder sign and select 'Deploy to existing function...'.
5. Go to the extension, and under 'Workspace' click on the little thunder sign and select 'Deploy to existing function...'.

![Deploy](https://github.com/lperezmo/sms-helper/blob/main/images/deploy.png?raw=true)

5. Follow the prompts and done. Get your URL endpoint from Azure & load on Twilio.
6. Follow the prompts and done. Get your URL endpoint from Azure & load on Twilio.

## Build & Deploy to Azure using Github Actions
Follow instructions here to enable updating your Azure function when edits are made on Github repo:

* [How to use GitHub Actions for Azure Functions](https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-github-actions?tabs=linux%2Cdotnet&pivots=method-manual)


## Load on Twilio
Expand Down
4 changes: 3 additions & 1 deletion onsite_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import requests
from openai import OpenAI
from datetime import datetime
import azure.functions as func
from twilio.rest import Client

Expand Down Expand Up @@ -109,4 +110,5 @@ def get_follow_up_text(send_to, send_from, incoming_message):
- Text 'about' to see this message again"""
else:
result = save_sms_to_sqs(send_to, incoming_message)
return 'Processing reply...'
# Receive incoming messages without sending a reply
return ''

0 comments on commit c889e5f

Please sign in to comment.