agentmail 0.2.6 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/events/types/InboxIds.d.ts +1 -1
  3. package/dist/cjs/api/resources/events/types/PodIds.d.ts +1 -1
  4. package/dist/cjs/api/resources/inboxes/client/Client.js +4 -6
  5. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +13 -0
  6. package/dist/cjs/api/resources/webhooks/client/Client.js +77 -0
  7. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.d.ts +11 -0
  8. package/dist/cjs/api/resources/webhooks/types/UpdateWebhookRequest.js +3 -0
  9. package/dist/cjs/api/resources/webhooks/types/index.d.ts +1 -0
  10. package/dist/cjs/api/resources/webhooks/types/index.js +1 -0
  11. package/dist/cjs/api/resources/websockets/client/Client.d.ts +2 -0
  12. package/dist/cjs/api/resources/websockets/client/Client.js +2 -2
  13. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.d.ts +14 -0
  14. package/dist/cjs/serialization/resources/webhooks/types/UpdateWebhookRequest.js +46 -0
  15. package/dist/cjs/serialization/resources/webhooks/types/index.d.ts +1 -0
  16. package/dist/cjs/serialization/resources/webhooks/types/index.js +1 -0
  17. package/dist/cjs/version.d.ts +1 -1
  18. package/dist/cjs/version.js +1 -1
  19. package/dist/esm/BaseClient.mjs +2 -2
  20. package/dist/esm/api/resources/events/types/InboxIds.d.mts +1 -1
  21. package/dist/esm/api/resources/events/types/PodIds.d.mts +1 -1
  22. package/dist/esm/api/resources/inboxes/client/Client.mjs +4 -6
  23. package/dist/esm/api/resources/webhooks/client/Client.d.mts +13 -0
  24. package/dist/esm/api/resources/webhooks/client/Client.mjs +77 -0
  25. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.d.mts +11 -0
  26. package/dist/esm/api/resources/webhooks/types/UpdateWebhookRequest.mjs +2 -0
  27. package/dist/esm/api/resources/webhooks/types/index.d.mts +1 -0
  28. package/dist/esm/api/resources/webhooks/types/index.mjs +1 -0
  29. package/dist/esm/api/resources/websockets/client/Client.d.mts +2 -0
  30. package/dist/esm/api/resources/websockets/client/Client.mjs +2 -2
  31. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.d.mts +14 -0
  32. package/dist/esm/serialization/resources/webhooks/types/UpdateWebhookRequest.mjs +10 -0
  33. package/dist/esm/serialization/resources/webhooks/types/index.d.mts +1 -0
  34. package/dist/esm/serialization/resources/webhooks/types/index.mjs +1 -0
  35. package/dist/esm/version.d.mts +1 -1
  36. package/dist/esm/version.mjs +1 -1
  37. package/dist/llms-full.txt +716 -20
  38. package/dist/llms.txt +3 -0
  39. package/package.json +1 -1
  40. package/reference.md +57 -0
@@ -1516,6 +1516,143 @@ Pod: "Marketing-Agent"
1516
1516
  * Explore [Domains](/custom-domains) to set up custom email domains for your pods
1517
1517
 
1518
1518
 
