def incoming_sms(request):
    """ Changes worker activity and returns a confirmation """
    client = Client(ACCOUNT_SID, AUTH_TOKEN)
    activity = 'Idle' if request.POST['Body'].lower().strip() == 'on' else 'Offline'
    activity_sid = WORKSPACE_INFO.activities[activity].sid
    worker_sid = WORKSPACE_INFO.workers[request.POST['From']]
    workspace_sid = WORKSPACE_INFO.workspace_sid

    client.workspaces(workspace_sid)\
          .workers(worker_sid)\
          .update(activity_sid=activity_sid)

    resp = MessagingResponse()
    message = 'Your status has changed to ' + activity
    resp.message(message)
    return HttpResponse(resp)
Beispiel #2
0
from twilio.rest import Client

acctSid = ''
authToken = ''

client = Client(acctSid, authToken)


def sendMessage(number, client):
    message = client.api.account.messages.create(
        f'+1{number}',
        from_='+12563636816',
        body='It\'s almost time for your workout! Let\'s hit the gym!')
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

short_code = client.short_codes("SC6b20cb705c1e8f00210049b20b70fce2") \
                   .fetch()

print(short_code.short_code)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

number = client.incoming_phone_numbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e").update(
    voice_url="http://demo.twilio.com/docs/voice.xml", sms_url="http://demo.twilio.com/docs/sms.xml"
)

print(number.voice_url)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

call = client.calls("CAe1644a7eed5088b159577c5802d8be38").update(status="completed")

print(call.direction)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

client.transcriptions("TR8c61027b709ffb038236612dc5af8723").delete()
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of dependent phone number objects
numbers = client.addresses('AD2a0747eba6abf96b7e3c3ff0b4530f6e') \
                .dependent_phone_numbers \
                .list()

for number in numbers:
    print(number.friendly_name)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of participant objects with the properties described above
participants = client.conferences('CFbbe4632a3c49700934481addd5ce1659') \
                     .participants \
                     .list()

for participant in participants:
    print(participant.muted)
Beispiel #9
0
 def __init__(self, accout_sid, auth_token, phone_number):
     self.client = Client(accout_sid, auth_token)
     self.phone_number = phone_number
# we import the Twilio client from the dependency we just installed
from twilio.rest import Client

# the following line needs your Twilio Account SID and Auth Token
client = Client("ACa0300108284e312d43651ac6ec6f59aa", "e569a7e0d7decd8fcdbb5f2cb7099e60")

# change the "from_" number to your Twilio number and the "to" number
# to the phone number you signed up for Twilio with, or upgrade your
# account to send SMS to any phone number
client.messages.create(to="+919940261858", 
                       from_="+17755719965", 
                       body="Hello from Python!")
Beispiel #11
0
import os
from twilio.rest import Client

