Skip to content
Open
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
14 changes: 7 additions & 7 deletions simple_chatwoot/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def create_contact(self,
'identifier': identifier,
'custom_attributes':custom_attributes
}
headers = {'api_access_token': self.api_access_token, 'Content-type': 'application/json'}
headers = {'api-access-token': self.api_access_token, 'Content-type': 'application/json'}
response = requests.post(self.domain+"/api/v1/accounts/"+self.account_id+"/contacts",
data=json.dumps(payload),
headers=headers)
Expand All @@ -105,7 +105,7 @@ def search_contacts(self, search_key:str,page:str="1")->Dict:
* page -- page number, default is 1
"""

headers = {'api_access_token': self.api_access_token, 'Content-type': 'application/json'}
headers = {'api-access-token': self.api_access_token, 'Content-type': 'application/json'}
response = requests.get(self.domain+"/api/v1/accounts/"+self.account_id+"/contacts/search?q="+search_key+"&page="+page,
headers=headers)

Expand Down Expand Up @@ -156,7 +156,7 @@ def create_conversation(self,
# If user sends other arguments, update payload
payload.update(dict(kargs))

headers = {'api_access_token': self.api_access_token, 'Content-type': 'application/json'}
headers = {'api-access-token': self.api_access_token, 'Content-type': 'application/json'}
response = requests.post(self.domain+"/api/v1/accounts/"+self.account_id+"/conversations",
data=json.dumps(payload),
headers=headers)
Expand All @@ -174,7 +174,7 @@ def get_conversation_details(self, conversation_id:str)->Dict:

* conversation_id -- numeric ID of the conversation
"""
headers = {'api_access_token': self.api_access_token, 'Content-type': 'application/json'}
headers = {'api-access-token': self.api_access_token, 'Content-type': 'application/json'}
response = requests.get(self.domain+"/api/v1/accounts/"+self.account_id+"/conversations/"+conversation_id,
headers=headers)

Expand Down Expand Up @@ -207,7 +207,7 @@ def create_message(self,
'message_type': message_type,
'private': is_private,
}
headers = {'api_access_token': self.api_access_token, 'Content-type': 'application/json'}
headers = {'api-access-token': self.api_access_token, 'Content-type': 'application/json'}
response = requests.post(self.domain+"/api/v1/accounts/"+self.account_id+"/conversations/"+conversation_id+"/messages",
data=json.dumps(payload),
headers=headers)
Expand All @@ -225,7 +225,7 @@ def list_messages(self, conversation_id:str)->Dict:

* conversation_id -- numeric ID of the conversation
"""
headers = {'api_access_token': self.api_access_token, 'Content-type': 'application/json'}
headers = {'api-access-token': self.api_access_token, 'Content-type': 'application/json'}
response = requests.get(self.domain+"/api/v1/accounts/"+self.account_id+"/conversations/"+conversation_id+"/messages",
headers=headers)

Expand All @@ -240,7 +240,7 @@ def list_inboxes(self)->Dict:
"""
List all inboxes available in the current account
"""
headers = {'api_access_token': self.api_access_token, 'Content-type': 'application/json'}
headers = {'api-access-token': self.api_access_token, 'Content-type': 'application/json'}
response = requests.get(self.domain+"/api/v1/accounts/"+self.account_id+"/inboxes",
headers=headers)

Expand Down