Events
Fetch events for a lead
Fetches a list of events for a lead in reverse chronological order.
Resource URL
GET /companies/<company_uuid>/leads/<lead_uuid>/events
Parameters
Parameter | Description |
---|---|
start | Pagination start parameter. Starts from this event for lead. Default: 0 |
size | Number of events to return per page. Default: 20 |
Example Request
curl "https://api.metroleads.com/companies/5245533b-e8c4-4292-b6b0-62ac6ecedb3e/leads/2633fdaf-77f2-48bb-9f7b-6c88a760e5b6/events?start=0&size=2"
Example Response
{
"count": 56,
"start": 0,
"events": [
{
"inbound": true,
"data": {
"event_time": "2016-07-07T21:09:23Z",
"event_id": "a34768be-32c4-4121-84af-9f850bc42736",
"created_by_entity": {
"user_id": "fdd063f2-3f53-45ed-9a5d-99971acb6a43",
"name": "John Doe",
"group_id": "b8779d7b-22bd-45c8-b23c-da813ad69a2a",
"company_id": "e17afa78-2a79-11e3-b30e-12313b0ed8fc"
},
"created_by": "user:fdd063f2-3f53-45ed-9a5d-99971acb6a4b",
"comment_count": 0,
"attached_entities": [
{
"type": "lead",
"lead": {
"id": "e1225b12-d466-11e3-bebd-12313d233941"
}
}
],
"message": "This is a note "
},
"type": "note",
"online": true
},
{
"inbound": false,
"data": {
"event_time": "2016-07-05T10:28:14Z",
"event_id": "791e239e-fcf1-478a-8fb1-9d9f4a9dca1b",
"created_by_entity": {
"user_id": "61ab1e13-e154-4f9e-83d0-bfff3ad4b1f4",
"name": "Jane Doe",
"company_id": "e17afa78-2a79-11e3-b30e-12313b0ed8fc",
"group_id": "b8779d7b-22bd-45c8-b23c-da813ad69a2a",
},
"created_by": "user:6fab1e13-e154-4f9e-83d0-bfff3ad4b1f1",
"phone": "+915556991414",
"comment_count": 0,
"attached_entities": [
{
"type": "lead",
"lead": {
"id": "e1125b12-d466-11e3-bebd-12313d233945"
}
}
],
"message": "A sample SMS",
"extra_data": {
"header_checksum": "5a51172208b63c4c7c90270bdfbf8775"
}
},
"type": "sms",
"online": true
}
]
}
Fetch comments for an event
Fetches comments for an event. All comments are sent for event and no pagination is available yet.
Resource URL
GET /companies/<company_uuid>/leads/<lead_uuid>/events/<event_type>/<event_uuid>/comments
Parameters
Parameter | Description |
---|---|
--- | --- |
Example Request
curl "http://m.com/api/companies/e87afa71-2a79-11e1-b301-12313b0ed8f1/leads/e1225b1a-d466-11e1-bebd-12313d233945/events/note/1c791e15-57e1-4991-bf93-3442598e4484/comments"
Example Response
{
"total_count": 2,
"sub_events": [
{
"data": {
"comment": "This is comment number 2",
"sub_event_type": "comment",
"event_time": "2016-06-16T13:21:43Z",
"created_by_entity": {
"user_id": "b9b3f157-95af-450b-8c5a-bbf2ca7a1841",
"name": "John Doe",
"company_id": "e87afa78-2a79-11e3-b30e-12313b0ed8f1",
"group_id": "b8779d7b-22bd-45c8-b23c-da813ad69a21",
},
"sub_event_id": "803eb710-6ead-4ebc-85d3-7d4de701c741",
"created_by": "user:b9b3f157-95af-450b-8c5a-bb12ca7a184c"
},
"sub_event_id": "803eb710-6ead-4ebc-85d3-7d4de701c74b"
},
{
"data": {
"comment": "This is comment number 1",
"sub_event_type": "comment",
"event_time": "2016-06-16T13:21:40Z",
"created_by_entity": {
"user_id": "b9b3f157-95af-450b-8c5a-bbf2ca7a1841",
"name": "Jane Doe",
"company_id": "e87afa78-2a79-11e3-b30e-12313b0ed811",
"group_id": "b8779d7b-22bd-45c8-b23c-da813ad69121",
},
"sub_event_id": "d751d1d4-2dfc-472f-b530-1e8eeca56316",
"created_by": "user:b9b3f157-95af-450b-8c5a-bbf2ca7a1841"
},
"sub_event_id": "d751d1d4-2dfc-472f-b530-1e8eeca56376"
}
]
}
Add a note
Saves a note for the lead. Returns the save event as a single dictionary object which can be safely shown in the timeline without refreshing the entire timeline.
Resource URL
POST /companies/<company_uuid>/leads/<lead_uuid>/note
JSON Body Parameters
Parameter | Description |
---|---|
message | Text for the note. |
Example Request
curl "https://api.metroleads.com/companies/e87afa78-2a79-11e3-b30e-12313b0ed8fc/leads/e1225b12-d466-11e3-bebd-12313d233945/note" -d '{"message":"Please give him a 5% discount"}'
Example Response
{
"inbound": true,
"type": "note",
"data": {
"event_time": "2017-02-23T10:21:08Z",
"tags": [],
"event_id": "63ecec2c-5047-4cd8-ae98-0dda952e21b8",
"created_by_entity": {
"name": "John Doe",
"company_id": "1ef4e845-b1f4-4e48-b2ed-d1f231287d96"
},
"created_by": "user:48d58b40-a31b-445b-bc0c-c8126e2c664a",
"attached_entities": [
{
"type": "lead",
"lead": {
"id": "8a956836-457f-4da6-a8de-66edd3fa11db"
}
}
],
"message": "Please give me a 5% discount"
},
"online": true
}
Update a note
Updates a note. Returns the save event as a single dictionary object which can be safely shown in the timeline without refreshing the entire timeline.
Resource URL
POST /companies/<company_uuid>/leads/<lead_uuid>/note/<note_or_event_uuid>
JSON Body Parameters
Parameter | Description |
---|---|
message | Updated text for the note. |
Example Request
curl "https://api.metroleads.com/companies/1ef4e845-b2f4-4e48-b2ed-d1f238287d96/leads/8a956836-457a-4da6-a8de-66edd3fa81db/note/63ecec2c-5047-4cd8-ae98-0dda952e2db1" -d '{"message":"Please give me a 50% discount"}'
Example Response
{
"inbound": true,
"type": "note",
"data": {
"event_time": "2017-02-23T10:21:08Z",
"tags": [],
"event_id": "63ecec2c-5047-4cd8-ae98-0dda952e21b8",
"created_by_entity": {
"name": "John Doe",
"company_id": "1ef4e845-b1f4-4e48-b2ed-d1f231287d96"
},
"created_by": "user:48d58b40-a31b-445b-bc0c-c8126e2c664a",
"attached_entities": [
{
"type": "lead",
"lead": {
"id": "8a956836-457f-4da6-a8de-66edd3fa11db"
}
}
],
"message": "Please give me a 50% discount"
},
"online": true
}
Remove a note
Removes the note from the lead. Returns the delete note event which can be used for undo actions.
Resource URL
POST /companies/<company_uuid>/leads/<lead_uuid>/note/<note_or_event_uuid>/remove
JSON Body Parameters
Parameter | Description |
---|---|
--- | --- |
Example Request
curl "https://api.metroleads.com/companies/1ef4e845-b2f4-4e48-b2ed-d1f238287d96/leads/8a956836-457a-4da6-a8de-66edd3fa81db/note/63ecec2c-5047-4cd8-ae98-0dda952e2db1/remove"
Example Response
{
"inbound": true,
"type": "note",
"data": {
"event_time": "2017-02-23T10:21:08Z",
"tags": [],
"event_id": "63ecec2c-5047-4cd8-ae98-0dda952e21b8",
"created_by_entity": {
"name": "John Doe",
"company_id": "1ef4e845-b1f4-4e48-b2ed-d1f231287d96"
},
"created_by": "user:48d58b40-a31b-445b-bc0c-c8126e2c664a",
"attached_entities": [
{
"type": "lead",
"lead": {
"id": "8a956836-457f-4da6-a8de-66edd3fa11db"
}
}
],
"message": "Please give me a 50% discount"
},
"online": true
}