Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supplying Items to a list template does not work (validation errors) #1065

Open
rozzrr opened this issue Jan 15, 2025 · 0 comments
Open

Supplying Items to a list template does not work (validation errors) #1065

rozzrr opened this issue Jan 15, 2025 · 0 comments

Comments

@rozzrr
Copy link

rozzrr commented Jan 15, 2025

Issue Summary

using the nodejs library i expect that when i do the following :

const list_picker : TwilioListPicker = {
body: "bodyText",
button: "buttonText",
items: [{
id : "1",
item : "item_name",
description : "item_descr"
}]
}

        await client.messages.create({
            contentSid : message.templateId,
            from : message.from,
            to : message.to,
            contentVariables : JSON.stringify(list_picker),
        });

this will provide a series of options to the whatsapp user, however this does not an we are met with validation errors

what does work is this:

const list_picker : TwilioListPicker = {
body: "bodyText",
button: "buttonText",
id : "1",
item : "item_name",
description : "item_descr"
}

        await client.messages.create({
            contentSid : message.templateId,
            from : message.from,
            to : message.to,
            contentVariables : JSON.stringify(list_picker),
        });

which then is valid...

so this means we cannot send an array of items, but only a single one.

Steps to Reproduce

  1. Set up a list item picker template
  2. send a message providing a list of items to pick from in 'items' array
  3. notice the errors from the sdk when this happens (even though all params match up to the varibles in the template)

Code Snippet

 //works
 const list_picker : TwilioListPicker = {
                body: "bodyText",
                button: "buttonText",
                id : "1",
                item : "item_name",
                description : "item_descr"
            }

            await client.messages.create({
                contentSid : message.templateId,
                from : message.from,
                to : message.to,
                contentVariables : JSON.stringify(list_picker),
            });



//doesnt work

 const list_picker : TwilioListPicker = {
                body: "bodyText",
                button: "buttonText",
                items: [{
                    id : "1",
                    item : "item_name",
                    description : "item_descr"
                }]
            }

            await client.messages.create({
                contentSid : message.templateId,
                from : message.from,
                to : message.to,
                contentVariables : JSON.stringify(list_picker),
            });

Exception/Log

(https://www.twilio.com/docs/api/errors/20422)

Technical details:

  • twilio-node version:
  • node version:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant