twilio / twilio-go

A Go package for communicating with the Twilio API.
MIT License
290 stars 40 forks source link

VerifyV2.CreateVerification error #177

Closed liveyourheart closed 2 years ago

liveyourheart commented 2 years ago

Issue Summary

I am receiving an Invalid parameter (null) error when using the verifyV2.CreateVerification function.

Steps to Reproduce

  1. create verification service
  2. attempt to create verification

Code Snippet

func (v *MobileVerifier) VerifyRequestTest() (err error) {
    p := openapi.CreateVerificationParams{}
    p.SetTo("+{myphonenumber}")
    p.SetChannel("sms")

    log.Printf("v: %#v", v.accountSID)
    log.Printf("p: %#v", *p.To)

    verification, err := v.client.VerifyV2.CreateVerification(v.accountSID, &p)
    if err != nil {
        err = fmt.Errorf("v.client.VerifyV2.CreateVerification: %w", err)
        return
    }
    log.Printf("%+v", verification)
    return
}

Exception/Log

error occurred: v.client.VerifyV2.CreateVerification: Status: 400 - ApiError 60200: Invalid parameter (null) More info: https://www.twilio.com/docs/errors/60200

Technical details:

childish-sambino commented 2 years ago

It's an odd error message, but I think it's caused by using an accountSID as the first arg to CreateVerification when it should be a verifications service SID in your snippet.

liveyourheart commented 2 years ago

you're 100% correct on that. I just realized that as well. Thanks so much!