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..c520eb7c --- /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 = "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..4c3d343c --- /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 = "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..72d31d32 --- /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 = "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}")