TWILIO_PHONE_NUMBER = os.environ['TWILIO_PHONE_NUMBER']
PERSONAL_PHONE_NUMBER = os.environ['PERSONAL_PHONE_NUMBER']
TWILIO_ACCOUNT_SID = os.environ['TWILIO_ACCOUNT_SID']
TWILIO_AUTH_TOKEN = os.environ['TWILIO_AUTH_TOKEN']
CLIENT = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
BASE_URL = 'http://localhost:5000'
def main():
    recognizer = aiy.cloudspeech.get_recognizer()
    recognizer.expect_phrase('turn off the light')
    recognizer.expect_phrase('turn on the light')
    recognizer.expect_phrase('blink')
    recognizer.expect_phrase('text')
    recognizer.expect_phrase('call')
    recognizer.expect_phrase('ok')

    button = aiy.voicehat.get_button()
    led = aiy.voicehat.get_led()
    aiy.audio.get_recorder().start()

    client = Client("Twilio client ID", "key")

    listening = 0
    print("Say OK ...")
    while True:
        #print('Press the button and speak')
        #button.wait_for_press()
        #print('Listening...')
        text = recognizer.recognize()
        if not text:
            print('Sorry, I did not hear you.')
        else:
            if 'ok' in text:
                listening = 1
                print("Listening ...")
                continue
            elif listening == 0:
                print("Say OK ...")
                continue
            print('You said "', text, '"')
            if 'turn on the light' in text:
                led.set_state(aiy.voicehat.LED.ON)
            elif 'turn off the light' in text:
                led.set_state(aiy.voicehat.LED.OFF)
            elif 'blink' in text:
                led.set_state(aiy.voicehat.LED.BLINK)
            elif 'goodbye' in text:
                break
            elif 'text' in text:
                recipient_number = text.split()[3]
                recipient_name = text.split()[1]
                message = " ".join(text.split()[4:])
                print("Recipient is %s at %s" %
                      (recipient_name, recipient_number))
                aiy.audio.say('Texting %s at %s message %s!' %
                              (recipient_name, recipient_number, message))
                client.messages.create(to="+1%s" % (recipient_number),
                                       from_="+16096148079",
                                       body="Hey %s, %s, Binh's Assistant!" %
                                       (recipient_name, message))
            elif 'call' in text:
                recipient_number = text.split()[3]
                recipient_name = text.split()[1]
                aiy.audio.say('Calling %s at %s!' %
                              (recipient_name, recipient_number))
                client.calls.create(
                    url='http://demo.twilio.com/docs/voice.xml',
                    to='+1%s' % recipient_number,
                    from_='+16096148079')
            listening = 0
Beispiel #13
0
app = Flask(__name__)
app.wsgi_app = socketio.Middleware(sio, app.wsgi_app)
app.config['SECRET_KEY'] = 'secret!'
thread = None
ai = ClarifaiApp(api_key="d556e0ea9bd741d98e6fe8f4812f1b44")
model = ai.models.get('bd367be194cf45149e75f01d59f77ba7')

legal_foods = ["french fries", "bread", "water", "ketchup", "apple"]

last_foods = []
numbers = ["6094774055"]

twilio_origin = "+12674940179"
twilio_sid = "AC7c140f99da2450bf3895ef2f80684e71"
twilio_token = "77184e815128509653ea695fe85342df"
twilio_client = Client(twilio_sid, twilio_token)


def pprint(x):
    print(json.dumps(x, indent=2, sort_keys=True))


def process_list(l):
    return list(
        map(
            lambda x: x["name"],
            list(
                filter(lambda x: x["name"] in legal_foods and x["value"] > 0.7,
                       l))))

Beispiel #14
0
sid = data['twilioconfig']['sid']
auth_token = data['twilioconfig']['token']
from_ = data['twilioconfig']['number']
vacay_dt = data['vacay_date']


def countdownstr(nstr):
    # str of the format days, hours:minutes:seconds.microseconds
    daystr = nstr.split(',')[0] + ','
    hourstr = nstr.split(',')[1].split(':')[0] + ' hours, '
    minstr = nstr.split(',')[1].split(':')[1] + ' minutes, and '
    secstr = nstr.split(',')[1].split(':')[2].split('.')[0] + ' seconds'

    return 'Time until vacation is ' + daystr + hourstr + minstr + secstr


def timedeltastr():
    vacay = datetime.datetime(vacay_dt[0], vacay_dt[1], vacay_dt[2],
                              vacay_dt[3], vacay_dt[4])
    return str(vacay - datetime.datetime.now())


to_numbers = [data['numbersDict'][k] for k in data['numbersDict']]

client = Client(sid, auth_token)

timestr = countdownstr(timedeltastr())

for n in to_numbers:
    client.messages.create(to=n, from_=from_, body=timestr)
