Getting started with Nexmo Conversation APIs

A presentation at NaijaHacks 2019 in December 2019 in by Paul Ardeleanu

Slide 1

Slide 1

Getting started with Nexmo Conversation APIs Paul Ardeleanu 1

Slide 2

Slide 2

dashboard.nexmo.com 2

Slide 3

Slide 3

dashboard.nexmo.com NAIJA19 3

Slide 4

Slide 4

NAIJA19 10/01/2020 4

Slide 5

Slide 5

6

Slide 6

Slide 6

7

Slide 7

Slide 7

8

Slide 8

Slide 8

NaijaDemo cb9d439f-5c97-42e4-b05c-eacd3980f38d • voice • messages • rtc • vbc 9

Slide 9

Slide 9

NaijaDemo cb9d439f-5c97-42e4-b05c-eacd3980f38d nexmo-cli Server SDKs Client SDKs • • • • • • • • • nexmo-node nexmo-php nexmo-python nexmo-ruby nexmo-dotnet nexmo-java Android SDK iOS SDK JavaScript SDK 10

Slide 10

Slide 10

nexmo-cli 11

Slide 11

Slide 11

nexmo-cli ‣ Install github.com/nexmo/nexmo-cli $ npm install nexmo-cli@beta -g /usr/local/bin/nexmo -> /usr/local/lib/node_modules/nexmo-cli/lib/bin.js + nexmo-cli@0.4.9-beta-3 added 35 packages from 28 contributors and updated 17 packages in 4.886s $ yarn global add nexmo-cli@beta 12

Slide 12

Slide 12

nexmo-cli ‣ Setup 13

Slide 13

Slide 13

nexmo-cli ‣ Setup $ nexmo setup <api_key> <api_secret> No existing config found. Writing to new file. Credentials written to /Users/pardeleanu/.nexmorc C:\Users\pardeleanu/.nexmorc $ cat ~/.nexmorc

Get-Content ~.nexmorc [credentials] api_key=xxx api_secret=xxx 14

Slide 14

Slide 14

New Application NaijaDemo 9c160e95-7050-4349-81da-eae435846867 15

Slide 15

Slide 15

nexmo-cli ‣ Create an application $ mkdir NaijaDemo $ cd NaijaDemo $ nexmo app:create ? Application Name: NaijaDemo ? Select Capabilities: voice, messages,rtc ? Use the default HTTP methods? Y ? ? ? ? ? ? ? ? Voice Answer URL: ⮐ Voice Fallback Answer URL: Voice Event URL: ⮐ Messages Inbound URL: ⮐ Messages Status URL: ⮐ RTC Event URL: ⮐ Public Key path: ⮐ Private Key path: ⮐ ⮐ Application created: 9c160e95-7050-4349-81da-eae435846867 16

Slide 16

Slide 16

nexmo-cli ‣ Create an application Application created: 9c160e95-7050-4349-81da-eae435846867 Private Key: ——-BEGIN PRIVATE KEY——… ——-END PRIVATE KEY——- WARNING: You should save this key somewhere safe and secure now, it will not be provided again. No existing config found. Writing to new file. Credentials written to /Users/pardeleanu/NaijaDemo/.nexmo-app 17

Slide 17

Slide 17

nexmo-cli ‣ Create an application $ cat .nexmo-app

Get-Content .nexmo-app [app_config] app_id= 9c160e95-7050-4349-81da-eae435846867 private_key=”——-BEGIN PRIVATE KEY—— … ——-END PRIVATE KEY——-\n” 18

Slide 18

Slide 18

nexmo-cli ‣ Create an application 19

Slide 19

Slide 19

nexmo-cli ‣ Create an application Application created: 9c160e95-7050-4349-81da-eae435846867 Private Key: ——-BEGIN PRIVATE KEY——… ——-END PRIVATE KEY——WARNING: You should save this key somewhere safe and secure now, it will not be provided again. No existing config found. Writing to new file. Credentials written to /Users/pardeleanu/NaijaDemo/.nexmo-app To recreate this application in the future without interactive mode use the following command: nexmo app:create “NaijaDemo” —capabilities=voice,messages,rtc —voice-answerurl=https://example.com/ —voice-event-url=https://example.com/ —messages-inboundurl=https://example.com/ —messages-status-url=https://example.com/ —rtc-eventurl=https://example.com/ 20

