Download OpenAPI specification:Download
Welcome to our API reference!
This is the reference documentation for the REST API from Sales section of Zenvia Customer Cloud . This API is based on resources which are represented by JSON format and are manipulated using the HTTP protocol.
And much more...
Before using this API you will need:
In Sales, a lead is a piece of information that allows an agent to contact a potential client. To be useful, this information should include:
A contact or prospect can be added to Zenvia Customer Cloud in two ways:
API Keys enable access to the API with one or more Scopes. Each API Scope enables set of API features.
| Scope | Permissions |
|---|---|
leads:write |
Send lead data for agents to work with. |
prospects:read |
Read prospects, operations and quotes. |
prospects:readAdditionalData |
Read prospects and quote additional data. |
prospects:write |
Create new quotes, update quotes, delete prospects, etc. |
notifications |
Subscribe to notifications via webhooks. |
messages:channels |
List available conversational channels for prospects. |
messages:transactional |
Send transactional messages like appointment information, delivery and shipping notifications. |
messages:conversational |
Send conversational messages for automatic replies, chatbots, and other use cases. |
integration:act-as-user |
Perform operations as a user. |
API Rate Limits are in place to protect Sales from API traffic spikes that could put our databases at risk. We therefore measure the amount of requests sent to the API in order to throttle these when they surpass the amount allowed. We will respond with 429 Too Many Requests and the following headers:
| Header Name | Header Description |
|---|---|
| X-RateLimit-Limit | Maximum number of requests allowed for the app. |
| X-RateLimit-Remaining | Number of requests left in the current time. |
| X-RateLimit-Reset | Time when the number of requests will be reset to the maximum limit. |
The amount of permitted requests resets every 60 seconds
The following endpoints allow creating and registering Leads.
Processes lead data and returns the matching prospect. If the prospect already exists, previous lead data will not be returned.
| priority | number The priority of the Lead |
| provider | string The name/key to identify the provider of the lead. |
| providerLeadId | string The ID of the lead in the provider. |
| utmSource required | string Identify the advertiser, site, publication, etc. that is sending traffic to your property. |
| utmMedium | string The advertising or marketing medium. |
| utmCampaign | string The individual campaign name, slogan, promo code, etc. for a product. |
| firstName | string |
| lastName | string |
| phones | Array of strings |
| emails | Array of strings <email> [ items <email > ] |
Array of objects (Nin) National Identification Number | |
| address | string Full street address. |
| subLocality | string County / other sub-division of a locality, such as communes departments, etc. |
| locality | string City / Municipality. |
| region | string State / Province. |
| country | string |
| zipCode | string Zip Code / Postal Code. |
| listingTitle | string The title of the listing page. |
| listingUrl | string The URL of the listing page. |
| comments | string Any comments worth making to the agent, from the lead or from the acquisition channel. |
| company | string If the lead has an assigned company, indicate it's name or code. Usually, it's the name of the company under the general account. |
| store | string If the lead has an assigned store, indicate it's name or code. Usually is the name of the branch inside the company. |
| agent | string If the lead has an assigned agent, indicate it's email, phone or id. |
| leadId | string @deprecated - use providerLeadId The ID of the lead in the provider. |
| source | string @deprecated - use utmSource Identify the advertiser, site, publication, etc. that is sending traffic to your property. |
| medium | string @deprecated - use utmMedium The contact medium where the lead came from. |
| campaign | string @deprecated - use utmCampaign The individual campaign name, slogan, promo code, etc. for a product. |
Array of objects (NewEvent) Ordered list of lead events | |
object (Product) |
{- "priority": 0,
- "provider": "Webmotors",
- "providerLeadId": "string",
- "utmSource": "google, newsletter4, billboard, ford, bmw",
- "utmMedium": "referral, organic, cpc, email, social, video",
- "utmCampaign": "Christmas / New Year campaign",
- "firstName": "Jorge",
- "lastName": "Letona",
- "phones": [
- "+54 9 11 4552 0371"
], - "nin": [
- {
- "type": "DNI",
- "number": "23345223"
}
], - "address": "Jujuy 986, 1er piso, depto. \"A\"",
- "subLocality": "La Perla",
- "locality": "Mar del Plata",
- "region": "Buenos Aires",
- "country": "Argentina",
- "zipCode": "7600",
- "listingTitle": "MLA 641645231 Ferrari F430 F1 Spyder Cabriolet",
- "comments": "I am interested in the Honda Civic. I will like to receive information about financing. I also have a Fiat Punto as trade in vehicle. Thanks!'",
- "company": "Southern Group",
- "store": "Freedom Branch",
- "leadId": "string",
- "source": "google, newsletter4, billboard, ford, bmw",
- "medium": "cpc, banner, email newsletter, form.",
- "campaign": "Christmas / New Year campaign",
- "history": [
- {
- "type": "question",
- "providerId": "string",
- "threadTitle": "string",
- "threadUrl": "string",
- "question": "string",
- "answer": "string",
- "delivered": true,
- "cancelReason": "string",
- "utmSource": "google, newsletter4, billboard, ford, bmw",
- "startedAt": "2019-08-24T14:15:22Z",
- "duration": 30000,
- "content": "string",
- "sender": "string",
- "recipient": "string",
- "attachment": {
- "type": "string",
- "url": "string",
- "location": { },
- "contacts": { }
}
}
], - "product": {
- "make": "Apple",
- "model": "MQD32LL/A",
- "detail": "13-inch MacBook Air\n1.8GHz dual-core Intel Core i5 processor\nTurbo Boost up to 2.9GHz\n8GB 1600MHz LPDDR3 memory\n128GB SSD storage1\nIntel HD Graphics 6000\n",
- "sku": 6443034,
- "price": {
- "amount": 0,
- "currency": "usd"
}
}
}{- "id": "507f191e810c19729de860ea",
- "created": "2019-08-24T14:15:22Z",
- "account": "string",
- "accountId": "507f191e810c19729de860ea",
- "group": "string",
- "groupId": "507f191e810c19729de860ea",
- "initialGroup": "string",
- "initialGroupId": "507f191e810c19729de860ea",
- "firstName": "Jorge",
- "label": "warm",
- "lastName": "Letona",
- "category": "used",
- "status": "unclaimed",
- "nin": [
- {
- "type": "DNI",
- "number": "23345223"
}
], - "userMade": true,
- "archivingReason": "string",
- "phones": [
- "+54 11 4552 0371"
], - "additionalData": { },
- "merged": true,
- "absenceMessage": "string",
- "leads": [
- {
- "priority": 0,
- "created": "2019-08-24T14:15:22Z",
- "createdBy": "507f191e810c19729de860ea",
- "source": "string",
- "comments": "string",
- "utmSource": "string",
- "providerKey": "string",
- "company": "Southern Group",
- "store": "Freedom Branch",
- "agent": "Marcos García",
- "type": "retail",
- "product": { }
}
], - "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "assigned": "2019-08-24T14:15:22Z",
- "nextReminder": "2019-08-24T14:15:22Z",
- "firstContactedAt": "2019-08-24T14:15:22Z",
- "sentWorkingHourMessage": "2019-08-24T14:15:22Z",
- "interactions": [
- {
- "id": "507f191e810c19729de860ea",
- "agentId": "507f191e810c19729de860ea",
- "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "prospectId": "507f191e810c19729de860ea",
- "createdAt": "2019-08-24T14:15:22Z",
- "dueAt": "2019-08-24T14:15:22Z",
- "startedAt": "2019-08-24T14:15:22Z",
- "finishedAt": "2019-08-24T14:15:22Z",
- "status": "string",
- "proactive": true,
- "via": "inboundCall",
- "output": {
- "comment": "string",
- "reminder": "2019-08-24T14:15:22Z",
- "visitScheduled": "2019-08-24T14:15:22Z",
- "question": {
- "id": "string",
- "providerId": "string",
- "threadTitle": "string",
- "threadUrl": "string",
- "question": "string",
- "answer": "string",
- "delivered": true,
- "cancelReason": "string"
}, - "message": {
- "providerId": "string",
- "template": "string",
- "body": "string",
- "content": "string",
- "delivered": true,
- "sender": "string",
- "recipient": "string",
- "attachment": {
- "type": "string",
- "url": "string"
}, - "via": "whatsApp"
}, - "rejectionReason": "string",
- "proposal": {
- "firstCreatedAt": "2019-08-24T14:15:22Z",
- "items": [
- {
- "price": "string",
- "concept": "string"
}
], - "status": "string"
}, - "status": "string",
- "visitSuccessful": true,
- "callSuccessful": true,
- "webAction": "string",
- "transferedTo": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "transferedToAgentId": "507f191e810c19729de860ea",
- "transferedToGroupId": "507f191e810c19729de860ea",
- "response": "string",
- "conversations": [
- {
- "_id": "507f191e810c19729de860ea",
- "channel": "string",
- "providerName": "string",
- "threadTitle": "string",
- "threadSubtitle": "string",
- "threadThumbnail": "string"
}
], - "customEvent": { }
}
}
]
}Returns a filterable list of prospects.
If a limit is not specified, the query will return prospects from the last 31 days
If a limit is not specified, but a date or range of dates are provided, the query will return prospects within the
date or dates specified. A range of dates is considered valid if the range between them is 31 days or less
Invalid Examples:
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-10-01T01:00:00.000Z -> INVALID
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-06-01T01:00:00.000Z -> INVALID
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-06-01T01:00:00.000Z -> INVALID
Valid Examples:
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-09-01T01:00:00.000Z -> VALID
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-09-01T01:00:00.000Z -> VALID
If only one of the dates is provided, the comparison will be made with the present date
Example:
Assuming that the present date is 2020-10-28T03:00:00.000Z
?createdAfter=2020-08-01:T03:00:00.000Z -> INVALID
?createdAfter=2020-09-30:T03:00:00.000Z -> VALID
| before | string^[a-z0-9]{24}$ Limits the results only to the prospects created before the one provided in this parameter (not included) |
| after | string^[a-z0-9]{24}$ Limits the results only to the prospects created after the one provided in this parameter (not included) |
| limit | number The maximum number of items that must be returned (A multiple number of 100 and no more than 1000 is recommended) |
| search | string A search string to filter prospects. It can be a phone number, an email address or a name. |
| phoneNumber | string A phone number string to filter prospects |
| category | string The category to filter prospects. |
| status | string The status to filter prospects. |
| agent | string^[a-z0-9]{24}$ The id of an agent to filter prospects |
| createdAfter | string <date-time> The start date to filter prospects by their creation date |
| start | string <date-time> @deprecated - use createdAfter The start date to filter prospects by their creation date (alias of createdAfter). |
| createdBefore | string <date-time> The end date to filter prospects by their creation date. |
| end | string <date-time> @deprecated - use createdBefore The end date to filter prospects by their creation date (alias of createdBefore). |
| claimedAfter | string <date-time> The start date to filter prospects by their claim date. |
| claimStart | string <date-time> The start date to filter prospects by their claim date (alias of claimAfter). |
| claimedBefore | string <date-time> The end date to filter prospects by their claim date. |
| claimEnd | string <date-time> The end date to filter prospects by their claim date (alias of claimBefore). |
| transferredAfter | string <date-time> The start date to filter prospects by their transfer date |
| transferStart | string <date-time> The start date to filter prospects by their transfer date (alias of transferredAfter) |
| transferredBefore | string <date-time> The end date to filter prospects by their transfer date |
| transferEnd | string <date-time> The end date to filter prospects by their transfer date (alias of transferredBefore) |
| withAgent | boolean A boolean specifying whether a prospect has an assigned Agent or not |
| group | string^[a-z0-9]{24}$ The id of a group to filter prospects |
| additionalData | Array of strings List of filters for additionalData on format
|
| format | string Enum: "csv" "json" An optional flag to force a response format. Note that the API also supports content negotiation and honors the Accept header. |
[- {
- "id": "507f191e810c19729de860ea",
- "created": "2019-08-24T14:15:22Z",
- "account": "string",
- "accountId": "507f191e810c19729de860ea",
- "group": "string",
- "groupId": "507f191e810c19729de860ea",
- "initialGroup": "string",
- "initialGroupId": "507f191e810c19729de860ea",
- "firstName": "Jorge",
- "label": "warm",
- "lastName": "Letona",
- "category": "used",
- "status": "unclaimed",
- "nin": [
- {
- "type": "DNI",
- "number": "23345223"
}
], - "userMade": true,
- "archivingReason": "string",
- "phones": [
- "+54 11 4552 0371"
], - "additionalData": { },
- "merged": true,
- "absenceMessage": "string",
- "leads": [
- {
- "priority": 0,
- "created": "2019-08-24T14:15:22Z",
- "createdBy": "507f191e810c19729de860ea",
- "source": "string",
- "comments": "string",
- "utmSource": "string",
- "providerKey": "string",
- "company": "Southern Group",
- "store": "Freedom Branch",
- "agent": "Marcos García",
- "type": "retail",
- "product": { }
}
], - "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "assigned": "2019-08-24T14:15:22Z",
- "nextReminder": "2019-08-24T14:15:22Z",
- "firstContactedAt": "2019-08-24T14:15:22Z",
- "sentWorkingHourMessage": "2019-08-24T14:15:22Z"
}
]Returns a prospect searching by their phone number and/or email. Please notice that even both of these params being optionals, it is necessary to inform at least one of them for the request to be successful processed
string Email address string to search for | |
| phoneNumber | string A phone number string to search for |
{- "id": "507f191e810c19729de860ea",
- "firstName": "John",
- "phones": [
- "+98 76 5432 1234"
], - "account": "507f191e810c19729de860ea",
- "claimedBy": "507f191e810c19729de860ea"
}Returns an specific prospect by its ID.
| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
{- "id": "507f191e810c19729de860ea",
- "created": "2019-08-24T14:15:22Z",
- "account": "string",
- "accountId": "507f191e810c19729de860ea",
- "group": "string",
- "groupId": "507f191e810c19729de860ea",
- "initialGroup": "string",
- "initialGroupId": "507f191e810c19729de860ea",
- "firstName": "Jorge",
- "label": "warm",
- "lastName": "Letona",
- "category": "used",
- "status": "unclaimed",
- "nin": [
- {
- "type": "DNI",
- "number": "23345223"
}
], - "userMade": true,
- "archivingReason": "string",
- "phones": [
- "+54 11 4552 0371"
], - "additionalData": { },
- "merged": true,
- "absenceMessage": "string",
- "leads": [
- {
- "priority": 0,
- "created": "2019-08-24T14:15:22Z",
- "createdBy": "507f191e810c19729de860ea",
- "source": "string",
- "comments": "string",
- "utmSource": "string",
- "providerKey": "string",
- "company": "Southern Group",
- "store": "Freedom Branch",
- "agent": "Marcos García",
- "type": "retail",
- "product": { }
}
], - "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "assigned": "2019-08-24T14:15:22Z",
- "nextReminder": "2019-08-24T14:15:22Z",
- "firstContactedAt": "2019-08-24T14:15:22Z",
- "sentWorkingHourMessage": "2019-08-24T14:15:22Z"
}Returns a filterable list of interactions.
If a limit is not specified, the query will return interactions from the last 31 days
If a limit is not specified, but a date or range of dates are provided, the query will return interactions within the
date or dates specified. A range of dates is considered valid if the range between them is 31 days or less
Invalid Examples:
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-10-01T01:00:00.000Z -> INVALID
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-06-01T01:00:00.000Z -> INVALID
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-06-01T01:00:00.000Z -> INVALID
Valid Examples:
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-09-01T01:00:00.000Z -> VALID
?createdAfter=2020-08-01T01:00:00.000Z&createdBefore=2020-09-01T01:00:00.000Z -> VALID
If only one of the dates is provided, the comparison will be made with the present date
Example:
Assuming that the present date is 2020-10-28T03:00:00.000Z
?createdAfter=2020-08-01:T03:00:00.000Z -> INVALID
?createdAfter=2020-09-30:T03:00:00.000Z -> VALID
| before | string^[a-z0-9]{24}$ Limits the results only to the prospects created before the one provided in this parameter (not included) |
| after | string^[a-z0-9]{24}$ Limits the results only to the prospects created after the one provided in this parameter (not included) |
| limit | number The maximum number of items that must be returned (A multiple number of 100 and no more than 1000 is recommended) |
| agent | string The id of the agent to filter. |
| status | string The status to filter. |
| createdAfter | string <date-time> The start date to filter interactions by their creation date. |
| start | string <date-time> @deprecated - use createdAfter The start date to filter interactions by their creation date (alias of createdAfter). |
| createdBefore | string <date-time> The end date to filter interactions by their creation date. |
| end | string <date-time> @deprecated - use createdBefore The end date to filter interactions by their creation date (alias of createdBefore). |
| via | Array of strings Items Enum: "walkIn" "sms" "whatsApp" "email" "testDrive" "visit" "phoneCall" "outboundCall" "inboundCall" "facebook" |
| format | string Enum: "csv" "json" An optional flag to force a response format. Note that the API also supports content negotiation and honors the Accept header. |
[- {
- "id": "507f191e810c19729de860ea",
- "agentId": "507f191e810c19729de860ea",
- "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "prospectId": "507f191e810c19729de860ea",
- "createdAt": "2019-08-24T14:15:22Z",
- "dueAt": "2019-08-24T14:15:22Z",
- "startedAt": "2019-08-24T14:15:22Z",
- "finishedAt": "2019-08-24T14:15:22Z",
- "status": "string",
- "proactive": true,
- "via": "inboundCall",
- "output": {
- "comment": "string",
- "reminder": "2019-08-24T14:15:22Z",
- "visitScheduled": "2019-08-24T14:15:22Z",
- "question": {
- "id": "string",
- "providerId": "string",
- "threadTitle": "string",
- "threadUrl": "string",
- "question": "string",
- "answer": "string",
- "delivered": true,
- "cancelReason": "string"
}, - "message": {
- "providerId": "string",
- "template": "string",
- "body": "string",
- "content": "string",
- "delivered": true,
- "sender": "string",
- "recipient": "string",
- "attachment": {
- "type": "string",
- "url": "string"
}, - "via": "whatsApp"
}, - "rejectionReason": "string",
- "proposal": {
- "firstCreatedAt": "2019-08-24T14:15:22Z",
- "items": [
- {
- "price": "string",
- "concept": "string"
}
], - "status": "string"
}, - "status": "string",
- "visitSuccessful": true,
- "callSuccessful": true,
- "webAction": "string",
- "transferedTo": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "transferedToAgentId": "507f191e810c19729de860ea",
- "transferedToGroupId": "507f191e810c19729de860ea",
- "response": "string",
- "conversations": [
- {
- "_id": "507f191e810c19729de860ea",
- "channel": "string",
- "providerName": "string",
- "threadTitle": "string",
- "threadSubtitle": "string",
- "threadThumbnail": "string"
}
], - "customEvent": { }
}
}
]Returns a filterable list of interactions related to a prospect.
| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
| status | string The status to filter interactions. |
| createdAfter | string <date-time> The start date to filter interactions by their creation date. |
| start | string <date-time> @deprecated - use createdAfter The start date to filter interactions by their creation date (alias of createdAfter). |
| createdBefore | string <date-time> The end date to filter interactions by their creation date. |
| end | string <date-time> @deprecated - use createdBefore The end date to filter interactions by their creation date (alias of createdBefore). |
| via | Array of strings Items Enum: "walkIn" "sms" "whatsApp" "email" "testDrive" "visit" "phoneCall" "outboundCall" "inboundCall" "facebook" |
| format | string Enum: "csv" "json" An optional flag to force a response format. Note that the API also supports content negotiation and honors the Accept header. |
[- {
- "id": "507f191e810c19729de860ea",
- "agentId": "507f191e810c19729de860ea",
- "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "prospectId": "507f191e810c19729de860ea",
- "createdAt": "2019-08-24T14:15:22Z",
- "dueAt": "2019-08-24T14:15:22Z",
- "startedAt": "2019-08-24T14:15:22Z",
- "finishedAt": "2019-08-24T14:15:22Z",
- "status": "string",
- "proactive": true,
- "via": "inboundCall",
- "output": {
- "comment": "string",
- "reminder": "2019-08-24T14:15:22Z",
- "visitScheduled": "2019-08-24T14:15:22Z",
- "question": {
- "id": "string",
- "providerId": "string",
- "threadTitle": "string",
- "threadUrl": "string",
- "question": "string",
- "answer": "string",
- "delivered": true,
- "cancelReason": "string"
}, - "message": {
- "providerId": "string",
- "template": "string",
- "body": "string",
- "content": "string",
- "delivered": true,
- "sender": "string",
- "recipient": "string",
- "attachment": {
- "type": "string",
- "url": "string"
}, - "via": "whatsApp"
}, - "rejectionReason": "string",
- "proposal": {
- "firstCreatedAt": "2019-08-24T14:15:22Z",
- "items": [
- {
- "price": "string",
- "concept": "string"
}
], - "status": "string"
}, - "status": "string",
- "visitSuccessful": true,
- "callSuccessful": true,
- "webAction": "string",
- "transferedTo": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "transferedToAgentId": "507f191e810c19729de860ea",
- "transferedToGroupId": "507f191e810c19729de860ea",
- "response": "string",
- "conversations": [
- {
- "_id": "507f191e810c19729de860ea",
- "channel": "string",
- "providerName": "string",
- "threadTitle": "string",
- "threadSubtitle": "string",
- "threadThumbnail": "string"
}
], - "customEvent": { }
}
}
]Transfer a Prospect to a group
| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
Define the destination user or group.
| group | string (ObjectId) ^[a-z0-9]{24}$ Unique identifier of an object. |
| user | string (ObjectId) ^[a-z0-9]{24}$ Unique identifier of an object. |
{- "group": "507f191e810c19729de860ea",
- "user": "507f191e810c19729de860ea"
}{- "success": true
}This endpoint returns the channels (communication channels) available in the scope of the App.
[- {
- "channel": "whatsapp",
- "channelId": "string",
- "templates": [
- {
- "key": "string",
- "name": "string",
- "body": "string",
- "template": "string"
}
]
}
]Given an ProspectID, this endpoint returns the channels (communication channels) available for that prospect.
| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
[- {
- "channel": "whatsapp",
- "channelId": "string",
- "templates": [
- {
- "key": "string",
- "name": "string",
- "body": "string",
- "template": "string"
}
]
}
]Send a transactional template message to a prospect
| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
| channel required | string Enum: "whatsapp" "facebook" Conversational Channel for sending messages. |
| key required | string Template key |
object Optional parameters for overriding template parameters. The empty variables must not contain four consecutive spaces, carriage return, new line or tabulations. More information here: https://developers.facebook.com/docs/whatsapp/message-templates/creation |
{- "key": "string",
- "parameters": {
- "prospect.firstName": "Jonathan"
}
}[- {
- "id": "507f191e810c19729de860ea",
- "agentId": "507f191e810c19729de860ea",
- "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "prospectId": "507f191e810c19729de860ea",
- "createdAt": "2019-08-24T14:15:22Z",
- "dueAt": "2019-08-24T14:15:22Z",
- "startedAt": "2019-08-24T14:15:22Z",
- "finishedAt": "2019-08-24T14:15:22Z",
- "status": "string",
- "proactive": true,
- "via": "inboundCall",
- "output": {
- "comment": "string",
- "reminder": "2019-08-24T14:15:22Z",
- "visitScheduled": "2019-08-24T14:15:22Z",
- "question": {
- "id": "string",
- "providerId": "string",
- "threadTitle": "string",
- "threadUrl": "string",
- "question": "string",
- "answer": "string",
- "delivered": true,
- "cancelReason": "string"
}, - "message": {
- "providerId": "string",
- "template": "string",
- "body": "string",
- "content": "string",
- "delivered": true,
- "sender": "string",
- "recipient": "string",
- "attachment": {
- "type": "string",
- "url": "string"
}, - "via": "whatsApp"
}, - "rejectionReason": "string",
- "proposal": {
- "firstCreatedAt": "2019-08-24T14:15:22Z",
- "items": [
- {
- "price": "string",
- "concept": "string"
}
], - "status": "string"
}, - "status": "string",
- "visitSuccessful": true,
- "callSuccessful": true,
- "webAction": "string",
- "transferedTo": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "transferedToAgentId": "507f191e810c19729de860ea",
- "transferedToGroupId": "507f191e810c19729de860ea",
- "response": "string",
- "conversations": [
- {
- "_id": "507f191e810c19729de860ea",
- "channel": "string",
- "providerName": "string",
- "threadTitle": "string",
- "threadSubtitle": "string",
- "threadThumbnail": "string"
}
], - "customEvent": { }
}
}
]This endpoint returns the channels (communication channels) available in the scope of the App.
[- {
- "channel": "whatsapp",
- "channelId": "string",
- "templates": [
- {
- "key": "string",
- "name": "string",
- "body": "string",
- "template": "string"
}
]
}
]Given an ProspectID, this endpoint returns the channels (communication channels) available for that prospect.
| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
[- {
- "channel": "whatsapp",
- "channelId": "string",
- "templates": [
- {
- "key": "string",
- "name": "string",
- "body": "string",
- "template": "string"
}
]
}
]| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
| channel required | string Enum: "whatsapp" "facebook" Conversational Channel for sending messages. |
required | object The file to send to the prospect |
var request = require('request'); var fs = require('fs'); var options = { 'method': 'GET', 'url': 'https://sales.zenvia.com/api/v1/prospect/${prospectId}/messaging/${channel}/send-file?api-key=${apiKey}', 'headers': { }, formData: { 'file': { 'value': fs.createReadStream('/Users/image.jpg'), 'options': { 'filename': 'image.jpg', 'contentType': 'image/jpeg', 'knownLength': 1024 } } } }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); });
{- "message": "string",
- "code": "string"
}Send a conversational message to a prospect
| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
| channel required | string Enum: "whatsapp" "facebook" Conversational Channel for sending messages. |
| content | string Message content |
{- "content": "string"
}[- {
- "id": "507f191e810c19729de860ea",
- "agentId": "507f191e810c19729de860ea",
- "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "prospectId": "507f191e810c19729de860ea",
- "createdAt": "2019-08-24T14:15:22Z",
- "dueAt": "2019-08-24T14:15:22Z",
- "startedAt": "2019-08-24T14:15:22Z",
- "finishedAt": "2019-08-24T14:15:22Z",
- "status": "string",
- "proactive": true,
- "via": "inboundCall",
- "output": {
- "comment": "string",
- "reminder": "2019-08-24T14:15:22Z",
- "visitScheduled": "2019-08-24T14:15:22Z",
- "question": {
- "id": "string",
- "providerId": "string",
- "threadTitle": "string",
- "threadUrl": "string",
- "question": "string",
- "answer": "string",
- "delivered": true,
- "cancelReason": "string"
}, - "message": {
- "providerId": "string",
- "template": "string",
- "body": "string",
- "content": "string",
- "delivered": true,
- "sender": "string",
- "recipient": "string",
- "attachment": {
- "type": "string",
- "url": "string"
}, - "via": "whatsApp"
}, - "rejectionReason": "string",
- "proposal": {
- "firstCreatedAt": "2019-08-24T14:15:22Z",
- "items": [
- {
- "price": "string",
- "concept": "string"
}
], - "status": "string"
}, - "status": "string",
- "visitSuccessful": true,
- "callSuccessful": true,
- "webAction": "string",
- "transferedTo": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "transferedToAgentId": "507f191e810c19729de860ea",
- "transferedToGroupId": "507f191e810c19729de860ea",
- "response": "string",
- "conversations": [
- {
- "_id": "507f191e810c19729de860ea",
- "channel": "string",
- "providerName": "string",
- "threadTitle": "string",
- "threadSubtitle": "string",
- "threadThumbnail": "string"
}
], - "customEvent": { }
}
}
]Returns a list of groups and users the App can transfer prospects to.
{- "agents": [
- {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}
], - "groups": [
- {
- "id": "507f191e810c19729de860ea",
- "name": "string"
}
]
}Transfer a Prospect to a group or user. The integration (linked to the apiKey) must have a user configured. Also, the integrationType scope must have integration:act-as-user.
| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
Define the destination user or group.
| group | string (ObjectId) ^[a-z0-9]{24}$ Unique identifier of an object. |
| user | string (ObjectId) ^[a-z0-9]{24}$ Unique identifier of an object. |
{- "group": "507f191e810c19729de860ea",
- "user": "507f191e810c19729de860ea"
}{- "success": true,
- "error": "string"
}Archives a Prospect with an archiving reason. The integration (linked to the apiKey) must have a user configured. Also, the integrationType scope must have integration:act-as-user.
| prospectId required | string^[a-z0-9]{24}$ The ID of the prospect. |
The archiving reason that can be used
| archivingReason | string When the prospect is archived this property contains the code of the reason why it was filed. |
| firstName | string |
| lastName | string |
| phone | string Phone to add to the prospect |
string <email> Email to add to the prospect | |
| label | string Change Label of the prospect |
{- "archivingReason": "string",
- "firstName": "Jorge",
- "lastName": "Letona",
- "phone": "string",
- "label": "string"
}{- "id": "507f191e810c19729de860ea",
- "created": "2019-08-24T14:15:22Z",
- "account": "string",
- "accountId": "507f191e810c19729de860ea",
- "group": "string",
- "groupId": "507f191e810c19729de860ea",
- "initialGroup": "string",
- "initialGroupId": "507f191e810c19729de860ea",
- "firstName": "Jorge",
- "label": "warm",
- "lastName": "Letona",
- "category": "used",
- "status": "unclaimed",
- "nin": [
- {
- "type": "DNI",
- "number": "23345223"
}
], - "userMade": true,
- "archivingReason": "string",
- "phones": [
- "+54 11 4552 0371"
], - "additionalData": { },
- "merged": true,
- "absenceMessage": "string",
- "leads": [
- {
- "priority": 0,
- "created": "2019-08-24T14:15:22Z",
- "createdBy": "507f191e810c19729de860ea",
- "source": "string",
- "comments": "string",
- "utmSource": "string",
- "providerKey": "string",
- "company": "Southern Group",
- "store": "Freedom Branch",
- "agent": "Marcos García",
- "type": "retail",
- "product": { }
}
], - "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "assigned": "2019-08-24T14:15:22Z",
- "nextReminder": "2019-08-24T14:15:22Z",
- "firstContactedAt": "2019-08-24T14:15:22Z",
- "sentWorkingHourMessage": "2019-08-24T14:15:22Z"
}{- "id": "507f191e810c19729de860ea",
- "name": "string",
- "providerKey": "string",
- "groupId": "507f191e810c19729de860ea",
- "group": "string",
- "user": "507f191e810c19729de860ea",
- "language": "string",
- "account": "string",
- "accountId": "507f191e810c19729de860ea"
}Returns the active integrations in the scope of the API Key
[- {
- "id": "507f191e810c19729de860ea",
- "name": "string",
- "providerKey": "string",
- "groupId": "507f191e810c19729de860ea",
- "group": "string",
- "user": "507f191e810c19729de860ea",
- "language": "string",
- "account": "string",
- "accountId": "507f191e810c19729de860ea"
}
]Returns the agents from group
| group required | string The groups to get the agents. |
| active | string Status of the agent/s. |
| format | string Enum: "csv" "json" An optional flag to force a response format. Note that the API also supports content negotiation and honors the Accept header. |
[- {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}
]Returns the groups that are within the scope of the App
| parent | string^[a-z0-9]{24}$ The ID of the parent group. |
[- {
- "id": "string",
- "displayName": "string",
- "name": "string",
- "parent": "string",
- "ancestors": [
- "string"
], - "descendants": [
- "string"
], - "type": [
- "string"
], - "timezone": "string"
}
]Returns all immediate children of provided group. If no group is provided then the group where the API Access api-key is located will be assumed as the parent.
| parent | string^[a-z0-9]{24}$ The ID of the parent group. |
| format | string Enum: "csv" "json" An optional flag to force a response format. Note that the API also supports content negotiation and honors the Accept header. |
[- {
- "id": "string",
- "displayName": "string",
- "name": "string",
- "parent": "string",
- "ancestors": [
- "string"
], - "descendants": [
- "string"
], - "type": [
- "string"
], - "timezone": "string"
}
]Returns the group that corresponds to the given groupId
| groupId required | string^[a-z0-9]{24}$ The ID of the group. |
{- "id": "string",
- "displayName": "string",
- "name": "string",
- "parent": "string",
- "ancestors": [
- "string"
], - "descendants": [
- "string"
], - "type": [
- "string"
], - "timezone": "string"
}Returns all online agents for the provided group.
| groupId required | string^[a-z0-9]{24}$ The ID of the group. |
| availableAgents | boolean Filter by available agents. |
{- "officeHours": true,
- "agents": [
- {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}
]
}Webhooks allow you to receive notifications to a desired callback URL when something happens in Sales without constantly having to poll the API. Through the API, you can subscribe to the following topics: prospects (contacts), interactions (operations), quotes and agents.
You can review or delete the available subscriptions at any time, directly via the Notifications API.
If your service has problems handling notifications at any time, we will or will not attempt to re-send failed notifications depending on the case:
We will retry up to 20 times in the following cases:
We will not retry in the following cases:
| Successful Request | Failed Request |
|---|---|
| Status Code < 400 | Timeout or Status Code >= 400 |
Get notified of changes on prospects or when a new prospect is created.
When you subscribe to this topic, your webhook will receive a request with the following schema:
| subscriptionId | string (Subscription Id) |
| topic | string |
| type | string (Notification type) Enum: "updated" "created" |
| received | string <date-time> (Notification time) |
| sent | string <date-time> (Notification time) |
| attempts | number |
Array of objects (Prospect Information) | |
| updatedAt | string <date-time> (Date and time of the update) |
| operationId | string |
| whatsAppDueAt | string <date-time> (in case the prospect has an open Whatsapp conversation, this field indicates until when the window to send free messages is open) |
| facebookDueAt | string <date-time> (in case the prospect has an open Facebook Messenger conversation, this field indicates until when the window to send free messages is open) |
| updates | Array of objects (List of updates related to this prospect) |
{- "subscriptionId": "string",
- "topic": "prospects",
- "type": "updated",
- "received": "2019-08-24T14:15:22Z",
- "sent": "2019-08-24T14:15:22Z",
- "attempts": 0,
- "prospect": [
- {
- "id": "string",
- "created": "2019-08-24T14:15:22Z",
- "group": "string",
- "groupId": "string",
- "account": "string",
- "accountId": "string",
- "initialGroup": "string",
- "initialGroupId": "string",
- "firstName": "string",
- "lastName": "string",
- "category": "string",
- "userMade": true,
- "status": "string",
- "additionalData": { },
- "phones": [
- "+54 9 11 4552 0371"
], - "contactMediums": [
- { }
], - "leads": [
- {
- "created": "string",
- "createdBy": "string",
- "source": "string",
- "utmSource": "string",
- "providerKey": "string",
- "comments": "string",
- "type": "string"
}
], - "agent": [
- {
- "id": "string",
- "firstName": "string",
- "lastName": "string",
- "phone": "string",
- "email": "string"
}
], - "assigned": "2019-08-24T14:15:22Z",
- "firstContactedAt": "2019-08-24T14:15:22Z"
}
], - "updatedAt": "2019-08-24T14:15:22Z",
- "operationId": "string",
- "whatsAppDueAt": "2019-08-24T14:15:22Z",
- "facebookDueAt": "2019-08-24T14:15:22Z",
- "updates": [
- { }
]
}| Notification | Payload change |
|---|---|
| New prospect created | Type: “created” |
| The information of a prospect has been edited | Type: “updated” "status": "followUp" / “archived”/”unclaimed”/”new”/etc “Updates”: list of changes |
Events related to existing or new interactions are notified in this topic.
When you subscribe to this topic, your webhook will receive a request with the following schema:
| subscriptionId | string (Subscription Id) |
| topic | string (interactions) |
| type | string (Notification type) Enum: "updated" "created" |
| received | string <date-time> (Notification time) |
| sent | string <date-time> (Notification time) |
| attempts | number |
Array of objects (Prospect Information) | |
| updatedAt | string <date-time> (Date and time of the update) |
| operationId | string |
object (Interaction) Interactions are any kind of contact that an agent has with a prospect. This can be a phone call, a WhatsApp message, an email, a visit, etc. |
{- "subscriptionId": "string",
- "topic": "interactions",
- "type": "updated",
- "received": "2019-08-24T14:15:22Z",
- "sent": "2019-08-24T14:15:22Z",
- "attempts": 0,
- "prospect": [
- {
- "id": "string",
- "created": "2019-08-24T14:15:22Z",
- "group": "string",
- "groupId": "string",
- "account": "string",
- "accountId": "string",
- "initialGroup": "string",
- "initialGroupId": "string",
- "firstName": "string",
- "lastName": "string",
- "category": "string",
- "userMade": true,
- "status": "string",
- "additionalData": { },
- "phones": [
- "+54 9 11 4552 0371"
], - "contactMediums": [
- { }
], - "leads": [
- {
- "created": "string",
- "createdBy": "string",
- "source": "string",
- "utmSource": "string",
- "providerKey": "string",
- "comments": "string",
- "type": "string"
}
], - "agent": [
- {
- "id": "string",
- "firstName": "string",
- "lastName": "string",
- "phone": "string",
- "email": "string"
}
], - "assigned": "2019-08-24T14:15:22Z",
- "firstContactedAt": "2019-08-24T14:15:22Z"
}
], - "updatedAt": "2019-08-24T14:15:22Z",
- "operationId": "string",
- "interaction": {
- "id": "507f191e810c19729de860ea",
- "agentId": "507f191e810c19729de860ea",
- "agent": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "prospectId": "507f191e810c19729de860ea",
- "createdAt": "2019-08-24T14:15:22Z",
- "dueAt": "2019-08-24T14:15:22Z",
- "startedAt": "2019-08-24T14:15:22Z",
- "finishedAt": "2019-08-24T14:15:22Z",
- "status": "string",
- "proactive": true,
- "via": "inboundCall",
- "output": {
- "comment": "string",
- "reminder": "2019-08-24T14:15:22Z",
- "visitScheduled": "2019-08-24T14:15:22Z",
- "question": {
- "id": "string",
- "providerId": "string",
- "threadTitle": "string",
- "threadUrl": "string",
- "question": "string",
- "answer": "string",
- "delivered": true,
- "cancelReason": "string"
}, - "message": {
- "providerId": "string",
- "template": "string",
- "body": "string",
- "content": "string",
- "delivered": true,
- "sender": "string",
- "recipient": "string",
- "attachment": {
- "type": "string",
- "url": "string"
}, - "via": "whatsApp"
}, - "rejectionReason": "string",
- "proposal": {
- "firstCreatedAt": "2019-08-24T14:15:22Z",
- "items": [
- {
- "price": "string",
- "concept": "string"
}
], - "status": "string"
}, - "status": "string",
- "visitSuccessful": true,
- "callSuccessful": true,
- "webAction": "string",
- "transferedTo": {
- "id": "507f191e810c19729de860ea",
- "firstName": "string",
- "lastName": "string",
- "email": "string",
- "phone": "string",
- "legacyId": "string",
- "externalId": { }
}, - "transferedToAgentId": "507f191e810c19729de860ea",
- "transferedToGroupId": "507f191e810c19729de860ea",
- "response": "string",
- "conversations": [
- {
- "_id": "507f191e810c19729de860ea",
- "channel": "string",
- "providerName": "string",
- "threadTitle": "string",
- "threadSubtitle": "string",
- "threadThumbnail": "string"
}
], - "customEvent": { }
}
}
}Interactions can have Type: “created” or Type: “updated”.
Events related to agents (requires act-as-user scope).
When you subscribe to this topic, your webhook will receive a request with the following schema:
| subscriptionId | string (Subscription Id) |
| topic | string |
| type | string (Notification type) Enum: "updated" "created" |
| received | string <date-time> (Notification time) |
| sent | string <date-time> (Notification time) |
| attempts | number |
Array of objects (Prospect Information) | |
| updatedAt | string <date-time> (Date and time of the update) |
| operationId | string |
{- "subscriptionId": "string",
- "topic": "agents",
- "type": "updated",
- "received": "2019-08-24T14:15:22Z",
- "sent": "2019-08-24T14:15:22Z",
- "attempts": 0,
- "prospect": [
- {
- "id": "string",
- "created": "2019-08-24T14:15:22Z",
- "group": "string",
- "groupId": "string",
- "account": "string",
- "accountId": "string",
- "initialGroup": "string",
- "initialGroupId": "string",
- "firstName": "string",
- "lastName": "string",
- "category": "string",
- "userMade": true,
- "status": "string",
- "additionalData": { },
- "phones": [
- "+54 9 11 4552 0371"
], - "contactMediums": [
- { }
], - "leads": [
- {
- "created": "string",
- "createdBy": "string",
- "source": "string",
- "utmSource": "string",
- "providerKey": "string",
- "comments": "string",
- "type": "string"
}
], - "agent": [
- {
- "id": "string",
- "firstName": "string",
- "lastName": "string",
- "phone": "string",
- "email": "string"
}
], - "assigned": "2019-08-24T14:15:22Z",
- "firstContactedAt": "2019-08-24T14:15:22Z"
}
], - "updatedAt": "2019-08-24T14:15:22Z",
- "operationId": "string"
}| Notification | Payload change |
|---|---|
| Prospect created from the agent that is acting on behalf of. | "type": "created" |
| Prospect transfer to the agent that is acting on behalf of. | "type": "updated" "updates": |
Returns the list of active subscriptions. Note that subscriptions are currently limited to one per group.
[- {
- "id": "507f191e810c19729de860ea",
- "topics": [
- "string"
], - "callbackUrl": "string"
}
]Subscribe to notification topics. Note that subscriptions are currently limited to one per group, and subscribing twice will result in the first subscription being deactivated.
| topics required | Array of strings An array of topic names to subscribe to. Use the Notification Topics endpoint to see the available topics. |
| callbackUrl required | string |
{- "topics": [
- "string"
], - "callbackUrl": "string"
}{- "id": "507f191e810c19729de860ea",
- "topics": [
- "string"
], - "callbackUrl": "string"
}Returns an active notification subscription by its ID.
| subscriptionId required | string^[a-z0-9]{24}$ The ID of the subscription. |
{- "id": "507f191e810c19729de860ea",
- "topics": [
- "string"
], - "callbackUrl": "string"
}Deactivates a subscription by its ID.
| subscriptionId required | string^[a-z0-9]{24}$ The ID of the subscription. |
{- "id": "507f191e810c19729de860ea",
- "topics": [
- "string"
], - "callbackUrl": "string"
}Apps should handle the following lifecycle webhooks from Sales. All requests that originate from Sales will include the corresponding Client ID and Secret, and Apps should reject requests with missing or invalid credentials. All requests from Sales include the API Key of the App instance as context.
Sales will call this endpoint whenever a new App instance is installed. This request will include essential information for the App instance like its API Key and initial state.
The App should store the API Key as it will be needed for future calls to the Sales API. See Authentication.
| appId | string |
| appSecret | string |
object |
{- "appId": "APP_ID",
- "appSecret": "APP_SECRET'",
- "integration": {
- "apiKey": "string",
- "enabled": true
}
}Apps can design a settings form layout by returning a JSON object with the following schema:
| title | string A title for the form. |
| description | string A description for the form. CommonMark syntax MAY be used for rich text representation. |
| hint | string A relevant note that the third-party want to communicate to the user. CommonMark syntax MAY be used for rich text representation. |
| warning | string An warning that the third-party want to communicate to the user, but that does not prevent submit the form data. CommonMark syntax MAY be used for rich text representation. |
| error | string An error that prevents sending the form. CommonMark syntax MAY be used for rich text representation. |
required | Array of objects A list of sections for the form |
Array of objects A list of validation that allow to the third-party to modify the form based on data completed by the user |
{- "title": "string",
- "description": "string",
- "hint": "string",
- "warning": "string",
- "error": "string",
- "sections": [
- {
- "name": "string",
- "title": "string",
- "description": "string",
- "hint": "string",
- "warning": "string",
- "error": "string",
- "hidden": true,
- "hiddenWhere": { },
- "disabled": true,
- "disabledWhere": { },
- "inputs": [
- {
- "name": "string",
- "type": "text",
- "label": "string",
- "hint": "string",
- "warning": "string",
- "error": "string",
- "hidden": true,
- "hiddenWhere": { },
- "disabled": true,
- "disabledWhere": { },
- "customProps": { }
}
]
}
], - "validations": [
- {
- "where": { },
- "changes": [
- {
- "name": "string",
- "hint": "string",
- "warning": "string",
- "error": "string",
- "customProps": { }
}
]
}
]
}When the user saves changes to the App settings, Sales will use the names of the inputs as keys and send them to the PUT settings App Lifecycle endpoint.
Sales will request the App for a settings object from time to time. Apps can store any relevant settings needed for the App instance.
The keys in the settings object should match with the form inputs names, so they can be edited in the App settings screen by the user.
App response example
{
"automaticReplyEnabled": true
}
Whenever a user changes the App settings, Sales will send the updated settings object to this endpoint. It is recommended to make a merge with the updated settings since Sales will just send the new ones and not the entire set.
Request payload example
{
"automaticReplyEnabled": false
}
Whenever a user disables or enables the App, Sales will notify the App backend of this. Use this to pause or resume the execution of your App instance if applicable.
Any call made to the API by a disabled App will return an error.
| enabled | boolean |
{- "enabled": true
}Sales may refresh the App's API Keys at any time, and send the new API Key using this endpoint. Avoid using API Keys that have been refreshed.
| newApiKey | string |
{- "newApiKey": "abc123"
}Whenever a user deletes the App, Sales will notify the App backend of this and will 'soft' delete it (logical delete)
Response example
{
"success": true
}
App developers can leverage the following Extension Points, allowing them to go beyond what is possible to achieve as a Sales user or through the API.
Apps may add custom reports to the Reports section for managers to use. Users can interact with the App directly through these embedded reports.
Report definition schema:
| key | string Unique identifier for the report. |
| name | string Report name and title. Must be localizable. |
| url | string <uri> Report URL. May contain placeholders. |
{- "key": "string",
- "name": "string",
}Sales will add the following query parameters automatically:
| Query Parameter | Description | Example |
|---|---|---|
range |
Date range of the Report. Can be last-month, this-month, yesterday, today, last30, last7 or custom |
custom |
start |
Report starting date in YYYY-MM-DD format (only applies for range=custom) |
2020-12-01 |
end |
Report ending date in YYYY-MM-DD format (only applies for range=custom) |
2020-12-31 |
group |
ID of the group selected for the report | 507f191e810c19729de860ee |
parentGroup |
ID of the group of the user viewing the report | 507f191e810c19729de860ef |
signature |
See Request signature below | a08116905e92633e4f30eefd1276206b259305c8783642fc5b7f51c089187939 |
The report URL may contain placeholders as follows:
https://app.example.com/prospect/${prospect._id}?lang=${group.language}
Supported placeholders:
| Placeholder | Description | Example |
|---|---|---|
user._id |
ID of the user viewing the report | 507f191e810c19729de860ea |
user.firstName |
First name of the user | Jorge |
user.lastName |
Last name of the user | Letona |
user.cellPhone |
Cell Phone number of the user | +15417543010 |
user.phone |
Phone number of the user | +15417543010 |
user.email |
Email of the user | [email protected] |
group._id |
ID of the group of the user viewing the report | 507f191e810c19729de860ec |
group.name |
Name of the group | Sales |
group.language |
Language of the group in ISO 639-1 format | en |
group.displayName |
Display name of the group | Sales |
Apps may add custom buttons to the conversation toolbar for agents to use. Once clicked, these buttons open embedded dialogs where the agent can interact with the App directly.
Button definition schema:
| key | string Unique identifier for the button. |
| name | string Button name and label. Localizable. |
| url | string <uri> Embedded dialog URL. May contain placeholders. |
| icon | string <data-uri> Icon in Data URI format. A 64x64 px PNG image is recommended. |
{- "key": "string",
- "name": "string",
- "icon": "string"
}Sales will add the following query parameters automatically:
| Query Parameter | Description | Example |
|---|---|---|
signature |
See Request signature below | a08116905e92633e4f30eefd1276206b259305c8783642fc5b7f51c089187939 |
The URL can contain placeholders as follows:
https://app.example.com/prospect/${prospect._id}?lang=${group.language}
Supported placeholders:
| Placeholder | Description | Example |
|---|---|---|
prospect._id |
ID of the contact whose conversation the button is clicked on | 507f191e810c19729de860ea |
prospect.firstName |
First name of the contact | John |
prospect.lastName |
Last name of the contact | Smith |
prospect.phones |
Phone numbers of the contact. Numbers must be comma separated. | +15417543010 |
prospect.emails |
Emails of the contact. Numbers must be comma separated. | +15417543010 |
user._id |
ID of the user viewing the report | 507f191e810c19729de860ea |
user.firstName |
First name of the user | Jorge |
user.lastName |
Last name of the user | Letona |
user.cellPhone |
Cell Phone number of the user | 15417543010 |
user.phone |
Phone number of the user | 15417543010 |
user.email |
Email of the user | [email protected] |
group._id |
ID of the group | 507f191e810c19729de860ea |
group.name |
Name of the group | Sales |
group.language |
Language of the group in ISO 639-1 format | en |
group.displayName |
Display name of the group | Sales |
prospect.source |
Source of the contact | Whatsapp |
prospect.providerLeadId |
External id of the contact | ABC-123-xyz |
In order to avoid the forging of requests, Sales adds a signature parameter. To verify it follow these steps:
signature query parameter. Make a copy of the request URL WITHOUT the signature.const hmac = crypto.createHmac('sha256', PRIVATE_KEY)
hmac.update(URL)
const EXPECTED_SIGNATURE = hmac.digest('hex')
signature with EXPECTED_SIGNATURE and reject the request if they don't match.An array of fields to add to the prospect and user entities, respectively. Each field definition contains the following elements:
An array of fields to add to the prospect and user entities, respectively. Each field definition contains the following elements:
All localizable strings need an English variant that will be used by default and may define additional variants for other languages or locales.
They should be objects with the following schema:
fieldName: {
en: 'Text in English', // mandatory
es: 'Text in Spanish',
pt: 'Text in Portuguese'
}