def main3():
    print("main3 has been started")
    account_sid = 'AC0a4967cd787a6ff9d833d778af5a82f2'
    auth_token = '4ca2e51948b023457d9dec3c3bad830c'
    client = Client(account_sid, auth_token)
    crnNumber = None
    allSeats = []
    round1 = []
    round2 = []
    starttime = time.time()

    programRunning = True
    counter = 0
    counter2 = 0

    def pullInfo(crnNumber):
        term2Chosen.clear()
        for i in range(len(list)):
            if (list[i] == crnNumber):
                for a in range(13):
                    term2Chosen.append(list[i + a])

    while programRunning == True:
        endpoint = "https://mystudentrecord.ucmerced.edu/pls/PROD/xhwschedule.P_ViewSchedule"
        payload = {
            "validterm": '201920 - S62',
            "subjcode": "ALL",
            "openclasses": "Y"
        }
        r = requests.post(endpoint, data=payload)
        #print(r.status_code)
        soup = bs(r.text, "html.parser")
        list = []

        #print(soup)

        for hit in soup.findAll(attrs={'class': 'dddefault'}):
            list.append(hit.text)

        allNumbers = []
        crnNumbers = []
        seatsAvailable = []
        classNames = []
        #print(list)
        #print(list)

        for i in range(len(list)):
            if len(list[i]) > 4:
                if list[i][3] == "-" or list[i][
                        4] == "-" and list[i][1] != ":" and list[i][2] != ":":
                    classNames.append(list[i])
            if list[i].isdigit() == True:
                if int(list[i]) < 500:
                    allNumbers.append(list[i])
                if len(list[i]) == 5 and list[i] != "Staff":
                    crnNumbers.append(list[i])

        for j in range(len(allNumbers)):
            if j % 4 == 3 and j > 2:
                seatsAvailable.append(allNumbers[j])

        if counter == 0:
            round1 = seatsAvailable.copy()
            #print(counter)
            counter = 1
        else:
            round2 = seatsAvailable.copy()
            #print(counter)
            counter = 0
        time.sleep(1)

        if round1 != round2:
            if counter2 > 1:
                for i in range(len(round1)):
                    if (round1[i] != round2[i]):
                        if counter2 % 2 == 0:
                            result = int(round1[i]) - int(round2[i])
                        else:
                            result = int(round2[i]) - int(round1[i])
                        if result == 1:
                            print("dropped spot")
                            print(
                                str(datetime.now().time().strftime(
                                    '%I:%M %p')) + " " + classNames[i] + "(" +
                                crnNumbers[i] + ") has just opened up with " +
                                seatsAvailable[i] + " available space(s)")
                            message = client.messages \
                                            .create(
                                                 body=(str(datetime.now().time().strftime('%I:%M %p'))+ " " + classNames[i] + "(" + crnNumbers[i] + ") has just opened up with " + seatsAvailable[i] + " available space(s)"),
                                                 from_='+19497993437',
                                                 to='+19713257738'
                                             )
                        else:
                            print(
                                str(datetime.now().time().strftime('%I:%M %p'))
                                + " " + classNames[i] + "(" + crnNumbers[i] +
                                ") has taken a spot, there are " +
                                seatsAvailable[i] + " available space(s)")

        #print(list)
        #print(len(classNames))
        #print(classNames)
        #print(len(seatsAvailable))
        #print(seatsAvailable)
        counter2 = counter2 + 1
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

client.recordings("RE557ce644e5ab84fa21cc21112e22c485") \
      .delete()
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

client.messages("MM800f449d0399ed014aae2bcc0cc2f2ec") \
      .media("ME557ce644e5ab84fa21cc21112e22c485") \
      .delete()
        )
        #want to include in the body the restaurant details specified by the user.

    #print(message.sid)

#----Set text message body based on eating in or eating out
if eatInEatOut == str(1):
    textBody = textBodyIngredients

elif eatInEatOut == str(2):
    textBody = textBodyRestaurant

#-----------------Twilio-------------------#
from twilio.rest import Client

