Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/hub/email.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@ Access with `norbix.hub.email`.

| Method | Verb | Path | Scope |
| --- | --- | --- | --- |
| `one_click_unsubscribe` | `POST` | `/{version}/email/one-click-unsubscribe` | `project` |
| `one_click_unsubscribe` | `POST` | `/{version}/email/one-click-unsubscribe` | `optional` |
| `get_email_preferences_by_link` | `GET` | `/{version}/email/preferences` | `optional` |

`get_email_preferences_by_link(token=...)` reads the marketing e-mail preferences of the
person a signed unsubscribe link belongs to. The signed token is the key: it works on a
client with no API key or bearer token (scope `optional` — a token is sent only when the
client has one).

Both methods are public links: `one_click_unsubscribe` is also sent without credentials
when the client has none.
6 changes: 3 additions & 3 deletions docs/hub/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Access with `norbix.hub.notifications`.
| `get_user_notification_preferences` | `GET` | `/{version}/notifications/user/preferences` | `project` |
| `update_user_notifications_preferences` | `PUT` | `/{version}/notifications/user/preferences` | `project` |
| `disable_email` | `GET` | `/{version}/notifications/email/disable` | `project` |
| `get_email_disable_dependencies` | `GET` | `/{version}/notifications/email/disable-dependencies` | `project` |
| `enable_email` | `GET` | `/{version}/notifications/email/enable` | `project` |
| `attach_file_to_template` | `POST` | `/{version}/notifications/email/templates/attachments` | `project` |
| `create_email_template` | `POST` | `/{version}/notifications/email/templates` | `project` |
Expand All @@ -24,6 +25,7 @@ Access with `norbix.hub.notifications`.
| `save_email_signature` | `POST` | `/{version}/notifications/email/signatures` | `project` |
| `get_email_settings` | `GET` | `/{version}/notifications/email/settings` | `project` |
| `confirm_email_integration_human_delivery` | `POST` | `/{version}/notifications/email/integrations/confirm-human-delivery` | `project` |
| `check_email_integration_domain_health` | `POST` | `/{version}/notifications/email/integrations/domain-health` | `project` |
| `delete_email_integration` | `DELETE` | `/{version}/notifications/email/integrations/{Id}` | `project` |
| `disable_email_integration` | `PUT` | `/{version}/notifications/email/integrations/{Id}/disable` | `project` |
| `enable_email_integration` | `PUT` | `/{version}/notifications/email/integrations/{Id}/enable` | `project` |
Expand All @@ -41,14 +43,14 @@ Access with `norbix.hub.notifications`.
| `save_email_footer` | `POST` | `/{version}/notifications/email/footers` | `project` |
| `create_email_campaign` | `POST` | `/{version}/notifications/email/campaigns` | `project` |
| `delete_email_campaign` | `DELETE` | `/{version}/notifications/email/campaigns/{Id}` | `project` |
| `stop_email_campaign` | `POST` | `/{version}/notifications/email/campaigns/{Id}/stop` | `project` |
| `get_email_campaign` | `GET` | `/{version}/notifications/email/campaigns/{id}` | `project` |
| `get_email_campaigns` | `GET` | `/{version}/notifications/email/campaigns` | `project` |
| `get_email_campaign_batches` | `GET` | `/{version}/notifications/email/campaigns/{id}/batches` | `project` |
| `get_email_campaign_batch_notification` | `GET` | `/{version}/notifications/email/campaigns/{id}/batches/{batchId}/{notificationId}` | `project` |
| `get_email_campaign_batch_notifications` | `GET` | `/{version}/notifications/email/campaigns/{id}/batches/{batchId}` | `project` |
| `get_email_campaign_statistics` | `GET` | `/{version}/notifications/email/campaigns/{id}/stats` | `project` |
| `preview_email_notification` | `GET` | `/{version}/notifications/email/preview` | `optional` |
| `get_email_campaign_message` | `GET` | `/{version}/notifications/emails/campaigns/{campaignId}/messages/{id}` | `project` |
| `get_email_campaign_messages` | `GET` | `/{version}/notifications/emails/campaigns/{campaignId}/messages` | `project` |
| `disable_sms` | `GET` | `/{version}/notifications/sms/disable` | `project` |
| `enable_sms` | `GET` | `/{version}/notifications/sms/enable` | `project` |
Expand Down Expand Up @@ -83,7 +85,6 @@ Access with `norbix.hub.notifications`.
| `get_sms_campaign_batch_notification` | `GET` | `/{version}/notifications/sms/campaigns/{id}/batches/{batchId}/{notificationId}` | `project` |
| `get_sms_campaign_statistics` | `GET` | `/{version}/notifications/sms/campaigns/{id}/stats` | `project` |
| `get_sms_campaign_messages` | `GET` | `/{version}/notifications/sms/campaigns/{campaignId}/messages` | `project` |
| `get_sms_campaign_message` | `GET` | `/{version}/notifications/sms/campaigns/{campaignId}/messages/{notificationId}` | `project` |
| `preview_sms_notification` | `GET` | `/{version}/notifications/sms/preview` | `optional` |
| `disable_push` | `GET` | `/{version}/notifications/push/disable` | `project` |
| `enable_push` | `GET` | `/{version}/notifications/push/enable` | `project` |
Expand Down Expand Up @@ -119,7 +120,6 @@ Access with `norbix.hub.notifications`.
| `get_push_campaign_batch_notification` | `GET` | `/{version}/notifications/push/campaigns/{id}/batches/{batchId}/{notificationId}` | `project` |
| `get_push_campaign_statistics` | `GET` | `/{version}/notifications/push/campaigns/{id}/stats` | `project` |
| `get_push_campaign_messages` | `GET` | `/{version}/notifications/push/campaigns/{campaignId}/messages` | `project` |
| `get_push_campaign_message` | `GET` | `/{version}/notifications/push/campaigns/{campaignId}/messages/{id}` | `project` |
| `preview_push_notification` | `GET` | `/{version}/notifications/push/preview` | `optional` |

