Download OpenAPI specification:Download
API for interacting with the Fromni platform. Mainly designed to run:
At its core, the Campaign is a regular chatbot. The only difference is that you write to the User, and he responds to you. Therefore, for the launch of any Campaign, the Script is important (which messages to send, which responses can come, etc.), Channels (through which channels messages are transmitted), Launch conditions (what must happen for the campaign to start). For the convenience of working with the platform, all Scenarios, Channels and Launch Conditions are implemented through the WEB interface. The API also transmits Events that should launch the Campaign, or direct commands to launch the Campaign.
Each method is a POST request, which, if successful, returns code 200, and in case of an API error, code 500.
Connection point: https://api.fromni.com/user
Data format: JSON
Encoding: UTF-8
Authorization: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Content-Type: application/json
Events allow you to launch Campaigns automatically. Events can be created using an API request or via a WEB interface.
Each event that is created has a calculated tag parameter. All events that you create yourself have a "custom" tag.
When transmitting an event to the system, an attempt will be made to find the Campaign associated with it. If there is one, it will be launched, and its id will be returned in response. It is important that the recipient's phone number is also transmitted in the Event data, and the path to it is defined in the Campaign variables.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
name required | string Name of event |
data | object Any object containing event data |
{- "name": "added_to_cart",
- "data": {
- "client": {
- "phone": 79990000000
}, - "category": "Cars",
- "productId": 12345
}
}
{- "result": "success",
- "id": "2c78e241008fedf822288be5"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
{- "result": "success",
- "data": [
- {
- "id": 1,
- "name": "my_event",
- "displayName": "My test event",
- "tag": "custom",
- "vars": [
- {
- "name": "Phone number",
- "path": "client.phone",
- "type": "string"
}
]
}
]
}
Campaigns are outgoing communications according to a certain scenario. The scenario must be pre-created in the scenario designer in the WEB interface. There, in particular, the logic of the Campaign is "drawn" and the channels through which messages are sent are connected.
Launch a campaign (by template and script)
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
name required | string Campaign name |
liveTime | number [ 1 .. 48 ] Default: 24 The time (in hours) during which the recipient can respond to the campaign |
scenarioId | string, ID of the campaign script that will be launched after the user receives the first message |
required | Array of objects (CampaignChannels) A list of channels through which the message will be sent before the first delivery. The order of the channels in the array sets the order of sending. |
templateId required | number The template ID of the first message. If the specified script is associated with a template in the script designer, then this parameter is optional |
data required | Array of objects (CampaignRecipientData) An array of objects with data for each recipient. The object can contain any number of fields, but must have the same structure for each recipient |
match | Array of strings An array of matches of campaign variables and template fields. The header corresponding to the field in which the recipient's phone number is specified must be the first. |
{- "name": "My campaign",
- "liveTime": 24,
- "scenarioId": "5eb882228fdef800142e87c2",
- "channels": [
- {
- "name": "notify+vk",
- "connections": [
- 1,
- 2
], - "ttl": 60
}
], - "templateId": 1,
- "data": [
- {
- "Client name": "Ivan Petrov",
- "Phone number": "+79990000000",
- "Invoice number": 123456,
- "age": 22
}
], - "match": [
- "Phone number",
- "Client name",
- "Invoice number"
]
}
{- "result": "success",
- "id": "2c78e241008fedf822288be5"
}
{- "type": "campaign_completed",
- "data": {
- "id": "2c78e241008fedf822288be5",
- "name": "My campaign",
- "liveTime": 48,
- "channels": [
- {
- "name": "notify+vk",
- "connections": [
- 1,
- 2
], - "ttl": 60
}
], - "scenarioId": "5eb882228fdef800142e87c2",
- "templateId": 1,
- "docs": [
- {
- "data": {
- "Client Name": "Ivan Petrov",
- "Phone number": "+79990000000",
- "Invoice number": 123456,
- "age": 22
}, - "channel": "notify",
- "status": "delivered",
- "channelindex": 0,
- "answersMap": {
- "Answer 1": "10",
- "Last answer": "Yes"
}, - "answersList": [
- "10",
- "Yes"
]
}
], - "match": [
- "Phone Number, Customer Name, Invoice Number"
], - "headers": [
- "Customer Name, phone, Invoice Number, Answer 1, Last Answer"
], - "createdAt": "2020-10-20T00:00:00.436Z"
}
}
Returns a list of Campaigns that were launched during the specified period. The method can be useful for estimating the number of campaigns sent in a certain period and getting detailed statistics for a specific Campaign.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
startDate | string Beginning of the period |
endDate | string End of the period |
type | string or null Enum: "event" "manual" Campaign type ("event" - campaigns by event, "manual" - campaigns launched directly) |
{- "startDate": "2021-01-21T00:00:00:000Z",
- "endDate": "2021-02-21T00:00:00:000Z\"",
- "type": "event"
}
{- "result": "success",
- "data": [
- {
- "id": "2c78e241008fedf822288be5",
- "name": "Test campaign",
- "recipientsCount": 10,
- "createdAt": "2020-10-20T00:00:00.436Z"
}
]
}
Unlike returning statistics to the Callback server, this method allows you to get the current statistics for the campaign yourself, even if it is not completed. Returns all parameters of the launched campaign, as well as the modified list of recipients in the docs field.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
id required | string Campaign ID |
{- "id": "2c78e241008fedf822288be5"
}
{- "result": "success",
- "id": "2c78e241008fedf822288be5",
- "name": "My campaign",
- "liveTime": 48,
- "channels": [
- {
- "name": "notify+vk",
- "connections": [
- 1,
- 2
], - "ttl": 60
}
], - "scenarioId": "5eb882228fdef800142e87c2",
- "templateId": 1,
- "docs": [
- {
- "data": {
- "Client Name": "Ivan Petrov",
- "Phone number": "+79990000000",
- "Invoice number": 123456,
- "age": 22
}, - "channel": "notify",
- "status": "delivered",
- "channelindex": 0,
- "answersMap": {
- "Answer 1": "10",
- "Last answer": "Yes"
}, - "answersList": [
- "10",
- "Yes"
]
}
], - "match": [
- "Phone Number, Customer Name, Invoice Number"
], - "headers": [
- "Customer Name, phone, Invoice Number, Answer 1, Last Answer"
], - "createdAt": "2020-10-20T00:00:00.436Z"
}
Notifications - the ability to send users a one-way message using most of the available channels. As part of this solution, you send a specific message. The task of the platform is to deliver this message. At the same time, if a template is found for a message in your account, the message will automatically leave by those channels for which the found template was registered/approved. This is how message delivery can be organized, for example, through the WhatsApp Business API. If the templates are not detected, the message is automatically forwarded via SMS (it is necessary that this channel is connected in the account).
If the channels parameter is not specified, the notification will be sent in accordance with the specified account settings.
Sending is possible by phone number or by contact ID. In any case, an attempt will first be made to find the user's digital profile in Fromni. Then, according to the available identifiers in various messengers, an attempt will be made to deliver the notification to the specified channels (before the 1st successful dispatch).
Some channels allow you to attach attachments (for example, only 1 image is available in Instagram and Viber business messages; Notify and SMS cannot contain attachments).
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
phone | string Recipient's number. If no contact Id is specified, this field is required. |
contactId | string Contact ID in CRM. If phone is not specified, then the field is required. |
required | object (CampaignMessage) Message being sent via channel(s) |
required | Array of objects (CampaignChannels) A list of channels through which the message will be sent before the first delivery. The order of the channels in the array sets the order of sending. |
{- "phone": 79000000000,
- "contactId": "5f3cd834e8aadd00137359aa",
- "message": {
- "text": "Message text",
- "attachments": [
],
}, - "channels": [
- {
- "name": "notify+vk",
- "connections": [
- 1,
- 2
], - "ttl": 60
}
]
}
{- "result": "success",
- "id": "6062fdc861914f0013e793a2"
}
{- "type": "notification_message_updated",
- "data": {
- "id": "6062fdc861914f0013e793a2",
- "status": "error",
- "channel": "whatsapp-business",
- "statusDetails": {
- "desc": "Unable to send to any channel because contact doesn't have destination params for specified channels"
}
}
}
Media storage allows you to upload files to get a direct link to them, which can be specified for attachment when sending a message. Attachments from users' incoming messages are also stored in the storage.
The file size is currently limited to 10 MB.
To upload a file to the storage, you first need to get the server parameters to upload. The response contains the url field to which you need to send a POST request with a body in the FromData format, the link is valid for 1 hour. For each new uploaded element, you need to get new parameters.
The response also contains a fields object, each key of which must be passed in its original form together with the request as a key-value pair in FormData. The file itself is transmitted by the file key and must be specified most recently. The response returns the mediaUrl field containing a direct link to the future uploaded file, use it to insert it into the message.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
contentType | string File type, it is advisable to specify it in order to avoid errors |
filename required | string The file name must have the extension |
{- "contentType": "application/pdf",
- "filename": "contract.pdf"
}
{- "result": "success",
- "fields": {
- "Key": "prefix/image.png",
- "ACL": "public-read",
- "bucket": "fromni-storage",
- "X-Amz-Algorithm": "AWS4-HMAC-SHA256",
- "X-Amz-Credential": "Credential",
- "X-Amz-Date": "20210719T075156Z",
- "Policy": "policyStringExample",
- "X-Amz-Signature": "signatureStringExample"
},
}
The section describes the methods of direct communication with live operators. The mechanism is triggered at the moment when a type of incoming message is received from the User, which according to the Scenario should be processed by a specialist on the Customer's side and through the Customer's information system. Information about the incoming message will be sent to the Callback server (request type - A new dialog with the operator in the Messenger has been initiated). Next, you can request the dialog message history using the Dialog Messages method.
The data object contains basic information about the dialog.
The contact field contains known contact identifiers in various messengers (phone, vkId, instagramId, etc.). The connection field contains information about the connection within which the dialogue was initiated, including the channel identifier (vk, whatsapp-business, fb, viber, etc.)
name required | string |
required | object (Conversation) |
{- "name": "conversation_operator_requested",
- "data": {
- "id": "5f3cd834e8aadd00137359aa",
- "operatorMode": {
- "isActive": true,
- "expiresAt": "2020-08-19T09:44:02.942Z"
}, - "connection": {
- "id": 1,
- "channel": "whatsapp",
- "integrationId": 1,
- "provider": "Fromni",
- "createdAt": "2019-08-19T09:44:02.942Z"
}, - "contact": {
- "id": "5f3cd6d49ed4e10013083db0",
- "phone": "+79997775533",
- "vkId": 123456,
- "vk": {
- "first_name": "Ivan",
- "id": 123456,
- "last_name": "Petrov",
- "can_access_closed": true,
- "is_closed": false,
- "sex": 2,
- "bdate": "1.1.2001",
- "city": {
- "id": 2,
- "title": "Saint Petersburg"
}, - "country": {
- "id": 1,
- "title": "Russia"
}, - "home_town": "Saint Petersburg"
}, - "createdAt": "2021-04-09T09:55:09.782Z",
- "updatedAt": "2021-04-09T09:55:09.782Z"
}, - "scenario": {
- "id": "5f3515b16300bd0013c948c5"
}, - "startedAt": "2020-08-19T07:43:48.417Z",
- "startTrigger": "campaign",
- "endedAt": "2020-08-19T07:43:48.417Z",
- "endReason": "completed"
}
}
name required | string |
required | object |
{- "name": "conversation_message_created",
- "data": {
- "conversationId": "5f3cd834e8aadd00137359aa",
- "message": {
- "text": "Message text",
- "attachments": [
]
}
}
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
offset | number Default: 0 Indent from the beginning of the list |
limit | number Default: 10 Maximum number of entries in the answer. Do not specify this parameter if you need to return all records. |
{- "offset": 0,
- "limit": 10
}
{- "result": "success",
- "data": [
- {
- "id": "5f3cd834e8aadd00137359aa",
- "operatorMode": {
- "isActive": true,
- "expiresAt": "2020-08-19T09:44:02.942Z"
}, - "connection": {
- "id": 1,
- "channel": "whatsapp",
- "integrationId": 1,
- "provider": "Fromni",
- "createdAt": "2019-08-19T09:44:02.942Z"
}, - "contact": {
- "id": "5f3cd6d49ed4e10013083db0",
- "phone": "+79997775533",
- "vkId": 123456,
- "vk": {
- "first_name": "Ivan",
- "id": 123456,
- "last_name": "Petrov",
- "can_access_closed": true,
- "is_closed": false,
- "sex": 2,
- "bdate": "1.1.2001",
- "city": {
- "id": 2,
- "title": "Saint Petersburg"
}, - "country": {
- "id": 1,
- "title": "Russia"
}, - "home_town": "Saint Petersburg"
}, - "createdAt": "2021-04-09T09:55:09.782Z",
- "updatedAt": "2021-04-09T09:55:09.782Z"
}, - "scenario": {
- "id": "5f3515b16300bd0013c948c5"
}, - "startedAt": "2020-08-19T07:43:48.417Z",
- "startTrigger": "campaign",
- "endedAt": "2020-08-19T07:43:48.417Z",
- "endReason": "completed"
}
]
}
The method can be useful to load the User's communication history with the Bot after the operator is connected to the dialog.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
conversationId | string Dialog ID |
{- "conversationId": "5f3cd834e8aadd00137359aa"
}
{- "result": "success",
- "data": [
- {
- "id": 1,
- "connectionId": 1,
- "date": "2021-04-09T08:19:26.982Z",
- "out": true,
- "status": "read",
- "text": "Message text"
}
]
}
The operator can send a message to the dialog only if the dialog's operatorMode has not expired.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
conversationId | string Dialog ID |
object |
{- "conversationId": "5f3cd834e8aadd00137359aa",
- "message": {
- "text": "Message text",
- "attachments": [
]
}
}
{- "result": "success",
- "messageId": 2,
- "status": "sent",
- "conversationId": "5f3cd834e8aadd00137359aa"
}
{- "name": "conversation_message_updated",
- "data": {
- "conversationId": "5f3cd834e8aadd00137359aa",
- "messageId": 2,
- "status": "read"
}
}
Contacts - all users with whom interaction has ever been conducted. A digital profile is created for each of them in Fromny, which includes their identifiers in various messengers, public data from messengers, as well as variable values.
Correspondence of the channel and the field name with the identifier in the digital profile:
Channel | Field with ID |
---|---|
VKontakte | vkId |
instagramId | |
Telegram | telegramId |
Viber - chatbots | viberId |
fbId | |
Whatsapp Business | phone |
Whatsapp WEB | phone |
Viber - business messages | phone |
SMS | phone |
Notify | phone |
Web chat | id |
In addition, for some channels, additional information about the user may be available, which is stored as a source object and is available by the key corresponding to the channel designation (see List of Channels)
The data field contains objects with contact IDs in various messengers (phone, vk Id, instagram Id, etc.) and its ID in Fromni. Even if one contact was created, it will still be sent in the array.
type | string |
required | Array of objects (ConversationContact) |
{- "type": "contact_created",
- "data": [
- {
- "id": "5f3cd6d49ed4e10013083db0",
- "phone": "+79997775533",
- "vkId": 123456,
- "vk": {
- "first_name": "Ivan",
- "id": 123456,
- "last_name": "Petrov",
- "can_access_closed": true,
- "is_closed": false,
- "sex": 2,
- "bdate": "1.1.2001",
- "city": {
- "id": 2,
- "title": "Saint Petersburg"
}, - "country": {
- "id": 1,
- "title": "Russia"
}, - "home_town": "Saint Petersburg"
}, - "createdAt": "2021-04-09T09:55:09.782Z",
- "updatedAt": "2021-04-09T09:55:09.782Z"
}
]
}
The data object contains all the contact fields, not just the updated ones.
type | string |
required | object (ConversationContact) Contact |
{- "type": "contact_updated",
- "data": {
- "id": "5f3cd6d49ed4e10013083db0",
- "phone": "+79997775533",
- "vkId": 123456,
- "vk": {
- "first_name": "Ivan",
- "id": 123456,
- "last_name": "Petrov",
- "can_access_closed": true,
- "is_closed": false,
- "sex": 2,
- "bdate": "1.1.2001",
- "city": {
- "id": 2,
- "title": "Saint Petersburg"
}, - "country": {
- "id": 1,
- "title": "Russia"
}, - "home_town": "Saint Petersburg"
}, - "createdAt": "2021-04-09T09:55:09.782Z",
- "updatedAt": "2021-04-09T09:55:09.782Z"
}
}
The contacts are merged, because the IDs in one of the channels matched. The reserved Contact field contains the contact saved after the merge, the deleted Contacts field contains the deleted contact.
type | string |
required | object |
{- "type": "contact_merged",
- "data": {
- "preservedContact": {
- "id": "5f3cd6d49ed4e10013083db0",
- "phone": "+79997775533",
- "vkId": 123456,
- "vk": {
- "first_name": "Ivan",
- "id": 123456,
- "last_name": "Petrov",
- "can_access_closed": true,
- "is_closed": false,
- "sex": 2,
- "bdate": "1.1.2001",
- "city": {
- "id": 2,
- "title": "Saint Petersburg"
}, - "country": {
- "id": 1,
- "title": "Russia"
}, - "home_town": "Saint Petersburg"
}, - "createdAt": "2021-04-09T09:55:09.782Z",
- "updatedAt": "2021-04-09T09:55:09.782Z"
}, - "deletedContact": {
- "id": "5f3cd6d49ed4e10013083db0",
- "phone": "+79997775533",
- "vkId": 123456,
- "vk": {
- "first_name": "Ivan",
- "id": 123456,
- "last_name": "Petrov",
- "can_access_closed": true,
- "is_closed": false,
- "sex": 2,
- "bdate": "1.1.2001",
- "city": {
- "id": 2,
- "title": "Saint Petersburg"
}, - "country": {
- "id": 1,
- "title": "Russia"
}, - "home_town": "Saint Petersburg"
}, - "createdAt": "2021-04-09T09:55:09.782Z",
- "updatedAt": "2021-04-09T09:55:09.782Z"
}
}
}
The following comparison operators (op) are used to filter contacts by variables:
Operator | Description | Type of variable |
---|---|---|
eq | Equal | All |
neq | Not equal | All |
contains | Contains | String |
ncontains | Does not contain | String |
exists | Not empty | All |
nexists | Empty | All |
lt | Less then | Number |
gt | Greater then | Number |
lte | Less than or equal | Number |
gte | Greater than or equal | Number |
before | Before | Date |
after | After | Date |
has | Contains | Array |
nhas | Does not contain | Array |
Filter conditions can be combined using the union parameter:
Operator | Description |
---|---|
and | The contact meets all the conditions |
or | The contact meets any condition |
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
object (ContactsFilter) | |
offset | number Default: 0 Indent from the beginning of the list |
limit | number Default: 10 Maximum number of entries in the answer. Do not specify this parameter if you need to return all records. |
order | Array of strings[ items ] Sorting parameters. Each element is an array in which the 1st element is the name of the field that is being sorted, and the 2nd element is the sorting order (ASC or DESC) |
{- "filter": {
- "union": "or",
- "conditions": [
- {
- "union": "and",
- "conditions": [
- {
- "field": "d00137359aa5f3cd834e8aad",
- "op": "gt",
- "value": 10
}, - {
- "field": "d00137359aa5f3cd834e8aad",
- "op": "lt",
- "value": 20
}
]
}, - {
- "union": null,
- "conditions": [
- {
- "field": "channels",
- "op": "has",
- "value": "vk"
}
]
}
]
}, - "offset": 0,
- "limit": 10,
- "order": [
- [
- "createdAt",
- "DESC"
]
]
}
{- "result": "success",
- "data": [
- {
- "id": "5f3cd6d49ed4e10013083db0",
- "phone": "+79997775533",
- "vkId": 123456,
- "vk": {
- "first_name": "Ivan",
- "id": 123456,
- "last_name": "Petrov",
- "can_access_closed": true,
- "is_closed": false,
- "sex": 2,
- "bdate": "1.1.2001",
- "city": {
- "id": 2,
- "title": "Saint Petersburg"
}, - "country": {
- "id": 1,
- "title": "Russia"
}, - "home_town": "Saint Petersburg"
}, - "createdAt": "2021-04-09T09:55:09.782Z",
- "updatedAt": "2021-04-09T09:55:09.782Z",
- "variables": [
- {
- "id": "60b7f9b6163fec0007ecdaf0",
- "name": "City",
- "validateAs": "STRING",
- "value": "Moscow"
}
]
}
], - "total": 100
}
Returns known contact IDs in various messengers (phone, vkId, instagramId, etc.), as well as the values of its variables.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
id required | string Contact ID |
{- "id": "608044bd4eeb3c0013c2e21e"
}
{- "result": "success",
- "id": "5f3cd6d49ed4e10013083db0",
- "phone": "+79997775533",
- "vkId": 123456,
- "vk": {
- "first_name": "Ivan",
- "id": 123456,
- "last_name": "Petrov",
- "can_access_closed": true,
- "is_closed": false,
- "sex": 2,
- "bdate": "1.1.2001",
- "city": {
- "id": 2,
- "title": "Saint Petersburg"
}, - "country": {
- "id": 1,
- "title": "Russia"
}, - "home_town": "Saint Petersburg"
}, - "createdAt": "2021-04-09T09:55:09.782Z",
- "updatedAt": "2021-04-09T09:55:09.782Z",
- "variables": [
- {
- "id": "60b7f9b6163fec0007ecdaf0",
- "name": "City",
- "validateAs": "STRING",
- "value": "Moscow"
}
]
}
Creates contacts in CRM with the specified phone number and variables
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
phone required | string The phone number of the contact being created |
Array of objects List of variables. You can specify both the variable name and the ID (see Set Contact variables) |
[- {
- "phone": 79990000000,
- "variables": [
- {
- "name": "City",
- "value": "Moscow"
}
]
}
]
{- "result": "success",
- "data": [
- {
- "id": "5f3cd6d49ed4e10013083db0",
- "phone": "+79997775533",
- "vkId": 123456,
- "vk": {
- "first_name": "Ivan",
- "id": 123456,
- "last_name": "Petrov",
- "can_access_closed": true,
- "is_closed": false,
- "sex": 2,
- "bdate": "1.1.2001",
- "city": {
- "id": 2,
- "title": "Saint Petersburg"
}, - "country": {
- "id": 1,
- "title": "Russia"
}, - "home_town": "Saint Petersburg"
}, - "createdAt": "2021-04-09T09:55:09.782Z",
- "updatedAt": "2021-04-09T09:55:09.782Z",
- "variables": [
- {
- "id": "60b7f9b6163fec0007ecdaf0",
- "name": "City",
- "validateAs": "STRING",
- "value": "Moscow"
}
]
}
]
}
Update the ID in one of the channels (only "phone", "vk ID", "viber ID", "fbId", "telegramId", "instagramId" can be changed).
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
contactId | string Contact ID |
field_to_update | string or number Instead of fields_to_update, use the field designation with the ID from table |
{- "contactId": "6062fdc861914f0013e793a2",
- "field_to_update": 79990000000
}
{- "result": "success"
}
By default, the following variables are available to you: First Name (string), Last Name (string), Birthday (date), City (string), Country (string), Gender (string). The values of these profile variables are filled in with data from social networks (for example, VKontakte and Facebook), but you can change these values.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
null
{- "result": "success",
- "data": [
- {
- "id": "60b7f9b6163fec0007ecdaf0",
- "name": "City",
- "validateAs": "STRING"
}
]
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
name required | string Variable name |
validateAs | string Default: "STRING" Enum: "STRING" "NUMBER" "DATE" |
{- "name": "City",
- "validateAs": "STRING"
}
{- "result": "success",
- "id": "60b7f9b6163fec0007ecdaf0"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
id required | string Variable ID |
{- "id": "60b7f9b6163fec0007ecdaf0"
}
{- "result": "success"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
contactId required | string Contact ID |
required | Array of objects List of variables |
{- "contactId": "608044bd4eeb3c0013c2e21e",
- "variables": [
- {
- "name": "City",
- "value": "Moscow"
}
]
}
{- "result": "success"
}
In the WEB interface, the API Settings section, you can specify a callback server to which Fromni will send statistics and statuses for your Campaigns and Notifications.
If the attempt to send the notification failed (response code < 200 or >= 400 or the response was not received within the allotted timeout), then several more attempts will be made to send. Number of attempts = 7. The interval between attempts increases as follows: 10 sec, 30 sec, 1.5 min, 4.5 min, 13.5 min, 40.5 min and 1 hour.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
callbackUrl required | string Callback-server URL |
secret | string An arbitrary string that is transmitted with each request to the callback server in a separate secret field. Allows you to make sure that the notification came from our server. |
{- "secret": "some_secret_string"
}
{- "result": "success"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
null
{- "result": "success",
- "secret": "some_secret_string"
}
Channels and their designations in Fromni:
Channel | Designation |
---|---|
VKontakte | vk |
Telegram | telegram |
Viber - chatbots | viber-bots |
fb | |
Whatsapp Business | whatsapp-business |
Whatsapp WEB | |
Viber - business messages | viber |
SMS | sms |
Notify | notify |
Web chat | webchat |
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
null
{- "result": "success",
- "data": {
- "vk": [
- {
- "id": 1,
- "name": " My connection to VK"
}
], - "whatsapp-business": [
- {
- "id": 2,
- "name": "Connection to WABA"
}
]
}
}
Text templates are necessary so that the company can write first in channels where arbitrary texts are not allowed.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
offset | number Default: 0 Indent from the beginning of the list |
limit | number Default: 10 Maximum number of entries in the answer. Do not specify this parameter if you need to return all records. |
order | Array of strings[ items ] Sorting parameters. Each element is an array in which the 1st element is the name of the field that is being sorted, and the 2nd element is the sorting order (ASC or DESC) |
{- "offset": 0,
- "limit": 10,
- "order": [
- [
- "createdAt",
- "DESC"
]
]
}
{- "result": "success",
- "data": [
- {
- "id": 1,
- "displayName": "Test template",
- "text": " Test template from the company #COMPANY_NAME#.",
- "regexpText": "^ Test template from the company (.+).$",
- "name": "before_visit_10_min",
- "channels": [
- {
- "id": 1,
- "channel": "whatsapp",
- "status": "approved",
- "updated_at": "2022-03-09T00:00:00.000Z",
- "components": null,
- "keyboard": {
- "inline": true
}, - "attachments": [
], - "sender": null
}
], - "templateGroupId": 1,
- "groupName": "A group of templates for an example",
- "group": [
- {
- "id": 1,
- "displayName": "Test template",
- "text": " Test template from the company #COMPANY_NAME#.",
- "regexpText": "^ Test template from the company (.+).$",
- "name": "added_to_cart",
- "channels": [
- {
- "id": 1,
- "channel": "whatsapp",
- "status": "approved",
- "updated_at": "2022-03-09T00:00:00.000Z",
- "components": null,
- "keyboard": {
- "buttons": [
- {
- "type": null,
- "text": null,
- "link": null
}
], - "inline": true
}, - "attachments": [
], - "sender": null
}
]
}
]
}
]
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
displayName | string Template name |
text required | string Message text |
name | String Event name |
Array of objects Array of channels through which you plan to send this template |
{- "displayName": "Test template",
- "text": "Hi! This is a sample message",
- "name": "before_visit_10_min",
- "channels": [
- {
- "channel": "whatsapp",
- "keyboard": {
- "inline": true
}, - "attachments": [
]
}
]
}
{- "result": "success",
- "id": 1,
- "displayName": "Test template",
- "text": " Test template from the company #COMPANY_NAME#.",
- "regexpText": "^ Test template from the company (.+).$",
- "name": "before_visit_10_min",
- "channels": [
- {
- "id": 1,
- "channel": "whatsapp",
- "status": "approved",
- "updated_at": "2022-03-09T00:00:00.000Z",
- "components": null,
- "keyboard": {
- "inline": true
}, - "attachments": [
], - "sender": null
}
]
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
id required | number Template ID |
text required | string Template Text |
{- "id": 1,
- "text": "New template text"
}
{- "result": "success"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
templateId required | number Template ID |
required | object |
{- "templateId": 1,
- "channel": {
- "channel": "telegram"
}
}
{- "result": "success",
- "templateId": 1,
- "channel": "telegram",
- "status": "moderate",
- "updated_at": "2022-07-07T19:52:15.023Z"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
templateId required | number Template ID |
channel required | string Channel ID |
{- "templateId": 1,
- "channel": "telegram"
}
{- "result": "success"
}
One template may only belong to one group. Templates that have at least one similar channel cannot be combined into a group.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
name required | string Group name |
templates required | Array of numbers ID of the templates included in the group |
{- "name": "Test group of templates",
- "templates": [
- 1,
- 2
]
}
{- "result": "success",
- "id": 1,
- "name": "Test group of templates",
- "created_at": "2022-03-09T00:00:00.000Z",
- "updated_at": "2022-03-09T00:00:00.000Z"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
templateId required | number Template ID |
templateGroupId required | number Template group ID |
{- "templateId": 1,
- "templateGroupId": 1
}
{- "result": "success"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
templateId required | number Template ID |
{- "templateId": 1
}
{- "result": "success"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
templateId required | number Template ID |
{- "templateId": 1
}
{- "result": "success"
}
Deals is a section in CRM that stores the history of deals with your customers. For the created deals, you can send automatic campaigns to notify customers or your employees.
Transaction attributes can have 1 of 8 types, which sets the interface in the personal account for setting the attribute value.
The attribute can also refer to one of the entities: Transaction (deal) or Product/service (product).
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
name required | string Attribute name |
type required | string Default: "STRING" Enum: "STRING" "NUMBER" "DATE" "DATETIME" "BOOLEAN" "SELECT" "MULTISELECT" "URL" Attribute type |
options | Array of strings or numbers or null List of options for attributes with the SELECT and MULTISELECT type |
required | bool Default: false Is the attribute mandatory when creating a deal |
entity | string Default: "deal" Enum: "deal" "product" The designation to which entity the attribute belongs. deal is a general attribute of deals, product is an attribute of goods/services of deals |
apiField | string The path to the attribute value in the original JSON object of the deal (not in Fromni format) |
active | bool Default: true Whether the attribute is active. If false, the attribute will not be shown when creating a deal, but the attribute value will be displayed for already created deals. |
{- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true
}
{- "result": "success",
- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false
}
By default, the following attributes are available to you: Status (entity - Deal, type - Selection), Amount (Deal, Number), Name (Product/service, String), Cost (Product/service, Number).
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
{ }
{- "result": "success",
- "data": [
- {
- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false
}
]
}
To update, it is enough to pass only the attribute ID and the fields being updated
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
id required | string Attriute ID |
name required | string Attribute name |
type required | string Default: "STRING" Enum: "STRING" "NUMBER" "DATE" "DATETIME" "BOOLEAN" "SELECT" "MULTISELECT" "URL" Attribute type |
options | Array of strings or numbers or null List of options for attributes with the SELECT and MULTISELECT type |
required | bool Default: false Is the attribute mandatory when creating a deal |
entity | string Default: "deal" Enum: "deal" "product" The designation to which entity the attribute belongs. deal is a general attribute of deals, product is an attribute of goods/services of deals |
apiField | string The path to the attribute value in the original JSON object of the deal (not in Fromni format) |
active | bool Default: true Whether the attribute is active. If false, the attribute will not be shown when creating a deal, but the attribute value will be displayed for already created deals. |
isDefault | bool Whether the attribute is the default attribute. If true, the attribute is created by the system, if false, it is created by the user |
{- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false
}
{- "result": "success",
- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
id required | string Attribute ID |
{- "id": "627c39f0e18d850013026ec5"
}
{- "result": "success"
}
The method supports both single and batch addition of deals. During batch addition, the created deals are returned in the data array. If an error occurred when creating a deal when adding deals in batch mode, then in the response array the element with the corresponding index will contain the error field with the error description.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
name required | string Deal name |
required | Array of objects (AttributeSimple) Array of deal attributes with the entity field equal to 'deal' |
Array of objects List of goods/services related to the deal | |
contactId required | string ID of the contact in the Fromni system associated with the deal |
{- "name": "Deal name",
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "value": "Moscow"
}
], - "products": [
- {
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "value": "Moscow"
}
]
}
], - "contactId": "6011cd57f1a1932d984f2bcc"
}
{- "result": "success",
- "id": "627c483de18d850013027b7b",
- "name": "Deal name",
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false,
- "value": "Moscow"
}
], - "products": [
- {
- "id": "627c483de18d850013027b85",
- "dealId": "627c483de18d850013027b7b",
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false,
- "value": "Moscow"
}
]
}
], - "contactId": "6011cd57f1a1932d984f2bcc",
- "createdAt": "2022-05-10T00:00:00.000Z"
}
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
filter | object |
offset | number Default: 0 Indent from the beginning of the list |
limit | number Default: 10 Maximum number of entries in the answer. Do not specify this parameter if you need to return all records. |
order | Array of strings[ items ] Sorting parameters. Each element is an array in which the 1st element is the name of the field that is being sorted, and the 2nd element is the sorting order (ASC or DESC) |
{- "filter": { },
- "offset": 0,
- "limit": 10,
- "order": [
- [
- "createdAt",
- "DESC"
]
]
}
{- "result": "success",
- "data": [
- {
- "id": "627c483de18d850013027b7b",
- "name": "Deal name",
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false,
- "value": "Moscow"
}
], - "products": [
- {
- "id": "627c483de18d850013027b85",
- "dealId": "627c483de18d850013027b7b",
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false,
- "value": "Moscow"
}
]
}
], - "contactId": "6011cd57f1a1932d984f2bcc",
- "createdAt": "2022-05-10T00:00:00.000Z"
}
], - "total": 1
}
The method supports both single and batch removal of deals. In case of batch removal, the result is returned in the data array. If an error occurred when removing a deal in batch mode, then in the response array the element with the corresponding index will contain the error field with a description of the error.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
id required | string Deal ID |
{- "id": "627c483de18d850013027b7b"
}
{- "result": "success",
- "data": true
}
Note that it is important to pass all the attributes of a previously created deal, otherwise the attribute value will be unlinked from the deal (deleted). You can specify new attributes, in which case they will be added to the list of existing attributes of the deal.
Also note that to update the attributes of the goods/services of the deal, you must pass the product/deal ID (id field) received in the response when creating the deal
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
name required | string Deal name |
required | Array of objects (AttributeSimple) Array of deal attributes with the entity field equal to 'deal' |
Array of objects List of goods/services related to the deal | |
contactId required | string ID of the contact in the Fromni system associated with the deal |
{- "name": "Deal name",
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "value": "Moscow"
}
], - "products": [
- {
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "value": "Moscow"
}
], - "id": "627c483de18d850013027b85",
- "dealId": "627c483de18d850013027b7b"
}
], - "contactId": "6011cd57f1a1932d984f2bcc"
}
{- "result": "success",
- "id": "627c483de18d850013027b7b",
- "name": "Deal name",
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false,
- "value": "Moscow"
}
], - "products": [
- {
- "id": "627c483de18d850013027b85",
- "dealId": "627c483de18d850013027b7b",
- "attributes": [
- {
- "id": "627c39f0e18d850013026ec5",
- "name": "City",
- "type": "STRING",
- "options": null,
- "required": true,
- "entity": "deal",
- "apiField": "order.city",
- "active": true,
- "isDefault": false,
- "value": "Moscow"
}
]
}
], - "contactId": "6011cd57f1a1932d984f2bcc",
- "createdAt": "2022-05-10T00:00:00.000Z"
}
Note that using this method, you can only update the attribute value, and not add a new one or delete an old one.
Content-Type required | string Example: application/json |
Authorization required | string Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
dealId | string Deal ID |
attributeId | string Attribute ID |
productId | string or null Product/service ID or null if the attribute belongs to the 'deal' entity |
value | string or number or null New value of the attribute |
{- "dealId": "627c483de18d850013027b7b",
- "attributeId": "627c39f0e18d850013026ec5",
- "productId": "627c483de18d850013027b85",
- "value": "Saint-Petersburg"
}
{- "result": "success"
}
Status | Description |
---|---|
sent | Message has been sent, the final status is expected |
unknown | Status unknown |
rejected | The message was rejected by the Operator |
undelivered | The message was not delivered |
expired | The delivery time has expired |
delivered | Message delivered |
read | Message read |
error | Sending failed with an error |
blocked_by_user | The user has forbidden sending messages |