Skip to main content

A python package for the Turn.io WhatsApp API

Project description

turn-python

Documentation Links

Usage

  1. Get an API token from Turn (currently only tokens are supported, not username / passwords)

  2. Add this as an environment variable, or pass in to the turn client

    $ export TURN_AUTH_TOKEN={your token}
    
  3. Usage

    from turn import TurnClient
    
    turn_client = TurnClient(token={optionally add your token here})
    
    # Get a user's whatsapp id
    wa_id = turn_client.contacts.get_whatsapp_id('123456')
    
    # Send a message
    turn_client.messages.send_text(wa_id, 'Hello')
    
    # Send a media file
    with open("example.jpg", "rb") as file:
        turn_client.messages.send_media(
            whatsapp_id=wa_id,
            file=file,
            content_type="image/jpeg",
            media_type="image",
            caption="Here’s an image"
        )
    

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

turn_python-1.0.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

turn_python-1.0.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file turn_python-1.0.0.tar.gz.

File metadata

  • Download URL: turn_python-1.0.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for turn_python-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4c925ec295b7ef1f48340747ee8f4eaebb5da7b6e9268a034491641f5eec3f7b
MD5 5e1292c77233353af3d161bd8884c807
BLAKE2b-256 4eb3e0d3b3f5d692f7faaa3bde4467e2adb5a0eb9a9d6af9d5efeea8991039be

See more details on using hashes here.

File details

Details for the file turn_python-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: turn_python-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for turn_python-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9556523b6711deb8d8aa0bc5964a935056b5b2659cd1a0a0fc90f13b94607a25
MD5 69809bf62a47c6deacb9a540c9955c19
BLAKE2b-256 bde20aaa50ccf60b7d30738b473309665bfac611089c6f58873e499179a0aec9

See more details on using hashes here.

Supported by

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