# PEOPL APIs
This documentation provides an overview of the system's APIs and its architecture. It explains how each component interacts to deliver core functionalities.

---
## Restart Server (USE WITH CAUTION)
#### Remove Scheduled Messages
1. Log in to [MongoDB](https://account.mongodb.com/account/login) with contacto account.
2. Find cluster0 and collections tab
3. Select the collection of your server (peopl, peopl_sales, peopl_assitant).
4. Delete the table scheduledMessages in the selected collection.
#### Deploy the server
1. Log in to [Heroku](https://id.heroku.com/login) with contacto account.
2. Find the application of your server (peopl, peopl_sales, peopl_assitant).
3. Go to the deploy tab.
4. Find manual deploy and execute the deploy in the default branch.
---
## Base URLs
- **PEOPL API:** `https://peopl-660c92ba0c89.herokuapp.com`
- **PEOPL Sales API:** `https://peopl-sales-7c6128fcf4b5.herokuapp.com`
- **PEOPL Assistant API:** `https://peopl-assistant-5c83f6850119.herokuapp.com`
- **URUS API:** `https://urus.peopl.health`
- **SIENNA API:** `https://sienna.peopl.health`
---
## Message Management
### Send Messages
```bash
URL = "{Base URL}/send-message"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
'code': [CODE],
'message': [MESSAGE],
(optional) 'hidePreview': true | false, # the default is false
(optional) 'fileType': "document" | "image",
(optional) 'fileUrl': [URL],
(optional) 'sendTime': [TIME], # e.g. "2024-09-06 15:05"
(optional) 'timeZone': [TIMEZONE],
# e.g. "America/Lima", "America/Mexico_City"
(optional) 'delayed': false # e.g.true | false, default. false
})
}
```
##### How to get an API KEY?
Ask the owner of the service to give a key
##### Which is my code?
It depends:
- To send a message to an specific number:
```bash
CODE = "[country code][phone number]@s.whatsapp.net"
Example = "51989898989@s.whatsapp.net"
```
- To send a message to a group look into Group table inside General base (Airtable):
```bash
CODE = "[group_id]"
Example = "12351989898989@g.us
```
##### What kinf of text can go inside the message?
Anything that can be written with ascii, including special characters and emojis.
##### Can I send media?
Only images (png) and documents (pdf)
##### Which is the format for timezones?
Only [IANA - TZ identifier](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) format is accepted.
---
### Send Bulk Messages
#### Option 1: Send a generic message to a set of codes (individual/group)
```bash
URL = "{Base URL}/send-bulk-message"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
'codes': [CODE1, CODE2, ...],
'message': [MESSAGE],
(optional) 'hidePreview': true | false, # the default is false
(optional) 'fileType': "document" | "image",
(optional) 'fileUrl': [URL],
(optional) 'sendTime': [TIME], # e.g. "2024-09-06 15:05"
(optional) 'timeZone': [TIMEZONE], # e.g. "America/Lima"
(optional) 'delayed': false # e.g.true | false, default. false
})
}
```
#### Option 2: Send a custom message to a set of individuals based on information in Airtable
```bash
URL = "{Base URL}/send-bulk-message-airtable"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
'message': [MESSAGE],
(optional) 'hidePreview': true | false, # the default is false
(optional) 'fileType': "document" | "image",
(optional) 'fileUrl': [URL],
'baseId': [BASEID],
'tableName': [TABLENAME],
'columnPhone': [COLUMNPHONE],
(optional) 'condition': [CONDITION],
(optional) 'sendTime': [TIME], # e.g. "2024-09-06 15:05"
(optional) 'timeZone': [TIMEZONE], # e.g. "America/Lima"
(optional) 'delayed': false # e.g.true | false, default. false
})
}
```
---
## Poll Management
### Create Polls
```bash
URL = "{Base URL}/create-poll"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
'code': [CODE], # e.g. "51989898989@s.whatsapp.net"
'question': [QUESTION], # e.g. "Que opción eliges?"
'options': [OPTION1, OPTION2, ...], # e.g. ["A", "B", "C"]
'multipleAnswers': true | false
})
}
```
---
## Group Management
### Create Groups
```bash
URL = "{Base URL}/create-group"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"name": [NAME],
"description": [DESCRIPTION] (can be empty),
"message": [MESSAGE] (optional),
"admins": [CODE1, CODE2, ...],
"members": [CODE1, CODE2, ...]
})
}
```
### Get Group Members
```bash
URL = "{Base URL}/get-group-members"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"groupIds": [GROUP_ID_1, GROUP_ID_2, ...]
})
}
```
### Remove Group Members
```bash
URL = "{Base URL}/remove-members"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"groupId": [GROUP_ID], # e.g. "120363317425615032@g.us"
"codes": [CODE1, CODE2, ...], # e.g. [51949614195@s.whatsapp.net", ...]
})
}
```
---
## Calendar Management
### Delete Calendar Event [USE WITH CAUTION]
```bash
URL = "{Base URL}/delete-event"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"eventId": [EVENTID] # e.g. "14msi6l3hpsvmkv97gde0fgr97"
"userEmail": [USEREMAIL] # e.g. "contacto@peopl.health"
})
}
```
---
# PEOPL Sales
## Messages
### Get Last Interaction
```bash
URL = "{Base URL}/get-last-interaction"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"code": CODE, # e.g. "51949614195@s.whatsapp.net"
})
}
```
## Groups
### Verify code
```bash
URL = "{Base URL}/verify-code"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"code": CODE, # e.g. "51949614195@s.whatsapp.net"
})
}
RESPONSE = {
status: true,
response: "5215592261426@s.whatsapp.net" # e.g. null
}
```
## Assistant Management
### Create Assistant
```bash
URL = "{Base URL}/create-assistant"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"assistant_id": ASSISTANT_ID,
"codes": [CODE1, CODE2, ...], # e.g. [51949614195@s.whatsapp.net", ...]
"instrucciones": [INSTRUCTION1, INSTRUCTION2, ...],
"messages": [MESSAGE1, MESSAGE2, ...],
})
}
```
### Add a Message to an Assistant
```bash
URL = "{Base URL}/add-msg-assistant"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"assistant_id": ASSISTANT_ID,
"codes": [CODE1, CODE2, ...], # e.g. [51949614195@s.whatsapp.net", ...]
"messages": [MESSAGE1, MESSAGE2, ...],
})
}
```
### Change active status of an Assistant
```bash
URL = "{Base URL}/active-assistant"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"assistant_id": ASSISTANT_ID,
"code": CODE, # e.g. "51949614195@s.whatsapp.net"
"active": false | true,
})
}
```
---
# PEOPL Assistant
## Assistant Management
### Send Assistant
```bash
URL = "{Base URL}/create-assistant"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"codes": [CODE1, CODE2, ...] # e.g. ["120363317425615032@g.us"]
"instrucciones": [INSTRUCTION1, INSTRUCTION2, ...],
"messages": [MESSAGE1, MESSAGE2, ...],
})
}
```
### Add a Message to an Assistant
```bash
URL = "{Base URL}/add-msg-assistant"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"code": CODE, # e.g. "120363317425615032@g.us"
"messages": [MESSAGE1, MESSAGE2, ...],
(optional) "reply": true | false, # the default is false
})
}
```
### Add a Instruction to an Assistant
```bash
URL = "{Base URL}/add-instruction-assistant"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"code": CODE, # e.g. "120363317425615032@g.us"
"instruction": INSTRUCTION # "Envia un saludo al paciente"
})
}
```
### Change active status of an Assistant
```bash
URL = "{Base URL}/active-assistant"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"code": CODE, # e.g. "51949614195@s.whatsapp.net"
"active": false | true,
})
}
```
### Change stop status of an Assistant
```bash
URL = "{Base URL}/stop-assistant"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"code": CODE, # e.g. "51949614195@s.whatsapp.net"
"stop": false | true,
})
}
```
### Switch an Assistant
```bash
URL = "{Base URL}/switch-assistant"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"code": CODE, # e.g. "120363317425615032@g.us"
"assistant_id": ASSISTANT_ID,
})
}
```
## Meeting bot (SIENNA)
### Record a video
```bash
URL = "{Base URL}/record-meeting"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"eventId": EVENTID,
})
}
```
### Process video from drive
```bash
URL = "{Base URL}/process-recording-calendar"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"eventId": EVENTID,
})
}
```
## LLMs processing (URUS)
### Process images
```bash
URL = "{Base URL}/process-analysis"
JSON = {
method: "POST",
headers: {
'Content-Type': 'application/json',
'x-api-key': [API KEY]
},
body: JSON.stringify({
"url": [URL], # e.g. public URL
"table": [TABLE], # e.g. estudios
"nameCol": [NAME], # e.g. name
"dateCol": [DATE], # e.g. date
"descripCol": [DESCRIPTION], # e.g. description
"recordId": [RECORD_ID] # e.g. rech5ZbIOZl9IfT4Y
})
}
```