clientA1 = "QUNjN2NhZmI3ZGZlZmY2YmQwOTRkZWVhNzYyNDdhNjAxOQ=="
clientB1 = "ZTZhOWRiNGNhZGJkMWZkMTAzMzk2YWExOGMzYzRkNzc="

clientA2 = base64.b64decode(clientA1)
clientB2 = base64.b64decode(clientB1)

client = Client(clientA2, clientB2)

if twilioConsoleSelection == 1:
    message = client.messages.create(to=userPhoneNumber,
                                     from_="+13232187649",
                                     body=textBody,
                                     media_url=rimage_url)

print('')
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

numbers = client.available_phone_numbers("GB") \
                .mobile \
                .list()

number = client.incoming_phone_numbers \
               .create(phone_number=numbers[0].phone_number)

print(number.sid)
Beispiel #20
0
def sms():
    account_sid = os.getenv('ACCOUNT_SID')
    auth_token = os.getenv('AUTH_TOKEN')
    client = Client(account_sid, auth_token)

    if request.method == 'POST':
        number = "+1" + request.form['number']
        project_path = request.form['address']
        user_agent = {
            'user-agent':
            'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0'
        }
        geo_client = GeocodioClient(os.getenv('GEOCODIO_KEY'))
        try:
            location1 = geo_client.geocode(project_path)
            coords = location1.coords
            try:
                url = 'https://api.weather.gov/points/' + str(
                    coords[0]) + ',' + str(coords[1])
            except:
                return "National Weather Service lookup failed."
                sys.exit(1)
        except:
            return "Location not found. Please ensure the address was entered correctly."
            sys.exit(1)

        data = requests.get(url, headers=user_agent)
        location_data = data.json()
        cwa = location_data['properties']['cwa']
        location_url = location_data['properties']['forecast']
        forecast = requests.get(location_url)
        forecast_json = forecast.json()

        forecast_day_list = []
        forecast_list = []

        for x in range(0, 4):
            forecast_day = str(
                forecast_json['properties']['periods'][x]['name'])
            forecast_day_list.append(forecast_day)
            forecast = str(
                forecast_json['properties']['periods'][x]['detailedForecast'])
            forecast_list.append(forecast)

        custom = []

        custom.append(forecast_day_list[0])
        custom.append(forecast_list[0])
        custom.append(forecast_day_list[1])
        custom.append(forecast_list[1])
        custom.append(forecast_day_list[2])
        custom.append(forecast_list[2])
        custom.append(forecast_day_list[3])
        custom.append(forecast_list[3])

        body = ("Here's your weather report for " + project_path + ": " +
                "\n\n" + custom[0] + ': ' + custom[1] + '\n\n' + custom[2] +
                ': ' + custom[3] + "\n\n" + custom[4] + ': ' + custom[5] +
                '\n\n' + custom[6] + ': ' + custom[7] + "\n\n" +
                "Enjoy your day!")

        message = client.messages \
                       .create(
                            body=body,
                            from_='+12058945876',
                            to=number
                        )

    return render_template('weather.html')
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

numbers = client.available_phone_numbers("US") \
                .local \
                .list(area_code="510")

number = client.incoming_phone_numbers \
               .create(phone_number=numbers[0].phone_number)

print(number.sid)
from twilio.rest import Client
import os

account_sid = os.environ.get("ACCOUNT_SID")
api_key = os.environ.get("API_KEY")
api_secret = os.environ.get("API_SECRET")

client = Client(api_key, api_secret, account_sid)

message = client.messages \
    .create(
         body='Congratz! Your RSL APP Wallet is credited with AED 50 as a part of our cashback campaign. Hurry up. Book a ride now and pay with your wallet. http://onelink.to/rslapp',
         from_='+18178358402',
         to='+971522379218'
     )

print(message.sid)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

client.notifications("NO5a7a84730f529f0a76b3e30c01315d1a") \
      .delete()
