Skip to main content

Vonage Users package

Project description

Vonage Users Package

This package contains the code to use Vonage's Users API in Python.

It includes methods for managing users.

Usage

It is recommended to use this as part of the main vonage package. The examples below assume you've created an instance of the vonage.Vonage class called vonage_client.

List Users

With no custom options specified, this method will get the last 100 users. It returns a tuple consisting of a list of UserSummary objects and a string describing the cursor to the next page of results.

from vonage_users import ListUsersRequest

users, _ = vonage_client.users.list_users()

# With options
params = ListUsersRequest(
    page_size=10,
    cursor=my_cursor,
    order='desc',
)
users, next_cursor = vonage_client.users.list_users(params)

Create a New User

from vonage_users import User, Channels, SmsChannel
user_options = User(
    name='my_user_name',
    display_name='My User Name',
    properties={'custom_key': 'custom_value'},
    channels=Channels(sms=[SmsChannel(number='1234567890')]),
)
user = vonage_client.users.create_user(user_options)

Get a User

user = client.users.get_user('USR-87e3e6b0-cd7b-45ef-a0a7-bcd5566a672b')
user_as_dict = user.model_dump(exclude_none=True)

Update a User

from vonage_users import User, Channels, SmsChannel, WhatsappChannel
user_options = User(
    name='my_user_name',
    display_name='My User Name',
    properties={'custom_key': 'custom_value'},
    channels=Channels(sms=[SmsChannel(number='1234567890')], whatsapp=[WhatsappChannel(number='9876543210')]),
)
user = vonage_client.users.update_user(id, user_options)

Delete a User

vonage_client.users.delete_user(id)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vonage_users-1.1.3.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

vonage_users-1.1.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file vonage_users-1.1.3.tar.gz.

File metadata

  • Download URL: vonage_users-1.1.3.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.4

File hashes

Hashes for vonage_users-1.1.3.tar.gz
Algorithm Hash digest
SHA256 d08a4a97ed6159a9b61800c3ba3966209deaa0e9286a5ed462093e8379fcf0c2
MD5 8f9749759c08e2f442414aef483071c9
BLAKE2b-256 c9439b4f9d697391a69f7fc65f7d5262e2ec046d59dfdbb756d3eafea63b6984

See more details on using hashes here.

File details

Details for the file vonage_users-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for vonage_users-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9dc7c4420b688fb7bce7e2646c4c8524072a46832f22ed662dae553c2979ab89
MD5 d4cf67819b336b11edab7a1970555564
BLAKE2b-256 804cd3a9cf703ce976379b5eb8fdc3bc6c8532a3ac291d6cff9ad8667cbeb792

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page