Slide 20

Slide 20

Webhooks nexmo app:create NaijaDemo —capabilities=voice,messages,rtc —voice-answer-url=https://example.com/ —voice-event-url=https://example.com/ Answer webhook —messages-inbound-url=https://example.com/ —messages-status-url=https://example.com/ Event webhook —rtc-event-url=https://example.com/ 21

Slide 21

Slide 21

webhooks ‣ Inbound https://example.com/answer Call NaijaDemo 9c160e95-7050-4349-81da-eae435846867 https://example.com/events 22

Slide 22

Slide 22

Webhooks nexmo app:create NaijaDemo —capabilities=voice,messages,rtc —voice-answer-url=https://example.com/ —voice-event-url=https://example.com/ —messages-inbound-url=https://example.com/ —messages-status-url=https://example.com/ —rtc-event-url=https://example.com/ Inbound webhook Status webhook 23

Slide 23

Slide 23

webhooks ‣ Status Send SMS NaijaDemo 9c160e95-7050-4349-81da-eae435846867 https://example.com/status 24

Slide 24

Slide 24

webhooks ‣ Inbound https://example.com/inbound Inbound message NaijaDemo 9c160e95-7050-4349-81da-eae435846867 https://example.com/status 25

Slide 25

Slide 25

Webhooks nexmo app:create NaijaDemo —capabilities=voice,messages,rtc —voice-answer-url=https://example.com/ —voice-event-url=https://example.com/ —messages-inbound-url=https://example.com/ —messages-status-url=https://example.com/ —rtc-event-url=https://example.com/ Event webhook 26

Slide 26

Slide 26

dashboard.nexmo.com 27

Slide 27

Slide 27

dashboard.nexmo.com 28

Slide 28

Slide 28

POST https://api.nexmo.com/… Authorization: ??? Authorization … 29

Slide 29

Slide 29

authorization ‣ JSON web tokens jwt.io/introduction 30

Slide 30

Slide 30

authorization ‣ Generate a JWT $ nexmo jwt:generate eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NzAyODQ4NTAsImaSI6IjY2ODM3YjcwLWU3N2EtMTFlOS1iU2LTk1YWZjOD M0iIsImFwcGxpY2F0aT3uX2lkIjoiODVhYWJjOWEtM2UwMS00ODI4LTg2ODMtNjFhNWFjODc4YWI4In0.N5WzcVvpR6uIiz_OjdAUM2YwfxDFrb50qnxcla8cbIateYNg10dHK5mY8zqGWHdVCGY04Qq7HHEyltYDLk2H87duE3bvryHgzAP1462mMIirraknSVooHrmahDuVyPdbr3TOHgCYIwINqX1Q0PpqVw6QOXTs4bzXDWaswH6Ly97i6wheshmsxkblxGY_ea_RQRLJrzUJ9m6vsEtdNcYZh6D70367_hPdz0qgGmZNzStSwwmvauTnoL3fcOcB_B510lchR4XLfdpN0Okb6P0ZZea222aqya1BCF3SjT3fiO5c1h3fbS9k 9HPmMMEBM9U91PrzPZDcXCw_w 31

Slide 31

Slide 31

authorization ‣ Using a JWT POST https://api.nexmo.com/v0.1/messages Authorization: Bearer eyJ…w_w … 32

Slide 32

Slide 32

authorization ‣ Using a JWT 33

Slide 33

Slide 33

authorization ‣ Generate a longer lived JWT $ nexmo jwt:generate exp=$(($(date +%s)+86400)) 34

Slide 34

Slide 34

Conversations NaijaDemo 9c160e95-7050-4349-81da-eae435846867 35

Slide 35

Slide 35

NaijaDemo cb9d439f-5c97-42e4-b05c-eacd3980f38d • voice • messages • rtc 36

Slide 36

Slide 36

NaijaDemo cb9d439f-5c97-42e4-b05c-eacd3980f38d 37

Slide 37

Slide 37

NaijaDemo cb9d439f-5c97-42e4-b05c-eacd3980f38d 38

Slide 38

Slide 38

Conversation APIs • • • Low-level Beta We love feedback api.nexmo.com/beta/conversations 39

Slide 39

Slide 39

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ 40

Slide 40

Slide 40

developer.nexmo.com/conversation 41