Beispiel #24
0
import yaml
from twilio.rest import Client

with open("config.yaml", "r") as f:
    settings = yaml.load(f, Loader=yaml.Loader)

twilio = Client(settings["twilio"]["sid"], settings["twilio"]["token"])
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

numbers = client.available_phone_numbers("US") \
                .local \
                .list(near_lat_long="37.840699,-122.461853",
                      distance="50",
                      contains="555",
                      in_region="CA")

number = client.incoming_phone_numbers \
               .create(phone_number=numbers[0].phone_number)

print(number.sid)
Beispiel #26
0
def send_message(text):
    client = Client(account_sid, auth_token)
    client.messages.create(to='+918800568420', from_=+15097743039, body=text)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

numbers = client.available_phone_numbers("US").toll_free.list()

number = client.incoming_phone_numbers.create(phone_number=numbers[0].phone_number)

print(number.sid)
 def __init__(self):
     self.client = Client(TWILIO_SID, TWILIO_AUTH_TOKEN)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

client.messages("MM800f449d0399ed014aae2bcc0cc2f2ec") \
      .update(body="")
Beispiel #30
0
from twilio.rest import Client
import config

client = Client(config.account_sid, config.auth_token)

call = client.messages.create(to="...",
                              from_="...",
                              body="This is our first message")
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
sms = client.messages("SM800f449d0399ed014aae2bcc0cc2f2ec") \
            .fetch()

print(sms.body.encode('utf-8'))
Beispiel #32
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

