This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_get_users(self): | |
users = [db[key] for key in db.keys()] | |
responseObject = requests.get('https://twilioaiphoneservice.rahulbanerjee26.repl.co/user') | |
self.assertEquals(responseObject.status_code, 200) | |
self.assertEquals(len(responseObject.json()['data']),len(users)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from replit import db | |
import request | |
@app.route('/user', methods=['GET', 'POST']) | |
def user(): | |
# GET Request | |
if request.method == 'GET': | |
users = [] | |
for key in db.keys(): | |
users.append({'name': key, 'number': db[key]}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Build Model | |
''' | |
model_build = assistant.model_builds.create() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Add Sample to above task | |
''' | |
task_sample = assistant_task.samples.create(language='en-US', | |
tagged_text='register') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actions={ | |
"actions": [{ | |
"collect": { | |
"name": "user_information", | |
"questions": [{ | |
"question": "What is your name?", | |
"name": "user_name", | |
"type": "Twilio.FIRST_NAME" | |
}, { | |
"question": "What's your phone number?", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actions={ | |
"actions": [{ | |
"collect": { | |
"name": "name of this action", | |
"questions": [{ | |
"question": "question to ask user", | |
"name": "name of variable to store response", | |
"type": "data type of expect answer" | |
}], | |
"on_complete": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Create a Task Resource | |
''' | |
unique_task_name = 'twilio-bot-repl-task' | |
assistant_task = None | |
try: | |
assistant_task = assistant.tasks.create( | |
unique_name=unique_task_name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Create an Assistant Resource | |
''' | |
from twilio.rest import Client | |
client = Client(account_sid, account_key) | |
assistant = None | |
unique_assistant_name = 'twilio-bot-repl-assistant' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
account_sid = os.environ['account_sid'] | |
account_key = os.environ['account_key'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fileSystem = require('fs'); | |
const data = "File written using a server side module"; | |
fileSystem.writeFile('content.txt',data , err =>{ | |
if(err){ | |
console.error(err); | |
return; | |
} | |
} ); |