Skip to content

webhooks

WebhookStatus = Literal['active', 'failing', 'failed', 'pause'] module-attribute

Literals representing the possible webhook statuses.

CreateWebhookRequest

Bases: TypedDict

Class representation of a Nylas create webhook request.

Attributes:

Name Type Description
trigger_types List[WebhookTriggers]

List of events that triggers the webhook.

webhook_url str

The url to send webhooks to.

description NotRequired[str]

A human-readable description of the webhook destination.

notification_email_addresses NotRequired[List[str]]

The email addresses that Nylas notifies when a webhook is down for a while.

Source code in nylas/models/webhooks.py
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
class CreateWebhookRequest(TypedDict):
    """
    Class representation of a Nylas create webhook request.

    Attributes:
        trigger_types: List of events that triggers the webhook.
        webhook_url: The url to send webhooks to.
        description: A human-readable description of the webhook destination.
        notification_email_addresses: The email addresses that Nylas notifies when a webhook is down for a while.
    """

    trigger_types: List[WebhookTriggers]
    webhook_url: str
    description: NotRequired[str]
    notification_email_addresses: NotRequired[List[str]]

UpdateWebhookRequest

Bases: TypedDict

Class representation of a Nylas update webhook request.

Attributes:

Name Type Description
trigger_types NotRequired[List[WebhookTriggers]]

List of events that triggers the webhook.

webhook_url NotRequired[str]

The url to send webhooks to.

description NotRequired[str]

A human-readable description of the webhook destination.

notification_email_addresses NotRequired[List[str]]

The email addresses that Nylas notifies when a webhook is down for a while.

Source code in nylas/models/webhooks.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
class UpdateWebhookRequest(TypedDict):
    """
    Class representation of a Nylas update webhook request.

    Attributes:
        trigger_types: List of events that triggers the webhook.
        webhook_url: The url to send webhooks to.
        description: A human-readable description of the webhook destination.
        notification_email_addresses: The email addresses that Nylas notifies when a webhook is down for a while.
    """

    trigger_types: NotRequired[List[WebhookTriggers]]
    webhook_url: NotRequired[str]
    description: NotRequired[str]
    notification_email_addresses: NotRequired[List[str]]

Webhook dataclass

Class representing a Nylas webhook.

Attributes:

Name Type Description
id str

Globally unique object identifier.

trigger_types List[WebhookTriggers]

The event that triggers the webhook.

webhook_url str

The URL to send webhooks to.

status WebhookStatus

The status of the new destination.

notification_email_addresses List[str]

The email addresses that Nylas notifies when a webhook is down for a while.

status_updated_at int

The time when the status field was last updated, represented as a Unix timestamp in seconds.

created_at int

The time when the status field was created, represented as a Unix timestamp in seconds.

updated_at int

The time when the status field was last updated, represented as a Unix timestamp in seconds.

description Optional[str]

A human-readable description of the webhook destination.

Source code in nylas/models/webhooks.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@dataclass_json
@dataclass
class Webhook:
    """
    Class representing a Nylas webhook.

    Attributes:
        id: Globally unique object identifier.
        trigger_types: The event that triggers the webhook.
        webhook_url: The URL to send webhooks to.
        status: The status of the new destination.
        notification_email_addresses: The email addresses that Nylas notifies when a webhook is down for a while.
        status_updated_at: The time when the status field was last updated, represented as a Unix timestamp in seconds.
        created_at: The time when the status field was created, represented as a Unix timestamp in seconds.
        updated_at: The time when the status field was last updated, represented as a Unix timestamp in seconds.
        description: A human-readable description of the webhook destination.
    """

    id: str
    trigger_types: List[WebhookTriggers]
    webhook_url: str
    status: WebhookStatus
    notification_email_addresses: List[str]
    status_updated_at: int
    created_at: int
    updated_at: int
    description: Optional[str] = None

WebhookDeleteData dataclass

Class representing the object enclosing the webhook deletion status.

Attributes:

Name Type Description
status str

The status of the webhook deletion.

Source code in nylas/models/webhooks.py
77
78
79
80
81
82
83
84
85
86
87
@dataclass_json
@dataclass
class WebhookDeleteData:
    """
    Class representing the object enclosing the webhook deletion status.

    Attributes:
        status: The status of the webhook deletion.
    """

    status: str

WebhookDeleteResponse dataclass

Class representing a Nylas webhook delete response.

Attributes:

Name Type Description
request_id str

The request's ID.

data Optional[WebhookDeleteData]

Object containing the webhook deletion status.

Source code in nylas/models/webhooks.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
@dataclass_json
@dataclass
class WebhookDeleteResponse:
    """
    Class representing a Nylas webhook delete response.

    Attributes:
        request_id: The request's ID.
        data: Object containing the webhook deletion status.
    """

    request_id: str
    data: Optional[WebhookDeleteData] = None

WebhookIpAddressesResponse dataclass

Class representing the response for getting a list of webhook IP addresses.

Attributes:

Name Type Description
ip_addresses List[str]

The IP addresses that Nylas send your webhook from.

updated_at int

Unix timestamp representing the time when Nylas last updated the list of IP addresses.

Source code in nylas/models/webhooks.py
105
106
107
108
109
110
111
112
113
114
115
116
117
@dataclass_json
@dataclass
class WebhookIpAddressesResponse:
    """
    Class representing the response for getting a list of webhook IP addresses.

    Attributes:
        ip_addresses: The IP addresses that Nylas send your webhook from.
        updated_at: Unix timestamp representing the time when Nylas last updated the list of IP addresses.
    """

    ip_addresses: List[str]
    updated_at: int

WebhookTriggers

Bases: str, Enum

Enum representing the available webhook triggers.

Source code in nylas/models/webhooks.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class WebhookTriggers(str, Enum):
    """Enum representing the available webhook triggers."""

    CALENDAR_CREATED = "calendar.created"
    CALENDAR_UPDATED = "calendar.updated"
    CALENDAR_DELETED = "calendar.deleted"
    EVENT_CREATED = "event.created"
    EVENT_UPDATED = "event.updated"
    EVENT_DELETED = "event.deleted"
    GRANT_CREATED = "grant.created"
    GRANT_UPDATED = "grant.updated"
    GRANT_DELETED = "grant.deleted"
    GRANT_EXPIRED = "grant.expired"
    MESSAGE_SEND_SUCCESS = "message.send_success"
    MESSAGE_SEND_FAILED = "message.send_failed"
    MESSAGE_BOUNCE_DETECTED = "message.bounce_detected"
    MESSAGE_CREATED = "message.created"
    MESSAGE_UPDATED = "message.updated"
    MESSAGE_OPENED = "message.opened"
    MESSAGE_LINK_CLICKED = "message.link_clicked"
    THREAD_REPLIED = "thread.replied"

WebhookWithSecret dataclass

Bases: Webhook

Class representing a Nylas webhook with secret.

Attributes:

Name Type Description
webhook_secret str

A secret value used to encode the X-Nylas-Signature header on webhook requests.

Source code in nylas/models/webhooks.py
64
65
66
67
68
69
70
71
72
73
74
@dataclass_json
@dataclass
class WebhookWithSecret(Webhook):
    """
    Class representing a Nylas webhook with secret.

    Attributes:
        webhook_secret: A secret value used to encode the X-Nylas-Signature header on webhook requests.
    """

    webhook_secret: str = ""