Slide 41

Slide 41

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ 42

Slide 42

Slide 42

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ 43

Slide 43

Slide 43

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ 44

Slide 44

Slide 44

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ 45

Slide 45

Slide 45

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ 46

Slide 46

Slide 46

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ 47

Slide 47

Slide 47

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ 48

Slide 48

Slide 48

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ { “id”: “CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”, “href”: “https://api.nexmo.com/beta/conversations/CON-9460506ab0d5-4e17-b24e-cd4a2eedb7e1” } 49

Slide 49

Slide 49

Conversation API ‣ Create a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My first conversation” }’ { “code”: “conversation:error:duplicate-name”, “description”: “The request failed because the conversation name already exists. Please provide a unique conversation name and try again.” } 50

Slide 50

Slide 50

Conversation API ‣ Retrieve a Conversation curl -X “GET” “https://api.nexmo.com/beta/conversations/ CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ 51

Slide 51

Slide 51

Conversation API ‣ Retrieve a Conversation curl -X “GET” “https://api.nexmo.com/beta/conversations/ CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ 52

Slide 52

Slide 52

Conversation API ‣ Retrieve a Conversation curl -X “GET” “https://api.nexmo.com/beta/conversations/ CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ 53

Slide 53

Slide 53

Conversation API ‣ Retrieve a Conversation curl -X “GET” “https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ { “uuid”:”CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”, “name”:”C-0001”, “display_name”:”My first conversation”, “timestamp”:{“created”:”2019-12-06T18:11:26.420Z”}, “sequence_number”:0, “numbers”:[], “properties”:{“custom_data”:{}}, “members”:[], “_links”:{ “self”:{“href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”} } } 54

Slide 54

Slide 54

Conversation API ‣ Update a Conversation curl -X “PUT” “https://api.nexmo.com/beta/conversations/ CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “C-0001”, “display_name”: “My Conversation” }’ 55

Slide 55

Slide 55

Conversation API ‣ List all Conversations curl -X “GET” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ 56

Slide 56

Slide 56

Conversation API ‣ List all Conversations curl -X “GET” “https://api.nexmo.com/beta/conversations” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ { “count”:2, “page_size”:10, “record_index”:0, “_links”:{ “self”:{“href”:”https://api.nexmo.com/beta/conversations”} }, “_embedded”:{ “conversations”:[ {“uuid”:”CON-7dce8c7a-223b-4e04-b655-73bde6d85398”,”name”:”C-0002”,”_links”:{“self”: {“href”:”https://api.nexmo.com/beta/conversations/CON-7dce8c7a-223b-4e04-b655-73bde6d85398”}}}, {“uuid”:”CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”,”name”:”C-0001”,”_links”:{“self”: {“href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”}}} ] } } 57

Slide 57

Slide 57

Conversation APIs developer.nexmo.com/conversation 58

Slide 58

Slide 58

Conversation API ‣ Conversation Members { “uuid”:”CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”, “name”:”C-0001”, “display_name”:”My first conversation”, “timestamp”:{“created”:”2019-12-06T18:11:26.420Z”}, “sequence_number”:0, “numbers”:[], “properties”:{“custom_data”:{}}, “members”:[], “_links”:{ “self”:{“href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”} } } 59

Slide 59

Slide 59

NaijaDemo cb9d439f-5c97-42e4-b05c-eacd3980f38d 60

Slide 60

Slide 60

Conversation API ‣ Create a User curl -X “POST” “https://api.nexmo.com/beta/users” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “jane”, “display_name”: “Jane” }’ 61

Slide 61

Slide 61

Conversation API ‣ Create a User curl -X “POST” “https://api.nexmo.com/beta/users” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “name”: “jane”, “display_name”: “Jane” }’ { “id”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “href”:”https://api.nexmo.com/beta/users/USR-d7037957-bdc1-4795-b8e2-17857a21f6f1” } 62

Slide 62

Slide 62

NaijaDemo cb9d439f-5c97-42e4-b05c-eacd3980f38d 63

Slide 63

Slide 63

Conversation API ‣ Add a User to a Conversation curl -X “POST” “https://api.nexmo.com/beta/conversations/ CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1/members” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ \ -d $’{ “user_id”: “USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “action”: “invite”, “channel”: { “type”: “app” } }’ 64

Slide 64

Slide 64

Conversation API ‣ Add a User to a Conversation { “id”:”MEM-f4283a38-ac21-4702-a45f-77f05022db0b”, “user_id”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “name”:”jane”, “display_name”:”Jane”, “state”:”INVITED”, “timestamp”:{“invited”:”2019-12-06T23:30:27.768Z”}, “channel”:{“type”:”app”,”legs”:[],”leg_ids”:[]}, “initiator”:{“invited”:{“isSystem”:true}}, “href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17b24e-cd4a2eedb7e1/members/MEM-f4283a38-ac21-4702-a45f-77f05022db0b” } 65

Slide 65

Slide 65

Conversation API ‣ Retrieve a Conversation curl -X “GET” “https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ { “uuid”:”CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”, “name”:”C-0001”, “display_name”:”My first conversation”, “timestamp”:{“created”:”2019-12-06T18:11:26.420Z”}, “sequence_number”:0, “numbers”:[], “properties”:{“custom_data”:{}}, “members”:[], “_links”:{ “self”:{“href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”} } } 66

Slide 66

Slide 66

{ “uuid”:”CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”, “name”:”C-0001”, “display_name”:”My Conversation”, “timestamp”: {“created”:”2019-12-06T18:11:26.420Z”,”updated”:”2019-12-06T18:57:01.743Z”}, “sequence_number”:2, “numbers”:[], “properties”:{“custom_data”:{}}, “members”:[ { “member_id”:”MEM-f4283a38-ac21-4702-a45f-77f05022db0b”, “user_id”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “name”:”jane”, “display_name”:”Jane”, “state”:”INVITED”, “timestamp”:{“invited”:”2019-12-06T23:30:27.768Z”}, “invited_by”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “channel”:{“type”:”app”,”legs”:[],”leg_ids”:[]}, “initiator”:{“invited”:{“isSystem”:true}}, “media”:{ “audio_settings”:{“enabled”:false,”earmuffed”:false,”muted”:false}, “audio”:{“enabled”:false,”earmuffed”:false,”muted”:false} } } ], “_links”:{“self”:{“href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”}} } 67

Slide 67

Slide 67

Conversation API ‣ Join a Conversation curl -X “PUT” “https://api.nexmo.com/beta/conversations/ CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1/members/MEM-f4283a38ac21-4702-a45f-77f05022db0b” \ -H ‘Authorization: Bearer eyJhb..’\ -H ‘Content-Type: application/json’ \ -d $’{ “user_id”: “USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “action”: “join”, “channel”: { “type”: “app” } }’ 68

Slide 68

Slide 68

{ “uuid”:”CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”, “name”:”C-0001”, “display_name”:”My Conversation”, “timestamp”: {“created”:”2019-12-06T18:11:26.420Z”,”updated”:”2019-12-06T18:57:01.743Z”}, “sequence_number”:2, “numbers”:[], “properties”:{“custom_data”:{}}, “members”:[ { “member_id”:”MEM-f4283a38-ac21-4702-a45f-77f05022db0b”, “user_id”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “name”:”jane”, “display_name”:”Jane”, “state”:”JOINED”, “timestamp”:{“invited”:”2019-12-06T23:30:27.768Z”,”joined”:”2019-12-07T00:30:44.310Z”}, “invited_by”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “channel”:{“type”:”app”,”legs”:[],”leg_ids”:[]}, “initiator”:{“invited”:{“isSystem”:true}}, “media”:{ “audio_settings”:{“enabled”:false,”earmuffed”:false,”muted”:false}, “audio”:{“enabled”:false,”earmuffed”:false,”muted”:false} } } ], “_links”:{“self”:{“href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”}} } 69

Slide 69

Slide 69

{ “uuid”:”CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”, “name”:”C-0001”, “display_name”:”My Conversation”, “timestamp”: {“created”:”2019-12-06T18:11:26.420Z”,”updated”:”2019-12-06T18:57:01.743Z”}, “sequence_number”:2, “numbers”:[], “properties”:{“custom_data”:{}}, “members”:[ { “member_id”:”MEM-f4283a38-ac21-4702-a45f-77f05022db0b”, “user_id”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “name”:”jane”, “display_name”:”Jane”, “state”:”JOINED”, “timestamp”:{“invited”:”2019-12-06T23:30:27.768Z”,”joined”:”2019-12-07T00:30:44.310Z”}, “invited_by”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “channel”:{“type”:”app”,”legs”:[],”leg_ids”:[]}, “initiator”:{“invited”:{“isSystem”:true}}, “media”:{ “audio_settings”:{“enabled”:false,”earmuffed”:false,”muted”:false}, “audio”:{“enabled”:false,”earmuffed”:false,”muted”:false} } } ], “_links”:{“self”:{“href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”}} } 70

