Difference between revisions of "Get SalesCoach account based opportunity list"
Ashley DeBon (talk | contribs) (Created page with "== Get Contact Opportunities (AI Chat Bot) == === Base URL === https://apimobile.callproof.com === Endpoint === /api/ai/chat-bot/contact/{id}/opportunities === Purpose ===...") |
Ashley DeBon (talk | contribs) (→Get Contact Opportunities (AI Chat Bot)) |
||
| Line 1: | Line 1: | ||
| − | == Get Contact Opportunities (AI Chat Bot) == | + | ==[[Mobile_API]] » Get Contact Opportunities (AI Chat Bot) == |
=== Base URL === | === Base URL === | ||
Latest revision as of 15:54, 21 July 2026
Contents
Mobile_API » Get Contact Opportunities (AI Chat Bot)
Base URL
https://apimobile.callproof.com
Endpoint
/api/ai/chat-bot/contact/{id}/opportunities
Purpose
Retrieves a paginated list of opportunities for a specific contact, for use by the AI chat bot. Supports search and sort. The user is resolved from the email request header when provided; otherwise the authenticated user’s email is used.
HTTP Method
GET
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer access token |
| No | User email used to resolve which user’s company context to load. If omitted, the authenticated user’s email is used |
Security
- Yes – Requires Bearer Token authentication.
Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | Unique identifier of the contact |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| search | string | No | Search text to filter opportunities |
| sort_by | integer | No | Sort order: 1 = created date ascending, 2 = created date descending; default sorts by close date ascending
|
| page | integer | No | Page number for pagination (default: 1). Page size is 10 |
Request Body
None.
Successful Response (200)
Returns a paginated list of opportunities for the contact.
| Field | Type | Description |
|---|---|---|
| clientStatusCode | integer | Status indicator for the client (for example, 200) |
| user_id | integer | Identifier of the authenticated user |
| company_id | integer | Identifier of the authenticated user’s company |
| data | object | Opportunities payload |
| firstItemOnPage | integer | Index of the first item on the current page |
| lastItemOnPage | integer | Index of the last item on the current page |
| hasNextPage | boolean | Whether a next page is available |
| hasPreviousPage | boolean | Whether a previous page is available |
| isFirstPage | boolean | Whether the current page is the first page |
| isLastPage | boolean | Whether the current page is the last page |
| next_page_url | string/null | URL of the next page, when available |
| prev_page_url | string/null | URL of the previous page, when available |
| first_page_url | string | URL of the first page |
| last_page_url | string | URL of the last page |
| pageCount | integer | Total number of pages |
| pageNumber | integer | Current page number |
| pageSize | integer | Number of items per page (10) |
| totalItemCount | integer | Total number of matching opportunities |
| uri | string | Requested resource URI |
data.opportunities[]
| Field | Type | Description |
|---|---|---|
| opportunity_id | integer | Unique identifier of the opportunity |
| contact_id | integer | Associated contact identifier |
| associated_account_name | string | Account/company name for the contact |
| contact_type_id | integer/string | Contact type identifier |
| contact_type | string | Contact type name |
| name | string | Opportunity name |
| stage | string | Opportunity stage name |
| stage_id | integer | Opportunity stage identifier |
| closing | string | Close date (format: m-d-Y)
|
| opportunity_type | string | Opportunity type name |
| opportunity_type_id | integer | Opportunity type identifier |
| opportunity_sign | string | Currency/sign used for opportunity value |
| value | number | Opportunity value |
| prob | number | Probability percentage |
| derived | number | Derived value (value × probability / 100) |
| owner | string | Opportunity owner name |
| owner_id | integer | Opportunity owner user ID |
| latitude | string/number | Contact latitude |
| longitude | string/number | Contact longitude |
| linked_contacts | array | Linked people (id, name) |
| linked_accounts | array | Linked accounts (id, name) |
| custom_fields | array | Opportunity custom fields and values |
| note | string | Opportunity notes |
Error Responses
| Status Code | Meaning |
|---|---|
| 400 | Bad Request – invalid user email |
| 401 | Unauthorized / failed to retrieve opportunities – missing/invalid token, or opportunities could not be loaded |
- 400 – The
emailheader / authenticated email could not be resolved to a user ("Invalid user email"). - 401 – Authentication failed, or an error occurred while retrieving opportunities (for example, "Error while retrieving the Contact Opportunities").