From 84c8ddddb1a3cdb7e0c0869cbd1703373315e2f4 Mon Sep 17 00:00:00 2001 From: Jessica Matsuoka Date: Tue, 20 Jan 2026 17:25:42 +0100 Subject: [PATCH 1/2] DEVEXP-794: Conversation Messages - Snippets --- .github/workflows/ci.yml | 2 ++ .../conversation/messages/delete/snippet.py | 26 +++++++++++++++++ .../conversation/messages/get/snippet.py | 26 +++++++++++++++++ .../conversation/messages/update/snippet.py | 29 +++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 examples/snippets/conversation/messages/delete/snippet.py create mode 100644 examples/snippets/conversation/messages/get/snippet.py create mode 100644 examples/snippets/conversation/messages/update/snippet.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb2eba9c..49967804 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,3 +96,5 @@ jobs: run: | python -m behave tests/e2e/numbers/features python -m behave tests/e2e/sms/features + python -m behave tests/e2e/conversation/features + python -m behave tests/e2e/number-lookup/features diff --git a/examples/snippets/conversation/messages/delete/snippet.py b/examples/snippets/conversation/messages/delete/snippet.py new file mode 100644 index 00000000..e9e17bef --- /dev/null +++ b/examples/snippets/conversation/messages/delete/snippet.py @@ -0,0 +1,26 @@ +""" +Sinch Python Snippet + +TODO: Update links when v2 is released. +This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/ +""" + +import os +from dotenv import load_dotenv +from sinch import SinchClient + +load_dotenv() + +sinch_client = SinchClient( + project_id=os.environ.get("SINCH_PROJECT_ID") or "MY_PROJECT_ID", + key_id=os.environ.get("SINCH_KEY_ID") or "MY_KEY_ID", + key_secret=os.environ.get("SINCH_KEY_SECRET") or "MY_KEY_SECRET", + conversation_region=os.environ.get("SINCH_CONVERSATION_REGION") or "MY_CONVERSATION_REGION" +) + +# The ID of the message to delete +message_id = os.environ.get("SINCH_MESSAGE_ID") or "MESSAGE_ID" + +sinch_client.conversation.messages.delete(message_id=message_id) + +print("Message deleted successfully") diff --git a/examples/snippets/conversation/messages/get/snippet.py b/examples/snippets/conversation/messages/get/snippet.py new file mode 100644 index 00000000..bca063be --- /dev/null +++ b/examples/snippets/conversation/messages/get/snippet.py @@ -0,0 +1,26 @@ +""" +Sinch Python Snippet + +TODO: Update links when v2 is released. +This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/ +""" + +import os +from dotenv import load_dotenv +from sinch import SinchClient + +load_dotenv() + +sinch_client = SinchClient( + project_id=os.environ.get("SINCH_PROJECT_ID") or "MY_PROJECT_ID", + key_id=os.environ.get("SINCH_KEY_ID") or "MY_KEY_ID", + key_secret=os.environ.get("SINCH_KEY_SECRET") or "MY_KEY_SECRET", + conversation_region=os.environ.get("SINCH_CONVERSATION_REGION") or "MY_CONVERSATION_REGION" +) + +# The ID of the message to retrieve +message_id = os.environ.get("SINCH_MESSAGE_ID") or "MESSAGE_ID" + +response = sinch_client.conversation.messages.get(message_id=message_id) + +print(f"Message details:\n{response}") diff --git a/examples/snippets/conversation/messages/update/snippet.py b/examples/snippets/conversation/messages/update/snippet.py new file mode 100644 index 00000000..e868ddd9 --- /dev/null +++ b/examples/snippets/conversation/messages/update/snippet.py @@ -0,0 +1,29 @@ +""" +Sinch Python Snippet + +TODO: Update links when v2 is released. +This snippet is available at https://github.com/sinch/sinch-sdk-python/blob/v2.0/docs/snippets/ +""" + +import os +from dotenv import load_dotenv +from sinch import SinchClient + +load_dotenv() + +sinch_client = SinchClient( + project_id=os.environ.get("SINCH_PROJECT_ID") or "MY_PROJECT_ID", + key_id=os.environ.get("SINCH_KEY_ID") or "MY_KEY_ID", + key_secret=os.environ.get("SINCH_KEY_SECRET") or "MY_KEY_SECRET", + conversation_region=os.environ.get("SINCH_CONVERSATION_REGION") or "MY_CONVERSATION_REGION" +) + +# The ID of the message to update +message_id = os.environ.get("SINCH_MESSAGE_ID") or "MESSAGE_ID" + +response = sinch_client.conversation.messages.update( + message_id=message_id, + metadata="metadata value set from Python SDK snippet" +) + +print(f"Updated message:\n{response}") From 5acfb9a4c225910ebd418bdee6b11e3fc40ac549 Mon Sep 17 00:00:00 2001 From: Jessica Matsuoka Date: Thu, 22 Jan 2026 09:58:47 +0100 Subject: [PATCH 2/2] solve PR comments --- examples/snippets/conversation/messages/delete/snippet.py | 2 +- examples/snippets/conversation/messages/get/snippet.py | 2 +- examples/snippets/conversation/messages/update/snippet.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/snippets/conversation/messages/delete/snippet.py b/examples/snippets/conversation/messages/delete/snippet.py index e9e17bef..c520eb7c 100644 --- a/examples/snippets/conversation/messages/delete/snippet.py +++ b/examples/snippets/conversation/messages/delete/snippet.py @@ -19,7 +19,7 @@ ) # The ID of the message to delete -message_id = os.environ.get("SINCH_MESSAGE_ID") or "MESSAGE_ID" +message_id = "MESSAGE_ID" sinch_client.conversation.messages.delete(message_id=message_id) diff --git a/examples/snippets/conversation/messages/get/snippet.py b/examples/snippets/conversation/messages/get/snippet.py index bca063be..4c3d343c 100644 --- a/examples/snippets/conversation/messages/get/snippet.py +++ b/examples/snippets/conversation/messages/get/snippet.py @@ -19,7 +19,7 @@ ) # The ID of the message to retrieve -message_id = os.environ.get("SINCH_MESSAGE_ID") or "MESSAGE_ID" +message_id = "MESSAGE_ID" response = sinch_client.conversation.messages.get(message_id=message_id) diff --git a/examples/snippets/conversation/messages/update/snippet.py b/examples/snippets/conversation/messages/update/snippet.py index e868ddd9..72d31d32 100644 --- a/examples/snippets/conversation/messages/update/snippet.py +++ b/examples/snippets/conversation/messages/update/snippet.py @@ -19,7 +19,7 @@ ) # The ID of the message to update -message_id = os.environ.get("SINCH_MESSAGE_ID") or "MESSAGE_ID" +message_id = "MESSAGE_ID" response = sinch_client.conversation.messages.update( message_id=message_id,