Managing Users
The Vonage CLI can be used to create and manage users, an object that identifies a unique Vonage user in the context of a Vonage Application. You can read more about conversations and users in the Conversation API documentation.
Create a User
The vonage users create command allows you to create a user. You can set their details and channel specific configurations using the flags below:
User
| Flag | Description | Type |
|---|---|---|
--name | Your internal user name. Must be unique. If not supplied a randomly generated name will be used. | String |
--display-name | The public facing name of the user. | String |
--image-url | A URL to an image to associate with the user. | String |
--custom-data | Custom data (as JSON) to associate with the user. | String |
--ttl | Time to leave. After how many seconds an empty user is deleted. | Number |
PSTN
| Flag | Description | Type |
|---|---|---|
--pstn-number | Phone number to associate with the user | Array |
SIP
| Flag | Description | Type |
|---|---|---|
--sip-url | SIP URL to associate with the user | Array |
--sip-username | SIP username to associate with the user | Array |
--sip-password | SIP password to associate with the user | Array |
WebSocket
| Flag | Description | Type |
|---|---|---|
--websocket-url | Websocket URL to associate with the user | Array |
--websocket-content-type | Websocket content type to associate with the user | Array |
--websocket-headers | Websocket headers (input as JSON) to associate with the user | Array |
SMS
| Flag | Description | Type |
|---|---|---|
--sms-number | Phone number that this user can send/receive SMS from | Array |
MMS
| Flag | Description | Type |
|---|---|---|
--mms-number | Phone number that this user can send/receive MMS from | Array |
| Flag | Description | Type |
|---|---|---|
--whats-app-number | Phone number that this user can send/receive WhatsApp messages from | Array |
Viber
| Flag | Description | Type |
|---|---|---|
--viber-number | Phone number that this user can send/receive Viber messages from | Array |
Facebook Messenger
| Flag | Description | Type |
|---|---|---|
--facebook-messenger-id | Facebook Messenger ID that this user can send/receive messages from | Array |
vonage users create `
--name='Alice'
✅ Creating User
User ID: USR-00000000-0000-0000-0000-000000000000
Name: Alice
Display Name: Not Set
Image URL: Not Set
Time to Live: Not Set
Channels:
None Set
vonage users create ^
--name='Alice'
✅ Creating User
User ID: USR-00000000-0000-0000-0000-000000000000
Name: Alice
Display Name: Not Set
Image URL: Not Set
Time to Live: Not Set
Channels:
None Set
Delete a User
The vonage users delete <id> command can be used to delete a user, where <id> is the ID of the user to be deleted.
vonage users delete USR-00000000-0000-0000-0000-000000000000
✅ Fetching User
Are you sure you want to delete this user? [y/n] y
✅ Deleting user
User deleted
vonage users delete USR-00000000-0000-0000-0000-000000000000
✅ Fetching User
Are you sure you want to delete this user? [y/n] y
✅ Deleting user
User deleted
List Users
The vonage users list command allows you to list all of the users you have created. Since there can be a large number of users, this command will prompt you to continue paging through the users. You can use the flags below to control the number of users returned per page:
Paging
| Flag | Description | Type |
|---|---|---|
--page-size | Number of users to return per page | Number (Default: 100) |
--cursor | Cursor for the next page | |
--sort | Sort users by name in ascending or descending order | String (must be one of: "ASC", "DESC") |
User
| Flag | Description | Type |
|---|---|---|
--name | Filter by user name | String |
vonage users
✅ Fetching Users
User ID Name Display Name
---------------------------------------- ---------------------------------------- ------------
USR- 00000000-0000-0000-0000-000000000000 Alice
vonage users
✅ Fetching Users
User ID Name Display Name
---------------------------------------- ---------------------------------------- ------------
USR- 00000000-0000-0000-0000-000000000000 Alice
Show a User
The vonage users show <id> command can be used to show the details of a given user.
vonage users show USR-00000000-0000-0000-0000-000000000000
✅ Fetching User
User ID: USR-00000000-0000-0000-0000-000000000000
Name: Alice
Display Name: Not Set
Image URL: Not Set
Time to Live: Not Set
Channels:
None Set
vonage users show USR-00000000-0000-0000-0000-000000000000
✅ Fetching User
User ID: USR-00000000-0000-0000-0000-000000000000
Name: Alice
Display Name: Not Set
Image URL: Not Set
Time to Live: Not Set
Channels:
None Set
Update a User
The vonage users update <id> command can be used to update the configuration of a given user. It uses the same flags as creating a user.
vonage users update USR-00000000-0000-0000-0000-000000000000 `
--name='bob' `
--display-name='Bob' `
--image-url='https://tinyurl.com/5ey2vhw2' \
--custom-data='{"foo": "bar"}' `
--ttl=600
✅ Fetching User
✅ Updating User
User ID: USR-00000000-0000-0000-0000-000000000000
Name: bob
Display Name: Bob
Image URL: https://developer.vonage.com/branding/vonage/assets/desktop-logo.svg
Time to Live: 600
Channels:
None Set
vonage users update USR-00000000-0000-0000-0000-000000000000 ^
--name='bob' ^
--display-name='Bob' ^
--image-url='https://tinyurl.com/5ey2vhw2' \
--custom-data='{"foo": "bar"}' ^
--ttl=600
✅ Fetching User
✅ Updating User
User ID: USR-00000000-0000-0000-0000-000000000000
Name: bob
Display Name: Bob
Image URL: https://developer.vonage.com/branding/vonage/assets/desktop-logo.svg
Time to Live: 600
Channels:
None Set