Create groups tutorial continued

To organize your groups into categories, we'll create parent groups.

Create a parent group

  1. 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.
  2. Replace the body of the index.mjs file with something similar to this payload:
    Copy
    Copied
      body: JSON.stringify({
        name: 'Axe Throwers',
        child_groups: [
          'each_group_id',
          '0XXXX3KBMRJQ8A0XX2CZXXXXXX',
          '01XXJ3HFXXT3CA0X1NGZCXXXXX'
        ]
  3. Paste in the group id for each of the groups you created under child_groups.
  4. Save your file.
  5. Run the code again.
    Copy
    Copied
    node index.mjs

Successful response

A successful response will show the new parent id as well as the child groups that parent group contains.

Copy
Copied
{
  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.

Go back

Next steps

Was this page helpful?