Skip to content

Commit 8b0e477

Browse files
committed
update examples
1 parent c99b0e1 commit 8b0e477

49 files changed

Lines changed: 97 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/sinch_events/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ package-mode = false
99
python = "^3.9"
1010
python-dotenv = "^1.0.0"
1111
flask = "^3.0.0"
12-
# TODO: Uncomment once v2.0 is released
13-
# sinch = "^2.0.0"
12+
sinch = "^2.0.0"
1413

1514
[build-system]
1615
requires = ["poetry-core"]

examples/snippets/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ All available code snippets are located in subdirectories, structured by feature
5757
To execute a specific snippet, navigate to the appropriate subdirectory and run:
5858

5959
```shell
60-
python run python snippet.py
60+
python snippet.py
6161
```

examples/snippets/conversation/messages/delete/snippet.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Sinch Python Snippet
33
4-
TODO: Update links when v2 is released.
5-
This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/
4+
This snippet is available at https://github.com/sinch/sinch-sdk-python/tree/main/examples/snippets
65
"""
76

87
import os

examples/snippets/conversation/messages/get/snippet.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Sinch Python Snippet
33
4-
TODO: Update links when v2 is released.
5-
This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/
4+
This snippet is available at https://github.com/sinch/sinch-sdk-python/tree/main/examples/snippets
65
"""
76

87
import os

examples/snippets/conversation/messages/list/snippet.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Sinch Python Snippet
33
4-
TODO: Update links when v2 is released.
5-
This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/
4+
This snippet is available at https://github.com/sinch/sinch-sdk-python/tree/main/examples/snippets
65
"""
76

87
import os

examples/snippets/conversation/messages/list_last_messages_by_channel_identity/snippet.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Sinch Python Snippet
33
4-
TODO: Update links when v2 is released.
5-
This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/
4+
This snippet is available at https://github.com/sinch/sinch-sdk-python/tree/main/examples/snippets
65
"""
76

87
import os
@@ -18,7 +17,7 @@
1817
conversation_region=os.environ.get("SINCH_CONVERSATION_REGION") or "MY_CONVERSATION_REGION"
1918
)
2019

21-
# Channel identities to fetch the last message
20+
# The channel identities to fetch the last message for
2221
channel_identities = ["CHANNEL_IDENTITY_1", "CHANNEL_IDENTITY_2"]
2322

2423
messages = sinch_client.conversation.messages.list_last_messages_by_channel_identity(

examples/snippets/conversation/messages/send/snippet.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Sinch Python Snippet
33
4-
TODO: Update links when v2 is released.
5-
This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/
4+
This snippet is available at https://github.com/sinch/sinch-sdk-python/tree/main/examples/snippets
65
"""
76

87
import os
@@ -28,14 +27,17 @@
2827
}
2928
]
3029

30+
# The conversation message payload to send
31+
message = {
32+
"text_message": {
33+
"text": "[Python SDK: Conversation Message] Sample text message",
34+
},
35+
}
36+
3137
response = sinch_client.conversation.messages.send(
3238
app_id=app_id,
33-
message={
34-
"text_message": {
35-
"text": "[Python SDK: Conversation Message] Sample text message"
36-
}
37-
},
38-
recipient_identities=recipient_identities
39+
message=message,
40+
recipient_identities=recipient_identities,
3941
)
4042

4143
print(f"Successfully sent message.\n{response}")

examples/snippets/conversation/messages/send_card_message/snippet.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Sinch Python Snippet
33
4-
TODO: Update links when v2 is released.
5-
This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/
4+
This snippet is available at https://github.com/sinch/sinch-sdk-python/tree/main/examples/snippets
65
"""
76

87
import os

examples/snippets/conversation/messages/send_carousel_message/snippet.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Sinch Python Snippet
33
4-
TODO: Update links when v2 is released.
5-
This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/
4+
This snippet is available at https://github.com/sinch/sinch-sdk-python/tree/main/examples/snippets
65
"""
76

87
import os

examples/snippets/conversation/messages/send_choice_message/snippet.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
Sinch Python Snippet
33
4-
TODO: Update links when v2 is released.
5-
This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/
4+
This snippet is available at https://github.com/sinch/sinch-sdk-python/tree/main/examples/snippets
65
"""
76

87
import os

0 commit comments

Comments
 (0)