Skip to content

Commit 8d6771f

Browse files
Merge pull request Vonage#143 from Vonage/conversation-reformat
New snippets with correct variables
2 parents bb6d75a + d357cc4 commit 8d6771f

14 files changed

+30
-54
lines changed

conversation/conversation/delete-conversation.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl -X "DELETE" "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID" \
6+
curl -X "DELETE" "https://api.nexmo.com/v1/conversations/$CONV_ID" \
77
-H 'Authorization: Bearer '$JWT\
88
-H 'Content-Type: application/json'
99

conversation/conversation/get-conversation.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID" \
6+
curl "https://api.nexmo.com/v1/conversations/$CONV_ID" \
77
-H 'Authorization: Bearer '$JWT\
8-
-H 'Content-Type: application/json'
9-
10-
11-
8+
-H 'Content-Type: application/json'

conversation/conversation/update-conversation.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl -X "PUT" "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID" \
6+
curl -X "PUT" "https://api.nexmo.com/v1/conversations/$CONV_ID" \
77
-H 'Authorization: Bearer '$JWT\
88
-H 'Content-Type: application/json' \
99
-d $'{
10-
"name": "$CONV_NEW_NAME",
11-
"display_name": "$CONV_NEW_DISPLAY_NAME"
10+
"name": "$CONV_NAME",
11+
"display_name": "$CONV_DISPLAY_NAME"
1212
}'
1313

1414

conversation/event/create-custom-event.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ source "../../config.sh"
44
source "../../jwt.sh"
55

66
# `from` is only required if you're using a JWT with a `sub` claim
7-
curl -X "POST" "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID/events" \
7+
curl -X "POST" "https://api.nexmo.com/v1/conversations/$CONV_ID/events" \
88
-H 'Authorization: Bearer '$JWT\
99
-H 'Content-Type: application/json' \
1010
-d $'{
1111
"type": "custom:YOUR_EVENT_NAME",
12-
"from": "'$MEMBER_ID'",
12+
"from": "'$CONV_EVENT_FROM'",
1313
"body": {
1414
"your": "data"
1515
}

conversation/event/create-event.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl -X "POST" "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID/events" \
6+
curl -X "POST" "https://api.nexmo.com/v1/conversations/$CONV_ID/events" \
77
-H 'Authorization: Bearer '$JWT\
88
-H 'Content-Type: application/json' \
99
-d $'{
10-
"type": "message",
11-
"from": "'$MEMBER_ID'"
10+
"type": "'$CONV_EVENT_TYPE'",
11+
"from": "'$CONV_EVENT_FROM'"
1212
"body": {
1313
"message_type": "text",
1414
"text": "string"
1515
}
16-
}'
17-
18-
19-
16+
}'

conversation/event/delete-event.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl -X "DELETE" "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID/events/$EVENT_ID" \
6+
curl -X "DELETE" "https://api.nexmo.com/v1/conversations/$CONV_ID/events/$CONV_EVENT_ID" \
77
-H 'Authorization: Bearer '$JWT\
8-
-H 'Content-Type: application/json'
9-
10-
11-
12-
8+
-H 'Content-Type: application/json'

conversation/event/get-event.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID/events/$EVENT_ID" \
6+
curl "https://api.nexmo.com/v1/conversations/$CONV_ID/events/$CONV_EVENT_ID" \
77
-H 'Authorization: Bearer '$JWT\
88
-H 'Content-Type: application/json'
99

conversation/event/list-events.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID/events" \
6+
curl "https://api.nexmo.com/v1/conversations/$CONV_ID/events" \
77
-H 'Authorization: Bearer '$JWT\
88
-H 'Content-Type: application/json'
99

conversation/member/create-member.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl -X "POST" "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID/members" \
6+
curl -X "POST" "https://api.nexmo.com/v1/conversations/$CONV_ID/members" \
77
-H 'Authorization: Bearer '$JWT\
88
-H 'Content-Type: application/json' \
99
-d $'{
1010
"user": {
11-
"id": "'$USER_ID'"
12-
}
13-
"state": "invited",
11+
"id": "'$CONV_USER_ID'"
12+
},
13+
"state": "'$CONV_MEMBER_STATE'",
1414
"channel": {
1515
"type": "app"
1616
}

conversation/member/delete-member.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl -X "DELETE" "https://api.nexmo.com/v1/conversations/$CONVERSATION_ID/members/$MEMBER_ID" \
6+
curl -X "DELETE" "https://api.nexmo.com/v1/conversations/$CONV_ID/members/$CONV_MEMBER_ID" \
77
-H 'Authorization: Bearer '$JWT\
8-
-H 'Content-Type: application/json'
9-
8+
-H 'Content-Type: application/json'

0 commit comments

Comments
 (0)