client.transcriptions('TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

queue = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
              .fetch()

print(queue.average_wait_time)
import os
import time
from collections import OrderedDict
from threading import Thread

from flask import Flask, Response, request
from twilio.rest import Client
from twilio.twiml.voice_response import Dial, VoiceResponse

app = Flask(__name__)
client = Client()

# This should be set to the publicly reachable URL for your application.
# This could an ngrok URL, such as "https://17224f9e.ngrok.io".
# Do not include trailing slash when setting this variable.
BASE_URL = os.environ.get("BASE_URL", "http://XXXXXXXXXXXX.ngrok.io")

# There must be at least one phone number listed in order for the app to start.
# Be careful about committing real phone numbers to source control. Numbers in
# this list must be E.164 formatted.
AGENT_NUMBERS = ["+15555555555"]

# These two queues should be empty on application startup. For the sake of
# simplicitly, these variables are defined at the global scope. For a
# production call-center, a more sophisticated approach should be taken.
CUSTOMER_QUEUE = OrderedDict()
AGENT_QUEUE = OrderedDict()


class CustomerRedirect(Thread):
    """
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

caller_id = client.outgoing_caller_ids("PNe905d7e6b410746a0fb08c57e5a186f3") \
                  .fetch()

print(caller_id.phone_number)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account = "ACCOUNT_SID"
token = "AUTH_TOKEN"
client = Client(account, token)

# Retrieve the service
service = client.chat.services("SERVICE_SID").fetch()

print(service.friendly_name)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = Client(account_sid, auth_token)

account = client.accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()
print(account.date_created)
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = '"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

client.conferences("CFbbe4632a3c49700934481addd5ce1659") \
      .participants("CA386025c9bf5d6052a1d1ea42b4d16662") \
      .delete()
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"

client = Client(account_sid, auth_token)

new_sub_account = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
number_sid = "PN2a0747eba6abf96b7e3c3ff0b4530f6e"

number = client.incoming_phone_numbers(number_sid).update(
    account_sid=new_sub_account
)

print(number.phone_number)
Beispiel #40
0
    if "dhyeya" in str(driver.page_source):
        break

for j in range(1, 5):

    url2 = "https://www.fiverr.com/categories/programming-tech/data-analysis-services/data-mining-scraping?page={j}&offset=-1"
    driver.get(url2)
    if "dhyeya" in str(driver.page_source):
        break

print(i, j)

if (state1 != i or state2 != j):
    if state1 != i:
        msg = "Web scraping one went to " + i
        whatsapp_client = Client(twilio_sid, auth_token)
        contact = {"Dhyeya": "+917600665380"}

        for key, value in contact.items():
            msg_sent = whatsapp_client.messages.create(
                body=msg,
                from_='whatsapp:+14155238886',
                to='whatsapp:' + value,
            )

    if state2 != j:
        msg = "Main category one went to " + j
        for key, value in contact.items():
            msg_sent = whatsapp_client.messages.create(
                body=msg,
                from_='whatsapp:+14155238886',
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

member = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
               .members("CA5ef8732a3c49700934481addd5ce1659") \
               .update(url="http://demo.twilio.com/docs/voice.xml",
                       method="POST")

print(member.position)
Beispiel #42
0
from twilio.rest import Client

from settings.models import TwilioSetting

twilio_obj = TwilioSetting.objects.first()
client = Client(twilio_obj.account_sid,
                twilio_obj.auth_token) if twilio_obj else None


def send_sms(users, site):
    site_name = site.site_name
    site_url = site.site_url
    for user in users:
        if user.mobile and client:
            client.messages.create(
                to=user.mobile,
                from_=twilio_obj.phone_number,
                body="You site is not responding. Site Name- " + site_name +
                ", Site URL- " + site_url)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

numbers = client.available_phone_numbers("US") \
                .local \
                .list(contains="STORM")

number = client.incoming_phone_numbers \
               .create(phone_number=numbers[0].phone_number)

print(number.sid)
Beispiel #44
0
 def __init__(self, token, sid, number):
     self.client = Client(sid, token)
     self.number = number
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

call = client.calls("CAe1644a7eed5088b159577c5802d8be38") \
             .update(url="http://demo.twilio.com/docs/voice.xml",
                     method="POST")

print(call.to)
import boto3
from boto3.s3.transfer import S3Transfer
from twilio.rest import Client
import os
import time

from config import ACCOUNT_SID, AUTH_TOKEN, TWILIO_NUMBER, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION, S3_BUCKET

client = Client(ACCOUNT_SID, AUTH_TOKEN)


def send_sms(message, phone_number):
    client.messages.create(body=message, from_=TWILIO_NUMBER, to=phone_number)


def send_mms(file_name, phone_number):
    # Find file locally
    for root, dirs, files in os.walk(os.getcwd()):
        if file_name in files:
            absolute_file_location = os.path.join(root, file_name)
            break

    # Upload file to AWS
    credentials = {
        'aws_access_key_id': AWS_ACCESS_KEY_ID,
        'aws_secret_access_key': AWS_SECRET_ACCESS_KEY
    }

    s3_client = boto3.client('s3', AWS_DEFAULT_REGION, **credentials)
    transfer = S3Transfer(s3_client)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

client.conferences('CFbbe4632a3c49700934481addd5ce1659') \
      .participants("CA386025c9bf5d6052a1d1ea42b4d16662") \
      .delete()
import datetime
from twilio.rest import Client
from config import TWILIO_ACCOUNT, TWILIO_TOKEN
twilio_client = Client(twilio_account, twilio_token)


class Messenger(object):
    def __init__(self):
        pass

    def send_reminder(self, notify_minutes):
        twilio_client.messages.create(
            to="+447871312430",
            from_="+447533046914",
            body="Your next bus will be at your stop in " +
            str(notify_minutes) + ".")
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

numbers = client.available_phone_numbers("US") \
                .local \
                .list(exclude_local_address_required=True)

number = client.incoming_phone_numbers \
               .create(phone_number=numbers[0].phone_number)

print(number.sid)
from twilio.rest import Client
from variables import Variables
from messages import *
import requests
from models import MessagesSent
from datetime import datetime, timedelta

client = Client(Variables.account_sid, Variables.auth_token)  # twilio client


def sendWAMessage(mediaURLS, body, phoneNumber):
    message = client.messages \
    .create(
        media_url=mediaURLS,
        from_=Variables.whatsappSender,
        body=body,
        to='whatsapp:+'+phoneNumber
    )


def prepareTGMessage(mediaURLS, body, tgId):
    json_data = {}
    json_data["chat_id"] = tgId
    if len(mediaURLS) > 0:
        json_data["caption"] = body
        json_data["photo"] = mediaURLS[0]
        reqType = "sendPhoto"
    else:
        json_data["text"] = body
        reqType = "sendMessage"
    return {"data": json_data, "reqType": reqType}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

feedback = client.calls("CAe03b7cd806070d1f32bdb7f1046a41c0") \
                 .feedback() \
                 .fetch()

print(feedback.date_created)
Beispiel #52
0
from twilio.rest import Client
from flask import Flask
from twilio.twiml.voice_response import VoiceResponse

yourSID = "Enter your Account SID"

yourAuth_Token = "Enter your Auth Token"


client = Client(yourSID, yourAuth_Token)

# For flooding calls set inside of infinite loop

# while True:  
#
#     client.messages.create(
#         to=phone_number,
#         from_="+13522681589",
#         body="Gotcha!")

twilioNumber = "Enter your Twilio Number"

numberToCall = "Enter desired number to call or flood"



call = client.calls.create(to=numberToCall,from_=twilioNumber, #These can be pulled from another file as well if you have a list of numbers
                           url='Location where your XML file is')

# print(client.sid)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

member = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
               .members("CA386025c9bf5d6052a1d1ea42b4d16662") \
               .fetch();

print(member.wait_time)
 def __init__(self):
     
     self.client = Client(config.TWILIO_SID, config.TWILIO_TOKEN)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

transcription_sid = "TR8c61027b709ffb038236612dc5af8723"
transcription = client.transcriptions(transcription_sid).fetch()

print(transcription.transcription_text)
Beispiel #56
0
# -*- coding: utf-8 -*-
"""Mini script to send a text to my self."""

import os
import uuid

from twilio.rest import Client

my_phone_number = os.environ["MY_PHONE_NUMBER"]
twilio_phone_number = os.environ["TWILIO_PHONE_NUMBER"]
twilio_account_sid = os.environ["TWILIO_ACCOUNT_SID"]
twilio_auth_token = os.environ["TWILIO_AUTH_TOKEN"]

client = Client(twilio_account_sid, twilio_auth_token)

uuid_code = uuid.uuid4().hex[:5]

client.messages.create(
    to=my_phone_number,
    from_=twilio_phone_number,
    body="Here is your code you wanted: {0}".format(uuid_code),
)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

client.outgoing_caller_ids("PNe536d32a3c49700934481addd5ce1659") \
      .delete()





import imaplib
import email
import os
from twilio.rest import Client

# Your Account SID from twilio.com/console
account_sid = "ACc7a27cd4b692873ee03635c06e440656"
# Your Auth Token from twilio.com/console
auth_token  = "725cab644969352a2255eaf5da893d33"
client = Client(account_sid, auth_token)
def send_whatsapp(email_from,email_subject):
#    client = Client()

    message = client.messages.create(
        to="whatsapp:+917045210378",
        from_="whatsapp:+14155238886",
        body=email_from+email_subject)

    print(message.sid)
# import csv
done_mails=[]
while True:
    count = ''
    try:
        mail = imaplib.IMAP4_SSL('imap.gmail.com')	
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

numbers = client.available_phone_numbers("US") \
                .toll_free \
                .list(contains="KYLO", area_code="800")

number = client.incoming_phone_numbers \
               .create(phone_number=numbers[0].phone_number)

print(number.sid)
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

client.messages("MM800f449d0399ed014aae2bcc0cc2f2ec") \
      .delete() # Deletes entire message record