Creating a Registrant with Node and JWT

Description
Error creating a Registrant via API, JWT, and node.

Error
For some reason I am getting this error, even though I have removed ‘customer_questions’ from the body.
body: {
code: 300,
message: ‘The parameter is required in custom_questions: State or Province.’
},

Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT

Which Endpoint/s?
api.zoom.us/v2/webinars/" + req.params.id + “/registrants”,

How To Reproduce (If applicable)
Steps to reproduce the behavior:

  1. POST
    const registrant = {
    “email”: “sjfkghdsg@someemail.dfgjd”,
    “first_name”: “Jill”,
    “last_name”: “Chill”,
    “address”: “dsfhkdjsfh st”,
    “city”: “jackson heights”,
    “country”: “US”,
    “zip”: “11371”,
    “state”: “NY”,
    “phone”: “0000000000”,
    “org”: “WHYTRYTEST”,
    “job_title”: “Moon walker”
    };
    const options = {
    uri: “https://api.zoom.us/v2/webinars/” + req.params.id + “/registrants”,
    qs: {status: ‘active’},
    auth: {‘bearer’: token},
    headers: {‘User-Agent’: ‘Zoom-api-Jwt-Request’, ‘content-type’: ‘application/json’},
    method:‘GET’,
    json: true
    };
    exports.webinarRegistrantsAdd = async (req, res) => {
    options.body = registrant;
    rp(opts)
    .then(function (response) {
    res.send(response);
    })
    .catch(function (err) {
    console.log('API call failed, reason ', err);
    });
    }

Screenshots (If applicable)
If applicable, add screenshots to help explain your problem.

Additional context
The docs say that only name and email are required, but got errors saying to provide city, state, and country, which I did, until I got to the this error: ‘The parameter is required in custom_questions: State or Province.’

Any suggestions would be appreciated, thank you.

Hi @ssoward,

Thanks for reaching out, and happy to help. First, I should note that state and province are note required fields, you’re correct. I haven’t been able to reproduce the exact error you’re receiving—however, can you please try the following request in either Postman or cURL?:

Host: api.zoom.us
Content-Type: application/json
Authorization: Bearer <token>

{
  "email": "example@someemail.dfgjd",
  "first_name": "Phill",
  "last_name": "Chill"
}

I also noticed that within const options, you have “method: GET” — please ensure your request is a POST request if you’re trying to add a webinar registrant.

Let me know if you’re able to successfully send the request in Postman or the like!

Thanks,
Will

Hello Will,

Thanks so much for your response.

The GET you noticed is dynamically updated to a POST. I should have clarified that.

I tried as you mentioned and got the login page for zoom.
I updated your example with a specific webinar id in the url: https://api.zoom.us/v2/webinars/93297196054/registrants
And with the body you suggested:
{
“email”: “example@someemail.dfgjd”,
“first_name”: “Phill”,
“last_name”: “Chill”
}
and got:
{“code”:300,“message”:“The parameter is required: city.”}

I proceed to solve the 300 errors until I get to this:
Body:
{
“email”: “example@someemail.dfgjd”,
“first_name”: “Phill”,
“last_name”: “Chill”,
“city”:“Cincinnati”,
“country”:“US”,
“zip”:12345,
“phone”:1111111111,
“org”:“testorg”,
“job_title”:“testJobTitle”
}

Result:
{“code”:300,“message”:“The parameter is required in custom_questions: State or Province.”}

Also, I have these GETs working fine, suggesting that the auth is setup correctly:
…api.zoom.us/v2/webinars/93297196054
…api.zoom.us/v2/webinars/93297196054/registrants

Hi @ssoward,

Thanks for confirming those details.

Can you let me know if any custom registration questions have already been created for this webinar in the UI by any chance? If so, these could be the reason you’re being required to pass these fields. This post covers a similar issue:

If that’s not the case, let me know and I’ll be happy to escalate this if necessary!

Best,
Will

That worked! THANK YOU. And for anyone reading this, this was the template of the successful POST:
And the ‘value’ of the custom_question needs to be valid.

{
"email": "sjfkghdsg@someemail.dfgjd",
"first_name": "Jill",
"last_name": "Chill",
"city": "jackson heights",
"country": "US",
"zip": "11371",
"state": "Utah",
"phone": "0000000000",
"org": "WHYTRYTEST",
"job_title": "Moon walker",
"custom_questions": [
    {
        "title": "State or Province",
        "value": "Utah"
    }
]

};

@ssoward — So happy to hear that resolved the issue! :slight_smile:

Best,
Will

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.