Rename a group with Node.js continued

Have a group already?

If you have an existing group in mind, skip ahead to the next section.

Name a group

This part shows how to create a group and name it simultaneously. First things first, any string less than or equal to 20 characters is allowable.

To name a group of contacts, you can either do it during intial group creation or you can update the group to include a name. We have included both code samples.

The parameter we're working with for group naming is aptly called name.

Create a file

This part covers how to name a group at the time the group is created.

  1. Create a new file called nameGroup.mdx.
  1. Paste the code in from the "Name a group" file.
  2. Assign your values to the following parameters:
ParameterYour value
YOUR_service_plan_idThe service plan ID found on your Sinch Customer Dashboard. SMS > APIs > REST configuration
YOUR_API_tokenThe API token found on your Sinch Customer dashboard. SMS > APIs > REST configuration > Click Show to reveal your API token.
membersIn this example, descriptions are listed. You'll want to replace these with phone numbers (MSISDNs) including the country code. With or without the leading +.
nameThe name you'd like to give your group of contacts. Example: name: "Spelunking Group"
  1. Run the code
    Copy
    Copied
    node nameGroup.mjs

Response

Be sure to copy the group id if you plan on updating the name of the group in the next step.
Copy
Copied
{
"id": "XXXXX6621XXXXX119Z8PMXXXXX",
"name": "Spelunking Group",
"size": 2,
"created_at": "2022-08-24T14:15:22Z",
"modified_at": "2022-08-24T14:15:22Z",
}
Go Back
We'd love to hear from you!
Rate this content:
Still have a question?
 
Ask the community.