Skip to content

Instantly share code, notes, and snippets.

@aaronbassett
Created October 5, 2019 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronbassett/3aaf6b98312493826939c245d0d7e89e to your computer and use it in GitHub Desktop.
Save aaronbassett/3aaf6b98312493826939c245d0d7e89e to your computer and use it in GitHub Desktop.
Example code using the Nexmo Voice API and Environment Variables
import os
import nexmo
client = nexmo.Client(
application_id=os.getenv("NEXMO_APPLICATION_ID"),
private_key=os.getenv("NEXMO_PRIVATE_KEY", "./private.key"),
)
response = client.create_call(
{
"to": [{"type": "phone", "number": os.getenv("TO_NUMBER")}],
"from": {"type": "phone", "number": os.getenv("NEXMO_NUMBER")},
"answer_url": [f"{os.getenv('VAPI_URL')}/answer"],
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment