diff --git a/application/create-application.py b/application/create-application.py new file mode 100644 index 0000000..f493dad --- /dev/null +++ b/application/create-application.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +import nexmo +from pprint import pprint + +client = nexmo.Client( + key=NEXMO_API_KEY, + secret=NEXMO_API_SECRET +) + +response = client.application_v2.create_application({ + "name": "Code Example App", + "capabilities": { + "messages": { + "webhooks": { + "inbound_url": { + "address": "https://example.com/webhooks/inbound", + "http_method": "POST" + }, + "status_url": { + "address": "https://example.com/webhooks/status", + "http_method": "POST" + } + } + } + } +}) + +pprint(response) diff --git a/application/delete-application.py b/application/delete-application.py new file mode 100644 index 0000000..e68f536 --- /dev/null +++ b/application/delete-application.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +import nexmo +from pprint import pprint + +client = nexmo.Client( + key=NEXMO_API_KEY, + secret=NEXMO_API_SECRET +) + +response = client.application_v2.delete_application(NEXMO_APPLICATION_ID) + +pprint(response) diff --git a/application/get-application.py b/application/get-application.py new file mode 100644 index 0000000..ca32f7d --- /dev/null +++ b/application/get-application.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +import nexmo +from pprint import pprint + +client = nexmo.Client( + key=NEXMO_API_KEY, + secret=NEXMO_API_SECRET +) + +response = client.application_v2.get_application(NEXMO_APPLICATION_ID) + +pprint(response) diff --git a/application/list-applications.py b/application/list-applications.py new file mode 100644 index 0000000..e43757b --- /dev/null +++ b/application/list-applications.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +import nexmo +from pprint import pprint + +client = nexmo.Client( + key=NEXMO_API_KEY, + secret=NEXMO_API_SECRET +) + +response = client.application_v2.list_applications() + +pprint(response) diff --git a/application/update-application.py b/application/update-application.py new file mode 100644 index 0000000..5199fc0 --- /dev/null +++ b/application/update-application.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import nexmo +from pprint import pprint + +client = nexmo.Client( + key=NEXMO_API_KEY, + secret=NEXMO_API_SECRET +) + +response = client.application_v2.update_application(NEXMO_APPLICATION_ID, { + "name": "Python Update App", + "capabilities": { + "messages": { + "webhooks": { + "inbound_url": { + "address": "https://example.com/webhooks/inbound", + "http_method": "POST" + }, + "status_url": { + "address": "https://example.com/webhooks/status", + "http_method": "POST" + } + } + }, + "voice": { + "webhooks": { + "answer_url": { + "address": "https://example.com/webhooks/answer", + "http_method": "POST" + }, + "event_url": { + "address": "https://example.com/webhooks/event", + "http_method": "POST" + } + } + }, + "rtc": { + "webhooks": { + "event_url": { + "address": "https://example.com/webhooks/event", + "http_method": "POST" + } + } + }, + "vbc": {} + } +}) + +pprint(response)