1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Twilio SMS not getting the answer in wait and reply widget

Discussão em 'Python' iniciado por Stack, Setembro 16, 2024.

  1. Stack

    Stack Membro Participativo

    My goal is to send an SMS containing the full Twilio Studio flow via the REST API. While I can successfully send the initial messages, the issue arises when the recipient replies. Their response is not being captured or processed by Twilio, and there is no follow-up interaction. How should I structure the entire process or make some special configuration to ensure that responses to the SMS are captured and that the conversation flow continues as expected?

    I tried using the Twilio REST API to trigger a Studio flow by sending an SMS. The first message is delivered successfully, but when I reply to the SMS, my response isn’t processed, and the conversation doesn’t continue. I also found that the flow works when I use a US phone number ('+14236...'), but not when I use my local Peruvian number. When I use my number, I receive the following error: 'TwilioRestException: HTTP 400 error: Unable to create record: 'From' +519... is not a Twilio phone number or Short Code country mismatch.' I’ve read similar questions online, but none of them provided a solution. I would really appreciate any help with this issue.

    # Download the helper library from https://www.twilio.com/docs/python/install
    import os
    from twilio.rest import Client

    # Find your Account SID and Auth Token at twilio.com/console
    # and set the environment variables. See http://twil.io/secure
    account_sid = os.environ["TWILIO_ACCOUNT_SID"]
    auth_token = os.environ["TWILIO_AUTH_TOKEN"]
    client = Client(account_sid, auth_token)

    execution = client.studio.v1.flows(
    "FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    ).executions.create(to="+1........", from_="+1.......")

    print(execution.sid)

    Continue reading...

Compartilhe esta Página