0
# Integrations
1
2
Rocket.Chat integrations management for creating and managing webhooks and other integration types. Supports both incoming and outgoing webhooks with script execution capabilities.
3
4
## Capabilities
5
6
### Integration Creation
7
8
```python { .api }
9
def integrations_create(
10
self,
11
integrations_type,
12
name,
13
enabled,
14
username,
15
channel,
16
script_enabled,
17
event=None,
18
urls=None,
19
**kwargs
20
):
21
"""
22
Create a new integration.
23
24
Parameters:
25
- integrations_type (str): Integration type ('webhook-incoming' or 'webhook-outgoing')
26
- name (str): Integration name
27
- enabled (bool): Whether integration is enabled
28
- username (str): Username for integration messages
29
- channel (str): Target channel
30
- script_enabled (bool): Enable script execution
31
- event (str, optional): Event type for outgoing webhooks
32
- urls (list, optional): URLs for outgoing webhooks
33
34
Returns:
35
requests.Response: Integration creation result
36
"""
37
```
38
39
### Integration Information
40
41
```python { .api }
42
def integrations_get(self, integration_id, **kwargs):
43
"""
44
Retrieve integration by ID.
45
46
Parameters:
47
- integration_id (str): Integration ID
48
49
Returns:
50
requests.Response: Integration details
51
"""
52
53
def integrations_list(self, **kwargs):
54
"""
55
List all integrations on the server.
56
57
Returns:
58
requests.Response: List of integrations
59
"""
60
61
def integrations_history(self, integration_id, **kwargs):
62
"""
63
Get history of the specified integration.
64
65
Parameters:
66
- integration_id (str): Integration ID
67
68
Returns:
69
requests.Response: Integration execution history
70
"""
71
```
72
73
### Integration Management
74
75
```python { .api }
76
def integrations_update(
77
self,
78
integrations_type,
79
name,
80
enabled,
81
username,
82
channel,
83
script_enabled,
84
integration_id,
85
**kwargs
86
):
87
"""
88
Update an existing integration.
89
90
Parameters:
91
- integrations_type (str): Integration type
92
- name (str): Integration name
93
- enabled (bool): Whether integration is enabled
94
- username (str): Username for integration messages
95
- channel (str): Target channel
96
- script_enabled (bool): Enable script execution
97
- integration_id (str): Integration ID to update
98
99
Returns:
100
requests.Response: Update result
101
"""
102
103
def integrations_remove(self, integrations_type, integration_id, **kwargs):
104
"""
105
Remove an integration from the server.
106
107
Parameters:
108
- integrations_type (str): Integration type
109
- integration_id (str): Integration ID
110
111
Returns:
112
requests.Response: Removal result
113
"""
114
```
115
116
## Integration Types
117
118
```python { .api }
119
IntegrationTypes = [
120
"webhook-incoming", # Incoming webhooks
121
"webhook-outgoing" # Outgoing webhooks
122
]
123
```
124
125
## Usage Examples
126
127
```python
128
# Create incoming webhook
129
webhook = rocket.integrations_create(
130
integrations_type='webhook-incoming',
131
name='GitHub Integration',
132
enabled=True,
133
username='github-bot',
134
channel='general',
135
script_enabled=True
136
)
137
138
# Create outgoing webhook
139
outgoing = rocket.integrations_create(
140
integrations_type='webhook-outgoing',
141
name='Notification Bot',
142
enabled=True,
143
username='notify-bot',
144
channel='alerts',
145
script_enabled=True,
146
event='sendMessage',
147
urls=['https://example.com/webhook']
148
)
149
150
# List all integrations
151
integrations = rocket.integrations_list()
152
153
# Update integration
154
rocket.integrations_update(
155
integrations_type='webhook-incoming',
156
name='Updated GitHub Integration',
157
enabled=True,
158
username='github-bot',
159
channel='development',
160
script_enabled=True,
161
integration_id='integration_id_here'
162
)
163
```