Skip to content

Commit 7647bd1

Browse files
committed
rename conversation start
1 parent fb022fe commit 7647bd1

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

examples/sinch_events/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ NUMBERS_SINCH_EVENT_SECRET = NUMBERS_SINCH_EVENT_SECRET
88
# See https://developers.sinch.com/docs/sms/api-reference/sms/tag/Webhooks/#tag/Webhooks/section/Callbacks
99
SMS_SINCH_EVENT_SECRET = SMS_SINCH_EVENT_SECRET
1010
# See https://developers.sinch.com/docs/conversation/callbacks
11-
CONVERSATION_WEBHOOKS_SECRET = CONVERSATION_WEBHOOKS_SECRET
11+
CONVERSATION_SINCH_EVENT_SECRET = CONVERSATION_SINCH_EVENT_SECRET

examples/sinch_events/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This directory contains both the Event handlers and the server application (`ser
4242
```
4343
- Conversation controller: Set the webhook secret you configured when creating the webhook (see [Conversation API callbacks](https://developers.sinch.com/docs/conversation/callbacks)):
4444
```
45-
CONVERSATION_WEBHOOKS_SECRET=Your Conversation Webhook Secret
45+
CONVERSATION_SINCH_EVENT_SECRET=Your Conversation Sinch Event Secret
4646
```
4747

4848
## Usage

examples/sinch_events/conversation_api/controller.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33

44

55
class ConversationController:
6-
def __init__(self, sinch_client, webhooks_secret):
6+
def __init__(self, sinch_client, sinch_event_secret):
77
self.sinch_client = sinch_client
8-
self.webhooks_secret = webhooks_secret
8+
self.sinch_event_secret = sinch_event_secret
99
self.logger = self.sinch_client.configuration.logger
1010

1111
def conversation_event(self):
1212
headers = dict(request.headers)
1313
raw_body = request.raw_body if request.raw_body else b""
1414

15-
webhooks_service = self.sinch_client.conversation.webhooks(self.webhooks_secret)
15+
webhooks_service = self.sinch_client.conversation.webhooks(
16+
self.sinch_event_secret
17+
)
1618

1719
# Set to True to enforce signature validation (recommended in production)
1820
ensure_valid_signature = False

examples/sinch_events/server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
port = int(config.get('SERVER_PORT') or 3001)
2020
numbers_sinch_event_secret = config.get('NUMBERS_SINCH_EVENT_SECRET')
2121
sms_sinch_event_secret = config.get('SMS_SINCH_EVENT_SECRET')
22-
conversation_webhooks_secret = config.get('CONVERSATION_WEBHOOKS_SECRET')
22+
conversation_sinch_event_secret = config.get('CONVERSATION_SINCH_EVENT_SECRET')
2323
sinch_client = get_sinch_client(config)
2424

2525
# Set up logging at the INFO level
@@ -28,7 +28,9 @@
2828

2929
numbers_controller = NumbersController(sinch_client, numbers_sinch_event_secret)
3030
sms_controller = SmsController(sinch_client, sms_sinch_event_secret)
31-
conversation_controller = ConversationController(sinch_client, conversation_webhooks_secret or '')
31+
conversation_controller = ConversationController(
32+
sinch_client, conversation_sinch_event_secret or ''
33+
)
3234

3335

3436
# Middleware to capture raw body

0 commit comments

Comments
 (0)