1519
+ # Skills
1520
+
1521
+ > AgentMail's official skill for Moltbot, Claude Code, Cursor, and other AI assistants
1522
+
1523
+ ## Getting started
1524
+
1525
+ AgentMail provides an official skill that can be installed on AI coding assistants and agents that support the [AgentSkills](https://skills.sh) format. This includes Moltbot, Claude Code, Cursor, Codex, and other compatible tools.
1526
+
1527
+ The skill is available at [skills.sh/agentmail-to/agentmail-skills/agentmail](https://skills.sh/agentmail-to/agentmail-skills/agentmail).
1528
+
1529
+ ## Installation
1530
+
1531
+ ### Moltbot
1532
+
1533
+ Install the skill using the Moltbot CLI:
1534
+
1535
+ ```bash
1536
+ moltbot skills install agentmail-to/agentmail-skills/agentmail
1537
+ ```
1538
+
1539
+ Or install via ClawdHub:
1540
+
1541
+ ```bash
1542
+ clawdhub install agentmail
1543
+ ```
1544
+
1545
+ ### Claude Code
1546
+
1547
+ Add the skill to your Claude Code configuration:
1548
+
1549
+ ```bash
1550
+ claude-code skills install agentmail-to/agentmail-skills/agentmail
1551
+ ```
1552
+
1553
+ ### Cursor
1554
+
1555
+ Install the skill in Cursor:
1556
+
1557
+ ```bash
1558
+ cursor skills install agentmail-to/agentmail-skills/agentmail
1559
+ ```
1560
+
1561
+ ### Manual installation
1562
+
1563
+ You can also manually clone the skill repository:
1564
+
1565
+ ```bash
1566
+ git clone https://github.com/agentmail-to/agentmail-skills.git ~/.skills/agentmail
1567
+ ```
1568
+
1569
+ ## Configuration
1570
+
1571
+ After installation, configure your AgentMail API key. The method varies by platform:
1572
+
1573
+ ### Environment variable
1574
+
1575
+ Set the `AGENTMAIL_API_KEY` environment variable:
1576
+
1577
+ ```bash
1578
+ export AGENTMAIL_API_KEY="your-api-key-here"
1579
+ ```
1580
+
1581
+ ### Moltbot configuration
1582
+
1583
+ Add the API key to `~/.clawdbot/moltbot.json`:
1584
+
1585
+ ```json
1586
+ {
1587
+ "skills": {
1588
+ "entries": {
1589
+ "agentmail": {
1590
+ "enabled": true,
1591
+ "env": {
1592
+ "AGENTMAIL_API_KEY": "your-api-key-here"
1593
+ }
1594
+ }
1595
+ }
1596
+ }
1597
+ }
1598
+ ```
1599
+
1600
+ Get your API key from the [AgentMail Console](https://console.agentmail.to).
1601
+
1602
+ ## Features
1603
+
1604
+ The official AgentMail skill provides comprehensive email functionality:
1605
+
1606
+ ### Inboxes
1607
+
1608
+ Create scalable inboxes on-demand. Each inbox has a unique email address that your AI agent can use to send and receive emails.
1609
+
1610
+ ### Messages
1611
+
1612
+ Send emails with both plain text and HTML content for best deliverability. The skill handles proper formatting and headers automatically.
1613
+
1614
+ ### Threads
1615
+
1616
+ Threads group related messages in a conversation, making it easy to follow email chains and maintain context across multiple exchanges.
1617
+
1618
+ ### Attachments
1619
+
1620
+ Send and receive attachments with Base64 encoding. The skill can retrieve attachments from messages or threads.
1621
+
1622
+ ### Drafts
1623
+
1624
+ Create drafts for human-in-the-loop approval before sending. This is useful when you want to review emails before they go out.
1625
+
1626
+ ### Pods
1627
+
1628
+ Multi-tenant isolation for SaaS platforms. Each customer gets isolated inboxes, perfect for building email-enabled applications.
1629
+
1630
+ ### Idempotency
1631
+
1632
+ Use idempotency keys for safe retries on create operations. This prevents duplicate emails when network errors occur.
1633
+
1634
+ ### Real-time events
1635
+
1636
+ The skill supports both WebSockets (persistent connection, no public URL needed) and webhooks (HTTP-based notifications) for real-time email notifications.
1637
+
1638
+ ## Example usage
1639
+
1640
+ Once installed, you can ask your AI assistant to perform email tasks:
1641
+
1642
+ * "Create a new email inbox for my project"
1643
+ * "Send an email to [john@example.com](mailto:john@example.com) about the meeting tomorrow"
1644
+ * "Check my inbox for new emails"
1645
+ * "Reply to the latest email from Sarah"
1646
+ * "Create a draft response to the support ticket"
1647
+
1648
+ ## Resources
1649
+
1650
+ * [Official AgentMail Skill on skills.sh](https://skills.sh/agentmail-to/agentmail-skills/agentmail)
1651
+ * [AgentMail Skills Repository](https://github.com/agentmail-to/agentmail-skills)
1652
+ * [AgentMail API Reference](/api-reference)
1653
+ * [AgentMail Console](https://console.agentmail.to)
1654
+
1655
+
1519
1656
  # MCP
1520
1657
 
1521
1658
  > AgentMail's Model Context Protocol (MCP) integration
@@ -1549,6 +1686,284 @@ The AgentMail MCP server works with any MCP-compatible client, including:
1549
1686
  For detailed setup instructions and available tools, visit [mcp.agentmail.to](https://mcp.agentmail.to).
1550
1687
 
1551
1688
 
1689
+ # Moltbot
1690
+
1691
+ > AgentMail's Moltbot (Clawdbot) integration
1692
+
1693
+ ## Getting started
1694
+
1695
+ Moltbot (formerly Clawdbot) is an open-source AI personal assistant that runs on your own devices and integrates with messaging platforms like WhatsApp, Telegram, Discord, and Slack. By adding AgentMail to Moltbot, your agent gains the ability to send and receive emails, enabling two-way email conversations alongside your existing chat channels.
1696
+
1697
+ There are three ways to integrate AgentMail with Moltbot: using the official AgentMail skill, the AgentMail MCP server, or creating a custom skill.
1698
+
1699
+ ## Option 1: Official AgentMail Skill (Recommended)
1700
+
1701
+ The easiest way to add email capabilities to Moltbot is by installing the official AgentMail skill from [skills.sh](https://skills.sh/agentmail-to/agentmail-skills/agentmail). This skill is maintained by the AgentMail team and provides comprehensive email functionality.
1702
+
1703
+ ### Installation
1704
+
1705
+ Install the skill using the Moltbot CLI:
1706
+
1707
+ ```bash
1708
+ moltbot skills install agentmail-to/agentmail-skills/agentmail
1709
+ ```
1710
+
1711
+ Or install via ClawdHub:
1712
+
1713
+ ```bash
1714
+ clawdhub install agentmail
1715
+ ```
1716
+
1717
+ ### Configuration
1718
+
1719
+ Add your AgentMail API key to the skill configuration in `~/.clawdbot/moltbot.json`:
1720
+
1721
+ ```json
1722
+ {
1723
+ "skills": {
1724
+ "entries": {
1725
+ "agentmail": {
1726
+ "enabled": true,
1727
+ "env": {
1728
+ "AGENTMAIL_API_KEY": "your-api-key-here"
1729
+ }
1730
+ }
1731
+ }
1732
+ }
1733
+ }
1734
+ ```
1735
+
1736
+ Get your API key from the [AgentMail Console](https://console.agentmail.to).
1737
+
1738
+ ### Features
1739
+
1740
+ The official skill includes:
1741
+
1742
+ * **Inbox management:** Create scalable inboxes on-demand with unique email addresses
1743
+ * **Message operations:** Send emails with text and HTML content for best deliverability
1744
+ * **Thread management:** Group related messages in conversations
1745
+ * **Attachments:** Send and receive attachments with Base64 encoding
1746
+ * **Drafts:** Create drafts for human-in-the-loop approval before sending
1747
+ * **Pods:** Multi-tenant isolation for SaaS platforms
1748
+ * **Idempotency:** Safe retries on create operations
1749
+ * **Real-time events:** WebSocket and webhook support for notifications
1750
+
1751
+ ### Verify installation
1752
+
1753
+ Check that the skill is loaded:
1754
+
1755
+ ```bash
1756
+ moltbot skills list --eligible
1757
+ ```
1758
+
1759
+ You should see `agentmail` in the list of available skills.
1760
+
1761
+ ## Option 2: MCP Server
1762
+
1763
+ An alternative way to add email capabilities to Moltbot is through the AgentMail MCP server. Moltbot supports MCP (Model Context Protocol) servers, which allows it to connect to external tools like AgentMail.
1764
+
1765
+ ### Setup
1766
+
1767
+ 1. Get your AgentMail API key from the [AgentMail Console](https://console.agentmail.to).
1768
+
1769
+ 2. Add the AgentMail MCP server to your Moltbot configuration. Edit your `~/.clawdbot/moltbot.json` file:
1770
+
1771
+ ```json
1772
+ {
1773
+ "mcp": {
1774
+ "servers": {
1775
+ "agentmail": {
1776
+ "command": "npx",
1777
+ "args": ["-y", "@agentmail/mcp-server"],
1778
+ "env": {
1779
+ "AGENTMAIL_API_KEY": "your-api-key-here"
1780
+ }
1781
+ }
1782
+ }
1783
+ }
1784
+ }
1785
+ ```
1786
+
1787
+ 3. Restart Moltbot to load the new MCP server:
1788
+
1789
+ ```bash
1790
+ moltbot restart
1791
+ ```
1792
+
1793
+ 4. Verify the integration by asking Moltbot to list your inboxes:
1794
+
1795
+ ```
1796
+ List my AgentMail inboxes
1797
+ ```
1798
+
1799
+ ### Available tools
1800
+
1801
+ Once connected, Moltbot can use the following AgentMail tools:
1802
+
1803
+ * **Inbox management:** Create, list, and delete inboxes
1804
+ * **Message operations:** Send, receive, and reply to emails
1805
+ * **Thread management:** Access and manage email threads
1806
+ * **Attachments:** Handle email attachments
1807
+
1808
+ ## Option 3: Custom Skill
1809
+
1810
+ For more control over the integration, you can create a custom AgentMail skill. Skills are directories containing a `SKILL.md` file with instructions for Moltbot.
1811
+
1812
+ ### Create the skill directory
1813
+
1814
+ Create a new skill in your Moltbot workspace:
1815
+
1816
+ ```bash
1817
+ mkdir -p ~/.clawdbot/skills/agentmail
1818
+ ```
1819
+
1820
+ ### Create the skill file
1821
+
1822
+ Create `~/.clawdbot/skills/agentmail/SKILL.md` with the following content:
1823
+
1824
+ ````markdown
1825
+ ---
1826
+ name: agentmail
1827
+ description: Send and receive emails using AgentMail
1828
+ requires:
1829
+ env:
1830
+ - AGENTMAIL_API_KEY
1831
+ ---
1832
+
1833
+ # AgentMail Skill
1834
+
1835
+ You can send and receive emails using the AgentMail API. Use the `exec` tool to run curl commands against the AgentMail API.
1836
+
1837
+ ## API Base URL
1838
+
1839
+ ```
1840
+ https://api.agentmail.to/v1
1841
+ ```
1842
+
1843
+ ## Authentication
1844
+
1845
+ Include your API key in the Authorization header:
1846
+
1847
+ ```
1848
+ Authorization: Bearer $AGENTMAIL_API_KEY
1849
+ ```
1850
+
1851
+ ## Common Operations
1852
+
1853
+ ### List inboxes
1854
+
1855
+ ```bash
1856
+ curl -s -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
1857
+ https://api.agentmail.to/v1/inboxes
1858
+ ```
1859
+
1860
+ ### Create an inbox
1861
+
1862
+ ```bash
1863
+ curl -s -X POST -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
1864
+ -H "Content-Type: application/json" \
1865
+ -d '{"display_name": "My Agent"}' \
1866
+ https://api.agentmail.to/v1/inboxes
1867
+ ```
1868
+
1869
+ ### Send an email
1870
+
1871
+ ```bash
1872
+ curl -s -X POST -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
1873
+ -H "Content-Type: application/json" \
1874
+ -d '{
1875
+ "to": ["recipient@example.com"],
1876
+ "subject": "Hello from Moltbot",
1877
+ "text": "This email was sent by my AI assistant."
1878
+ }' \
1879
+ https://api.agentmail.to/v1/inboxes/{inbox_id}/messages
1880
+ ```
1881
+
1882
+ ### List messages in an inbox
1883
+
1884
+ ```bash
1885
+ curl -s -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
1886
+ https://api.agentmail.to/v1/inboxes/{inbox_id}/messages
1887
+ ```
1888
+
1889
+ ### Reply to a message
1890
+
1891
+ ```bash
1892
+ curl -s -X POST -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
1893
+ -H "Content-Type: application/json" \
1894
+ -d '{"text": "Thanks for your email!"}' \
1895
+ https://api.agentmail.to/v1/inboxes/{inbox_id}/messages/{message_id}/reply
1896
+ ```
1897
+ ````
1898
+
1899
+ ### Configure the skill
1900
+
1901
+ Add your AgentMail API key to the skill configuration in `~/.clawdbot/moltbot.json`:
1902
+
1903
+ ```json
1904
+ {
1905
+ "skills": {
1906
+ "entries": {
1907
+ "agentmail": {
1908
+ "enabled": true,
1909
+ "env": {
1910
+ "AGENTMAIL_API_KEY": "your-api-key-here"
1911
+ }
1912
+ }
1913
+ }
1914
+ }
1915
+ }
1916
+ ```
1917
+
1918
+ ### Verify the skill
1919
+
1920
+ Check that the skill is loaded:
1921
+
1922
+ ```bash
1923
+ moltbot skills list --eligible
1924
+ ```
1925
+
1926
+ You should see `agentmail` in the list of available skills.
1927
+
1928
+ ## Example use cases
1929
+
1930
+ Once AgentMail is integrated with Moltbot, you can ask your agent to:
1931
+
1932
+ * "Create a new email inbox for my project"
1933
+ * "Check my inbox for new emails"
1934
+ * "Send an email to [john@example.com](mailto:john@example.com) about the meeting tomorrow"
1935
+ * "Reply to the latest email from Sarah"
1936
+ * "Forward the invoice email to [accounting@company.com](mailto:accounting@company.com)"
1937
+
1938
+ ## Real-time email notifications
1939
+
1940
+ For proactive email handling, you can combine AgentMail webhooks with Moltbot's webhook support. This allows Moltbot to notify you immediately when new emails arrive.
1941
+
1942
+ 1. Set up a webhook endpoint in Moltbot (see [Moltbot webhook documentation](https://docs.molt.bot/automation/webhook))
1943
+
1944
+ 2. Register the webhook with AgentMail:
1945
+
1946
+ ```bash
1947
+ curl -X POST -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
1948
+ -H "Content-Type: application/json" \
1949
+ -d '{
1950
+ "url": "https://your-moltbot-webhook-url",
1951
+ "events": ["message.received"]
1952
+ }' \
1953
+ https://api.agentmail.to/v1/webhooks
1954
+ ```
1955
+
1956
+ Now Moltbot will be notified whenever a new email arrives, allowing it to proactively inform you or take action.
1957
+
1958
+ ## Resources
1959
+
1960
+ * [Official AgentMail Skill](https://skills.sh/agentmail-to/agentmail-skills/agentmail)
1961
+ * [AgentMail API Reference](/api-reference)
1962
+ * [AgentMail MCP Server](https://mcp.agentmail.to)
1963
+ * [Moltbot Documentation](https://docs.molt.bot)
1964
+ * [Moltbot Skills Guide](https://docs.molt.bot/tools/skills)
1965
+
1966
+
1552
1967
  # Replit
1553
1968
 
1554
1969
  > AgentMail's Replit integration
@@ -11498,8 +11913,6 @@ components:
11498
11913
  - value: attachment
11499
11914
  type_attachments:AttachmentContentId:
11500
11915
  type: string
11501
- type_attachments:AttachmentContent:
11502
- type: string
11503
11916
  type_attachments:SendAttachment:
11504
11917
  type: object
11505
11918
  properties:
@@ -11512,9 +11925,11 @@ components:
11512
11925
  content_id:
11513
11926
  $ref: '#/components/schemas/type_attachments:AttachmentContentId'
11514
11927
  content:
11515
- $ref: '#/components/schemas/type_attachments:AttachmentContent'
11516
- required:
11517
- - content
11928
+ type: string
11929
+ description: Base64 encoded content of attachment.
11930
+ url:
11931
+ type: string
11932
+ description: URL to the attachment.
11518
11933
  type_messages:SendMessageAttachments:
11519
11934
  type: array
11520
11935
  items:
@@ -11810,8 +12225,6 @@ components:
11810
12225
  - value: attachment
11811
12226
  type_attachments:AttachmentContentId:
11812
12227
  type: string
11813
- type_attachments:AttachmentContent:
11814
- type: string
11815
12228
  type_attachments:SendAttachment:
11816
12229
  type: object
11817
12230
  properties:
@@ -11824,9 +12237,11 @@ components:
11824
12237
  content_id:
11825
12238
  $ref: '#/components/schemas/type_attachments:AttachmentContentId'
11826
12239
  content:
11827
- $ref: '#/components/schemas/type_attachments:AttachmentContent'
11828
- required:
11829
- - content
12240
+ type: string
12241
+ description: Base64 encoded content of attachment.
12242
+ url:
12243
+ type: string
12244
+ description: URL to the attachment.
11830
12245
  type_messages:SendMessageAttachments:
11831
12246
  type: array
11832
12247
  items:
@@ -12113,8 +12528,6 @@ components:
12113
12528
  - value: attachment
12114
12529
  type_attachments:AttachmentContentId:
12115
12530
  type: string
12116
- type_attachments:AttachmentContent:
12117
- type: string
12118
12531
  type_attachments:SendAttachment:
12119
12532
  type: object
12120
12533
  properties:
@@ -12127,9 +12540,11 @@ components:
12127
12540
  content_id:
12128
12541
  $ref: '#/components/schemas/type_attachments:AttachmentContentId'
12129
12542
  content:
12130
- $ref: '#/components/schemas/type_attachments:AttachmentContent'
12131
- required:
12132
- - content
12543
+ type: string
12544
+ description: Base64 encoded content of attachment.
12545
+ url:
12546
+ type: string
12547
+ description: URL to the attachment.
12133
12548
  type_messages:SendMessageAttachments:
12134
12549
  type: array
12135
12550
  items:
@@ -12416,8 +12831,6 @@ components:
12416
12831
  - value: attachment
12417
12832
  type_attachments:AttachmentContentId:
12418
12833
  type: string
12419
- type_attachments:AttachmentContent:
12420
- type: string
12421
12834
  type_attachments:SendAttachment:
12422
12835
  type: object
12423
12836
  properties:
@@ -12430,9 +12843,11 @@ components:
12430
12843
  content_id:
12431
12844
  $ref: '#/components/schemas/type_attachments:AttachmentContentId'
12432
12845
  content:
12433
- $ref: '#/components/schemas/type_attachments:AttachmentContent'
12434
- required:
12435
- - content
12846
+ type: string
12847
+ description: Base64 encoded content of attachment.
12848
+ url:
12849
+ type: string
12850
+ description: URL to the attachment.
12436
12851
  type_messages:SendMessageAttachments:
12437
12852
  type: array
12438
12853
  items:
@@ -18641,6 +19056,287 @@ let dataTask = session.dataTask(with: request as URLRequest, completionHandler:
18641
19056
  dataTask.resume()
18642
19057
  ```
18643
19058
 
19059
+ # Update Webhook
19060
+
19061
+ PATCH https://api.agentmail.to/v0/webhooks/{webhook_id}
19062
+ Content-Type: application/json
19063
+
19064
+ Reference: https://docs.agentmail.to/api-reference/webhooks/update
19065
+
19066
+ ## OpenAPI Specification
19067
+
19068
+ ```yaml
19069
+ openapi: 3.1.1
19070
+ info:
19071
+ title: Update Webhook
19072
+ version: endpoint_webhooks.update
19073
+ paths:
19074
+ /v0/webhooks/{webhook_id}:
19075
+ patch:
19076
+ operationId: update
19077
+ summary: Update Webhook
19078
+ tags:
19079
+ - - subpackage_webhooks
19080
+ parameters:
19081
+ - name: webhook_id
19082
+ in: path
19083
+ required: true
19084
+ schema:
19085
+ $ref: '#/components/schemas/type_webhooks:WebhookId'
19086
+ - name: Authorization
19087
+ in: header
19088
+ description: >-
19089
+ Bearer authentication of the form `Bearer <token>`, where token is
19090
+ your auth token.
19091
+ required: true
19092
+ schema:
19093
+ type: string
19094
+ responses:
19095
+ '200':
19096
+ description: Response with status 200
19097
+ content:
19098
+ application/json:
19099
+ schema:
19100
+ $ref: '#/components/schemas/type_webhooks:Webhook'
19101
+ '400':
19102
+ description: Error response with status 400
19103
+ content: {}
19104
+ '404':
19105
+ description: Error response with status 404
19106
+ content: {}
19107
+ requestBody:
19108
+ content:
19109
+ application/json:
19110
+ schema:
19111
+ $ref: '#/components/schemas/type_webhooks:UpdateWebhookRequest'
19112
+ components:
19113
+ schemas:
19114
+ type_webhooks:WebhookId:
19115
+ type: string
19116
+ type_events:InboxIds:
19117
+ type: array
19118
+ items:
19119
+ type: string
19120
+ type_events:PodIds:
19121
+ type: array
19122
+ items:
19123
+ type: string
19124
+ type_webhooks:UpdateWebhookRequest:
19125
+ type: object
19126
+ properties:
19127
+ add_inbox_ids:
19128
+ $ref: '#/components/schemas/type_events:InboxIds'
19129
+ description: Inbox IDs to subscribe to the webhook.
19130
+ remove_inbox_ids:
19131
+ $ref: '#/components/schemas/type_events:InboxIds'
19132
+ description: Inbox IDs to unsubscribe from the webhook.
19133
+ add_pod_ids:
19134
+ $ref: '#/components/schemas/type_events:PodIds'
19135
+ description: Pod IDs to subscribe to the webhook.
19136
+ remove_pod_ids:
19137
+ $ref: '#/components/schemas/type_events:PodIds'
19138
+ description: Pod IDs to unsubscribe from the webhook.
19139
+ type_webhooks:Url:
19140
+ type: string
19141
+ type_events:EventType:
19142
+ type: string
19143
+ enum:
19144
+ - value: message.received
19145
+ - value: message.sent
19146
+ - value: message.delivered
19147
+ - value: message.bounced
19148
+ - value: message.complained
19149
+ - value: message.rejected
19150
+ - value: domain.verified
19151
+ type_events:EventTypes:
19152
+ type: array
19153
+ items:
19154
+ $ref: '#/components/schemas/type_events:EventType'
19155
+ type_webhooks:ClientId:
19156
+ type: string
19157
+ type_webhooks:Webhook:
19158
+ type: object
19159
+ properties:
19160
+ webhook_id:
19161
+ $ref: '#/components/schemas/type_webhooks:WebhookId'
19162
+ url:
19163
+ $ref: '#/components/schemas/type_webhooks:Url'
19164
+ event_types:
19165
+ $ref: '#/components/schemas/type_events:EventTypes'
19166
+ pod_ids:
19167
+ $ref: '#/components/schemas/type_events:PodIds'
19168
+ inbox_ids:
19169
+ $ref: '#/components/schemas/type_events:InboxIds'
19170
+ secret:
19171
+ type: string
19172
+ description: Secret for webhook signature verification.
19173
+ enabled:
19174
+ type: boolean
19175
+ description: Webhook is enabled.
19176
+ updated_at:
19177
+ type: string
19178
+ format: date-time
19179
+ description: Time at which webhook was last updated.
19180
+ created_at:
19181
+ type: string
19182
+ format: date-time
19183
+ description: Time at which webhook was created.
19184
+ client_id:
19185
+ $ref: '#/components/schemas/type_webhooks:ClientId'
19186
+ required:
19187
+ - webhook_id
19188
+ - url
19189
+ - secret
19190
+ - enabled
19191
+ - updated_at
19192
+ - created_at
19193
+
19194
+ ```
19195
+
19196
+ ## SDK Code Examples
19197
+
19198
+ ```typescript
19199
+ import { AgentMailClient } from "agentmail";
19200
+
19201
+ async function main() {
19202
+ const client = new AgentMailClient({
19203
+ environment: "https://api.agentmail.to",
19204
+ apiKey: "YOUR_TOKEN_HERE",
19205
+ });
19206
+ await client.webhooks.update("webhook_id", {});
19207
+ }
19208
+ main();
19209
+
19210
+ ```
19211
+
19212
+ ```python
19213
+ from agentmail import AgentMail
19214
+
19215
+ client = AgentMail(
19216
+ base_url="https://api.agentmail.to",
19217
+ api_key="YOUR_TOKEN_HERE"
19218
+ )
19219
+
19220
+ client.webhooks.update(
19221
+ webhook_id="webhook_id"
19222
+ )
19223
+
19224
+ ```
19225
+
19226
+ ```go
19227
+ package main
19228
+
19229
+ import (
19230
+ "fmt"
19231
+ "strings"
19232
+ "net/http"
19233
+ "io"
19234
+ )
19235
+
19236
+ func main() {
19237
+
19238
+ url := "https://api.agentmail.to/v0/webhooks/webhook_id"
19239
+
19240
+ payload := strings.NewReader("{}")
19241
+
19242
+ req, _ := http.NewRequest("PATCH", url, payload)
19243
+
19244
+ req.Header.Add("Authorization", "Bearer <api_key>")
19245
+ req.Header.Add("Content-Type", "application/json")
19246
+
19247
+ res, _ := http.DefaultClient.Do(req)
19248
+
19249
+ defer res.Body.Close()
19250
+ body, _ := io.ReadAll(res.Body)
19251
+
19252
+ fmt.Println(res)
19253
+ fmt.Println(string(body))
19254
+
19255
+ }
19256
+ ```
19257
+
19258
+ ```ruby
19259
+ require 'uri'
19260
+ require 'net/http'
19261
+
19262
+ url = URI("https://api.agentmail.to/v0/webhooks/webhook_id")
19263
+
19264
+ http = Net::HTTP.new(url.host, url.port)
19265
+ http.use_ssl = true
19266
+
19267
+ request = Net::HTTP::Patch.new(url)
19268
+ request["Authorization"] = 'Bearer <api_key>'
19269
+ request["Content-Type"] = 'application/json'
19270
+ request.body = "{}"
19271
+
19272
+ response = http.request(request)
19273
+ puts response.read_body
19274
+ ```
19275
+
19276
+ ```java
19277
+ HttpResponse<String> response = Unirest.patch("https://api.agentmail.to/v0/webhooks/webhook_id")
19278
+ .header("Authorization", "Bearer <api_key>")
19279
+ .header("Content-Type", "application/json")
19280
+ .body("{}")
19281
+ .asString();
19282
+ ```
19283
+
19284
+ ```php
19285
+ <?php
19286
+
19287
+ $client = new \GuzzleHttp\Client();
19288
+
19289
+ $response = $client->request('PATCH', 'https://api.agentmail.to/v0/webhooks/webhook_id', [
19290
+ 'body' => '{}',
19291
+ 'headers' => [
19292
+ 'Authorization' => 'Bearer <api_key>',
19293
+ 'Content-Type' => 'application/json',
19294
+ ],
19295
+ ]);
19296
+
19297
+ echo $response->getBody();
19298
+ ```
19299
+
19300
+ ```csharp
19301
+ var client = new RestClient("https://api.agentmail.to/v0/webhooks/webhook_id");
19302
+ var request = new RestRequest(Method.PATCH);
19303
+ request.AddHeader("Authorization", "Bearer <api_key>");
19304
+ request.AddHeader("Content-Type", "application/json");
19305
+ request.AddParameter("application/json", "{}", ParameterType.RequestBody);
19306
+ IRestResponse response = client.Execute(request);
19307
+ ```
19308
+
19309
+ ```swift
19310
+ import Foundation
19311
+
19312
+ let headers = [
19313
+ "Authorization": "Bearer <api_key>",
19314
+ "Content-Type": "application/json"
19315
+ ]
19316
+ let parameters = [] as [String : Any]
19317
+
19318
+ let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
19319
+
19320
+ let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/webhooks/webhook_id")! as URL,
19321
+ cachePolicy: .useProtocolCachePolicy,
19322
+ timeoutInterval: 10.0)
19323
+ request.httpMethod = "PATCH"
19324
+ request.allHTTPHeaderFields = headers
19325
+ request.httpBody = postData as Data
19326
+
19327
+ let session = URLSession.shared
19328
+ let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
19329
+ if (error != nil) {
19330
+ print(error as Any)
19331
+ } else {
19332
+ let httpResponse = response as? HTTPURLResponse
19333
+ print(httpResponse)
19334
+ }
19335
+ })
19336
+
19337
+ dataTask.resume()
19338
+ ```
19339
+
18644
19340
  # Create Webhook
18645
19341
 
18646
19342
  POST https://api.agentmail.to/v0/webhooks