Skip to content

Commit f3af7c2

Browse files
author
Tony Bedford
authored
Merge pull request #52 from Nexmo/tony-app-v2
Initial draft of application code snippets
2 parents 9fe2ad7 + 4fdbcee commit f3af7c2

File tree

5 files changed

+113
-0
lines changed

5 files changed

+113
-0
lines changed

application/create-application.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python3
2+
import nexmo
3+
from pprint import pprint
4+
5+
client = nexmo.Client(
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
8+
)
9+
10+
response = client.application_v2.create_application({
11+
"name": "Code Example App",
12+
"capabilities": {
13+
"messages": {
14+
"webhooks": {
15+
"inbound_url": {
16+
"address": "https://example.com/webhooks/inbound",
17+
"http_method": "POST"
18+
},
19+
"status_url": {
20+
"address": "https://example.com/webhooks/status",
21+
"http_method": "POST"
22+
}
23+
}
24+
}
25+
}
26+
})
27+
28+
pprint(response)

application/delete-application.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python3
2+
import nexmo
3+
from pprint import pprint
4+
5+
client = nexmo.Client(
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
8+
)
9+
10+
response = client.application_v2.delete_application(NEXMO_APPLICATION_ID)
11+
12+
pprint(response)

application/get-application.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python3
2+
import nexmo
3+
from pprint import pprint
4+
5+
client = nexmo.Client(
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
8+
)
9+
10+
response = client.application_v2.get_application(NEXMO_APPLICATION_ID)
11+
12+
pprint(response)

application/list-applications.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python3
2+
import nexmo
3+
from pprint import pprint
4+
5+
client = nexmo.Client(
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
8+
)
9+
10+
response = client.application_v2.list_applications()
11+
12+
pprint(response)

application/update-application.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env python3
2+
import nexmo
3+
from pprint import pprint
4+
5+
client = nexmo.Client(
6+
key=NEXMO_API_KEY,
7+
secret=NEXMO_API_SECRET
8+
)
9+
10+
response = client.application_v2.update_application(NEXMO_APPLICATION_ID, {
11+
"name": "Python Update App",
12+
"capabilities": {
13+
"messages": {
14+
"webhooks": {
15+
"inbound_url": {
16+
"address": "https://example.com/webhooks/inbound",
17+
"http_method": "POST"
18+
},
19+
"status_url": {
20+
"address": "https://example.com/webhooks/status",
21+
"http_method": "POST"
22+
}
23+
}
24+
},
25+
"voice": {
26+
"webhooks": {
27+
"answer_url": {
28+
"address": "https://example.com/webhooks/answer",
29+
"http_method": "POST"
30+
},
31+
"event_url": {
32+
"address": "https://example.com/webhooks/event",
33+
"http_method": "POST"
34+
}
35+
}
36+
},
37+
"rtc": {
38+
"webhooks": {
39+
"event_url": {
40+
"address": "https://example.com/webhooks/event",
41+
"http_method": "POST"
42+
}
43+
}
44+
},
45+
"vbc": {}
46+
}
47+
})
48+
49+
pprint(response)

0 commit comments

Comments
 (0)