Create groups tutorial continued
To organize your groups into categories, we'll create parent groups.
Create a parent group
- Gather the
id
of each group that will go into this new parent group. The groups we just created will now become children of this parent group. - Replace the body of the
index.mjs
file with something similar to this payload:body: JSON.stringify({ name: 'Axe Throwers', child_groups: [ 'each_group_id', '0XXXX3KBMRJQ8A0XX2CZXXXXXX', '01XXJ3HFXXT3CA0X1NGZCXXXXX' ]
- Paste in the group
id
for each of the groups you created underchild_groups
. - Save your file.
- Run the code again.
node index.mjs
Successful response
A successful response will show the new parent id
as well as the child groups that parent group contains.
{
id: 'XXG0XXTJXXA3JV0W5QMHXXXXXX',
name: 'Axe Throwers',
size: 0,
created_at: '2022-04-13T18:43:58.525Z',
modified_at: '2022-04-13T18:43:58.525Z',
child_groups: [ '0XXXX3KBMRJQ8A0XX2CZXXXXXX', '01XXJ3HFXXT3CA0X1NGZCXXXXX' ]
}
That's it! You've organized your SMS groups into a parent group.
List all groups
Once you get the ball rolling on your grouping, use the GET List Groups method from the API reference to list all of your groups.
Next steps
- Find other useful code samples in our API reference.
- Check out another tutorial.