Every method above has an async twin on `client.hub.notifications` when the
Expand Down
17 changes: 9 additions & 8 deletions docs/hub/sms.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,21 @@ rendered = client.hub.notifications.render_sms(

## Reading one message of a campaign

`get_sms_campaign_message` takes the campaign id and the notification id in the
route; the batch id is required as well but is not part of the route, so it is
sent as a query value:
Use `get_sms_campaign_batch_notification` with the campaign id, the batch id
and the notification id (route `…/campaigns/{id}/batches/{batchId}/{notificationId}`):

```python
message = client.hub.notifications.get_sms_campaign_message(
campaign_id="camp_1",
id="notif_1",
campaignBatchId="batch_1",
message = client.hub.notifications.get_sms_campaign_batch_notification(
id="camp_1",
batch_id="batch_1",
notification_id="notif_1",
)
```

Get the ids from `get_sms_campaigns`, `get_sms_campaign_batches` and
`get_sms_campaign_messages`.
`get_sms_campaign_batch_notifications`. The older `get_sms_campaign_message`
(`…/campaigns/{campaignId}/messages/{notificationId}`) was removed together
with its gateway route.

## Preview with a signed link

Expand Down
52 changes: 48 additions & 4 deletions src/norbix_python/hub/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,36 @@ def __init__(self, transport: Transport) -> None:
self._transport = transport

def one_click_unsubscribe(self, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""POST /{version}/email/one-click-unsubscribe"""
"""POST /{version}/email/one-click-unsubscribe

Public: the signed link in the e-mail is the key, so no credentials are
needed. Auth is still sent when the client has a token.
"""
return self._transport.send(
target="hub",
path="/{version}/email/one-click-unsubscribe",
method="POST",
path_params={},
request=request,
scope="project",
scope="optional",
timeout=timeout,
bearer_token=bearer_token,
)

def get_email_preferences_by_link(self, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""GET /{version}/email/preferences

Reads the marketing e-mail preferences of the person a signed unsubscribe link
belongs to. Opens with the link alone: pass ``token=...`` and no credentials are
needed. Auth is still sent when the client has a token.
"""
return self._transport.send(
target="hub",
path="/{version}/email/preferences",
method="GET",
path_params={},
request=request,
scope="optional",
timeout=timeout,
bearer_token=bearer_token,
)
Expand All @@ -28,14 +50,36 @@ def __init__(self, transport: AsyncTransport) -> None:
self._transport = transport

async def one_click_unsubscribe(self, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""POST /{version}/email/one-click-unsubscribe"""
"""POST /{version}/email/one-click-unsubscribe

Public: the signed link in the e-mail is the key, so no credentials are
needed. Auth is still sent when the client has a token.
"""
return await self._transport.send(
target="hub",
path="/{version}/email/one-click-unsubscribe",
method="POST",
path_params={},
request=request,
scope="project",
scope="optional",
timeout=timeout,
bearer_token=bearer_token,
)

async def get_email_preferences_by_link(self, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""GET /{version}/email/preferences

Reads the marketing e-mail preferences of the person a signed unsubscribe link
belongs to. Opens with the link alone: pass ``token=...`` and no credentials are
needed. Auth is still sent when the client has a token.
"""
return await self._transport.send(
target="hub",
path="/{version}/email/preferences",
method="GET",
path_params={},
request=request,
scope="optional",
timeout=timeout,
bearer_token=bearer_token,
)
Loading
Loading