# How to generate Whatsapp List dynamically

**URL:** <https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623>\
**Category:** Channels\
**Tags:** whatsapp\
**Created:** [November 13, 2021, 11:39am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623 "2021-11-13T11:39:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarshanPatel11](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@DarshanPatel11](https://community.yellow.ai/u/DarshanPatel11)\
**Post date:** [November 13, 2021, 11:39am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/1 "2021-11-13T11:39:20Z")

</div>

I am building a flow in which I want to populate the WhatsApp list dynamically using API response. I went through the documentation and found a sample schema for quick replies but not for the Whatsapp List. So, How to achieve this?

---

<div class="post-metadata">

**Author:** ![Pratik](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.yellow.ai/pratik/32/69_2.png) [@Pratik](https://community.yellow.ai/u/Pratik)\
**Post date:** [November 16, 2021, 5:04am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/2 "2021-11-16T05:04:45Z")

</div>

Hey @DarshanPatel11,

We launched this feature last week only! You can use the following code snippet to dynamically populate WhatsApp List:

```auto

{
       title: 'Please select your preferred slot for Appointment',
       optionText: 'Appointment Slots',
       options: [
           {
               section: 'June 5, 2021',
               options: [
                   { title: '9am-11am', text: '5.9-5', description: 'General Medicine' },
                   { title: '12pm-2pm', text: '5.12-2', description: 'Orthopedic' },
                   { title: '2pm-4pm', text: '5.2-4', description: 'Physiotherapy' },
               ]
           },
           {
               section: 'June 6, 2021',
               options: [
                   { title: '9am-11am', text: '6.9-5', description: 'General Medicine' },
                   { title: '12pm-2pm', text: '6.12-2', description: 'Orthopedic' },
                   { title: '2pm-4pm', text: '6.2-4', description: 'Physiotherapy' },
               ]
           }, {
               section: 'June 7, 2021',
               options: [
                   { title: '9am-11am', text: '7.9-5', description: 'General Medicine' },
                   { title: '12pm-2pm', text: '7.12-2', description: 'Orthopedic' },
                   { title: '2pm-4pm', text: '7.2-4', description: 'Physiotherapy' },
               ]
           }
       ],
       footer: 'Please follow Covid Guideline while consulting.'
   }

```

---

<div class="post-metadata">

**Author:** ![DarshanPatel11](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@DarshanPatel11](https://community.yellow.ai/u/DarshanPatel11)\
**Post date:** [November 17, 2021, 6:01am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/3 "2021-11-17T06:01:21Z")

</div>

I tried the code snippet you gave, I am not getting any error in the logs, but Whatsapp List is not being sent to User via bot.

{“level”:“debug”,“log”:{“data”:“Executing Message Type [waList]”,“sender”:“918488862479”,“source”:“whatsapp”,“tag”:"",“traceId”:“918488862479\_undefined”},“botId”:“x1632306469977”}

{“level”:“info”,“log”:{“data”:“Finished Executution for Async sources”,“sender”:“918488862479”,“source”:“whatsapp”,“tag”:"",“traceId”:“918488862479\_undefined”},“botId”:“x1632306469977”}

---

<div class="post-metadata">

**Author:** ![Pratik](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.yellow.ai/pratik/32/69_2.png) [@Pratik](https://community.yellow.ai/u/Pratik)\
**Post date:** [November 18, 2021, 4:35am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/4 "2021-11-18T04:35:51Z")

</div>

No problem @DarshanPatel11 ! Can you please share your bot access with admin preveilage with me at pratik@yellow.ai?

---

<div class="post-metadata">

**Author:** ![narandhran](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.yellow.ai/narandhran/32/1276_2.png) [@narandhran](https://community.yellow.ai/u/narandhran)\
**Post date:** [May 5, 2022, 4:24am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/5 "2022-05-05T04:24:21Z")

</div>

@Pratik from `{ title: '9am-11am', text: '5.9-5', description: 'General Medicine' }`

When user select the item from the list `text` is the value to be stored in the variable right?

But that is not working, `text` is not accessible.

---

<div class="post-metadata">

**Author:** ![chandan\_pandey](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.yellow.ai/chandan_pandey/32/1778_2.png) [@chandan\_pandey](https://community.yellow.ai/u/chandan_pandey)\
**Post date:** [November 26, 2022, 8:14am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/6 "2022-11-26T08:14:34Z")

</div>

I am having the same issue. Sir, if you have got the solution. Can you please share?

---

<div class="post-metadata">

**Author:** ![Prathap\_P\_S](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.yellow.ai/prathap_p_s/32/2154_2.png) [@Prathap\_P\_S](https://community.yellow.ai/u/Prathap_P_S)\
**Post date:** [March 29, 2023, 7:12am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/7 "2023-03-29T07:12:43Z")

</div>

@Pratik Hey Pratik, the issue at hand is to convert an api response containing date and time slots using a js function to fit into the format that will be supported by WA list node. if this code exists already in your repository, please share that across. TIA 🙂

---

<div class="post-metadata">

**Author:** ![Jayesh\_Rana](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.yellow.ai/jayesh_rana/32/943_2.png) [@Jayesh\_Rana](https://community.yellow.ai/u/Jayesh_Rana)\
**Post date:** [March 29, 2023, 12:14pm UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/8 "2023-03-29T12:14:05Z")

</div>

Hey @DarshanPatel11 if your API response is coming in object then you have to convert that object into array and then you can pass that in a WA list. Because WA list take Array data.

---

<div class="post-metadata">

**Author:** ![Prathap\_P\_S](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.yellow.ai/prathap_p_s/32/2154_2.png) [@Prathap\_P\_S](https://community.yellow.ai/u/Prathap_P_S)\
**Post date:** [March 30, 2023, 6:24am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/9 "2023-03-30T06:24:06Z")

</div>

@Jayesh_Rana hey I’m stuck with building the array data in the format similar to the sample data that the node accepts. Is there any predefined js code available for the same ? Please share across. TIA.

---

<div class="post-metadata">

**Author:** ![Parthiban\_J](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.yellow.ai/parthiban_j/32/939_2.png) [@Parthiban\_J](https://community.yellow.ai/u/Parthiban_J)\
**Post date:** [March 30, 2023, 6:40am UTC](https://community.yellow.ai/t/how-to-generate-whatsapp-list-dynamically/1623/10 "2023-03-30T06:40:16Z")

</div>

Hello, @Prathap_P_S The datatype for passing WhatsApp list details is an object.  
You can find more information in the document below.

> **[Prompt Nodes | yellow.ai](https://docs.yellow.ai/docs/platform_concepts/studio/build/nodes/prompt-nodes#22-whatsapp-list)**
>
> Prompts are Interactive or conversational nodes, which expect user input. When a user provides an invalid input to the prompt, a fallback message will be displayed.

Pass the object variable through **fetch from** and get the WhatsApp list response in **Store response in** , which should be a string. The text value will be returned in that response.

 ![Screenshot 2023-03-30 at 12.04.25 PM](https://canada1.discourse-cdn.com/flex035/uploads/yellowmessenger1/original/2X/c/c5fcaddef9fd6be8742a078d68ff3e83a6da2989.png)

Note: The WhatsApp list feature will not accept duplicate text values.
