forked from EvolutionAPI/evolution-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstance.py
More file actions
18 lines (14 loc) · 686 Bytes
/
instance.py
File metadata and controls
18 lines (14 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class InstanceService:
def __init__(self, client):
self.client = client
def fetch_instances(self):
return self.client.get('instance/fetchInstances')
def create_instance(self, config):
return self.client.post('instance/create', data=config.__dict__)
def set_webhook(self, instance_name: str, config, instance_token):
data = {'webhook': config.__dict__}
return self.client.post(f"webhook/set/{instance_name}", data=data)
def set_events(self, instance_name: str, config, instance_token: str):
return self.client.post(
f'instance/{instance_name}/{instance_token}/setEvents', data=config.__dict__
)