Question: Twilio As Sms Is Not Working

Twilio As Sms Is Not Working

Please read error message from SMS LOGS: [2023-11-04 20:37:48] SMS.ERROR: Twilio response {"error":"Client error: `POST https://api.twilio.com/2010-04-01/Accounts/AC23aab2d14ad515d0107f23

RR

Rod Romo

Asked
Please read error message from SMS LOGS:

[2023-11-04 20:37:48] SMS.ERROR: Twilio response {"error":"Client error: `POST https://api.twilio.com/2010-04-01/Accounts/AC23aab2d14ad515d0107f23add4607c33/Messages.json` resulted in a `400 Bad Request` response:\n{\"code\": 21604, \"message\": \"A 'To' phone number is required.\", \"more_info\": \"https://www.twilio.com/docs/errors/21604\", (truncated...)\n"} []


Please advise about this, I read previous about the same error, but there is not clear solution for this issue:
  • MS

    Mian Saleem

    Answered
    Hello,

    As error says the To is not sent. Please use the custom provider.

    `send_to_name` is the variable label/name for the to mobile number like `mobile=+601111442122` I think in your case it's `to`

    `msg_name` is the variable label/name for the message body like `message=This is sms text` or `body=This is sms text` I think in your case it's `body`

    You need `from` like `From=+<TWILIO_PHONE_NUMBER>` and the `account_sid` & `auth_token`

    ![Twilio Postman!](https://twilio-cms-prod.s3.amazonaws.com/images/successful_send.width-800.png) This image might be helpful.

    If you can try from terminal this is from their site

    ```
    curl -X POST https://api.twilio.com/2010-04-01/Accounts/{{ACCOUNT_SID}}/Messages.json \
    --data-urlencode "From=+<TWILIO_PHONE_NUMBER>" \
    --data-urlencode "Body=body" \
    --data-urlencode "To=+<YOUR PHONE_NUMBER>" \
    -u your_account_sid:your_auth_token
    ```

    So you can try with these

    ```txt
    URL = https://api.twilio.com/2010-04-01/Accounts/YourAccountSIDHere/Messages.json
    Send to name = To
    Message name = Body
    Param1 label = account_sid
    Param1 value = YourSID
    Param2 label = auth_token
    Param2 value = YourAuthToken
    Param3 label = From
    Param3 value = YourFromNumber
    ```

    Thank you
  • Login to Reply