Exemplo n.º 1
0
def make_outgoing_call(phonenumber, redirect_url):
    account_sid, auth_token = utils.get_api_keys()
    client = Client(account_sid, auth_token)

    my_twilio_number = "+15598887039"

    call = client.api.account.calls \
        .create(to="+" + phonenumber,
                from_=my_twilio_number,
                url=redirect_url)
Exemplo n.º 2
0
 def decorated(*args, **kwargs):
     api_key = None
     if 'apikey' in request.form:
         api_key = request.form['apikey']
     elif 'X-Apikey' in request.headers.keys():
         api_key = request.headers['X-Apikey']
     # validate
     if not api_key:
         data = {'error': messages.NO_API_KEY}
         return jsonify(data)
     if api_key not in utils.get_api_keys():
         data = {'error': messages.INVALID_API_KEY}
         return jsonify(data)
     session['apikey'] = api_key
     return f(*args, **kwargs)
Exemplo n.º 3
0
import aiml
import time
from utils import get_args
from utils import get_api_keys
from utils import connect_to_slack_rtm_api
from utils import join_channels
from utils import get_channels_ids
from utils import get_bot_id
from utils import configure_chatbot
from utils import is_message_to_chatbot
from utils import drop_botname_from_message

args = get_args()
channels = args.channel

api_keys = get_api_keys("api_keys.txt")
connected, sc = connect_to_slack_rtm_api(api_keys["slack_api_key"])

if connected:
    kernel = aiml.Kernel()
    kernel.learn("std-startup.xml")
    kernel.respond("load aiml b")
    configure_chatbot(kernel)

    channels_dict = get_channels_ids(sc, channels)
    join_channels(sc, channels_dict)
    bot_id = get_bot_id(sc, kernel.getBotPredicate("name"))

    while True:
        events = sc.rtm_read()
        if events:
Exemplo n.º 4
0
import sys
sys.path.append("./")
sys.path.append("../")
import time
from slackclient import SlackClient
from utils import get_api_keys

channel = ["#general"]
api_keys = get_api_keys("api_keys.txt")
sc = SlackClient(api_keys["slack_api_key"])

if sc.rtm_connect():
  while True:
    events = sc.rtm_read()
    for event in events:
      print event
    time.sleep(1)
else:
  print "Connection to Slack RTM API failed"