Slide 70

Slide 70

{ “uuid”:”CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”, “name”:”C-0001”, “display_name”:”My Conversation”, “timestamp”: {“created”:”2019-12-06T18:11:26.420Z”,”updated”:”2019-12-06T18:57:01.743Z”}, “sequence_number”:2, “numbers”:[], “properties”:{“custom_data”:{}}, “members”:[ { “member_id”:”MEM-f4283a38-ac21-4702-a45f-77f05022db0b”, “user_id”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “name”:”jane”, “display_name”:”Jane”, “state”:”JOINED”, “timestamp”:{“invited”:”2019-12-06T23:30:27.768Z”,”joined”:”2019-12-07T00:30:44.310Z”}, “invited_by”:”USR-d7037957-bdc1-4795-b8e2-17857a21f6f1”, “channel”:{“type”:”app”,”legs”:[],”leg_ids”:[]}, “initiator”:{“invited”:{“isSystem”:true}}, “media”:{ “audio_settings”:{“enabled”:false,”earmuffed”:false,”muted”:false}, “audio”:{“enabled”:false,”earmuffed”:false,”muted”:false} } } ], “_links”:{“self”:{“href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1”}} } 71

Slide 71

Slide 71

NaijaDemo 9c160e95-7050-4349-81da-eae435846867 Conversation Events 72

Slide 72

Slide 72

NaijaDemo cb9d439f-5c97-42e4-b05c-eacd3980f38d • • • conversation:created conversation:deleted conversation:updated • • • • text text:update text:typing:on text:typing:off • • • • • audio:ringing:start audio:play audio:say audio:speaking:on audio:speaking:off developer.nexmo.com/conversation/concepts/event 73

Slide 73

Slide 73

Conversation API ‣ Events for a Conversation curl -X “GET” “https://api.nexmo.com/beta/conversations/ CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1/events” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’ 74

Slide 74

Slide 74

[ { “id”:1, “type”:”conversation:updated”, “body”: …, “timestamp”:”2019-12-06T18:57:01.743Z”, “href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1/events/1” }, { “id”:2, “type”:”member:invited”, “from”:”MEM-f4283a38-ac21-4702-a45f-77f05022db0b”, “body”: …, “timestamp”:”2019-12-06T23:30:27.770Z”, “href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1/events/2” }, { “id”:3, “type”:”member:joined”, “from”:”MEM-f4283a38-ac21-4702-a45f-77f05022db0b”, “body”: …, “timestamp”:”2019-12-07T00:30:44.313Z”, “href”:”https://api.nexmo.com/beta/conversations/CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1/events/3” } ] 75

Slide 75

Slide 75

Conversation API ‣ Create an Event curl -X “POST” “https://api.nexmo.com/beta/conversations/ CON-9460506a-b0d5-4e17-b24e-cd4a2eedb7e1/events” \ -H ‘Authorization: Bearer eyJhb…’\ -H ‘Content-Type: application/json’\ -d $’{ “type”: “text”, “from”: “MEM-f4283a38-ac21-4702-a45f-77f05022db0b”, “body”: { “text”: “Welcome to NaijaHacks!” } }’ 76

Slide 76

Slide 76

NaijaDemo cb9d439f-5c97-42e4-b05c-eacd3980f38d nexmo-cli Server SDKs Client SDKs • • • • • • • • • nexmo-node nexmo-php nexmo-python nexmo-ruby nexmo-dotnet nexmo-java Android SDK iOS SDK JavaScript SDK 77

Slide 77

Slide 77

Resources • developer.nexmo.com • github.com/nexmo-community • nexmo-community.slack.com • support@nexmo.com • devrel@nexmo.com • naijahacks2019.slack.com #company-nexmo • app.sli.do/event/tx20dhmp 78

Slide 78

Slide 78

Thank you! NAIJA19 10/01/2020 79