Fromni Bots API (1.0.0)

Download OpenAPI specification:Download

API for interacting with the Fromni platform. Mainly designed to run:

  • Campaigns, that means scenarios in which you, i.e. the business, are the initiator of communication. In this case, the response or possible action of the recipient is pre-laid in the scenario.
  • Notifications - you want to send a message to the user and do not expect a response to it. At the same time, the message can be sent, among others, through the WhatsApp Business API.

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.

Introduction

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

Headers

Authorization: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Content-Type: application/json

Events

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.

Transmit Event

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.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
name
required
string

Name of event

data
object

Any object containing event data

Responses

Request samples

Content type
application/json
{
  • "name": "added_to_cart",
  • "data": {
    }
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "2c78e241008fedf822288be5"
}

List of available events

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
Schema not provided

Responses

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ]
}

Campaigns

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 campaign

Launch a campaign (by template and script)

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
One of
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.

Responses

Callbacks

Request samples

Content type
application/json
Example
{
  • "name": "My campaign",
  • "liveTime": 24,
  • "scenarioId": "5eb882228fdef800142e87c2",
  • "channels": [
    ],
  • "templateId": 1,
  • "data": [
    ],
  • "match": [
    ]
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "2c78e241008fedf822288be5"
}

Callback payload samples

Callback
POST: The campaign is completed
Content type
application/json
{
  • "type": "campaign_completed",
  • "data": {
    }
}

List of campaigns sent

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.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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)

Responses

Request samples

Content type
application/json
{
  • "startDate": "2021-01-21T00:00:00:000Z",
  • "endDate": "2021-02-21T00:00:00:000Z\"",
  • "type": "event"
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ]
}

Campaign statistics

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.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
id
required
string

Campaign ID

Responses

Request samples

Content type
application/json
{
  • "id": "2c78e241008fedf822288be5"
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "2c78e241008fedf822288be5",
  • "name": "My campaign",
  • "liveTime": 48,
  • "channels": [
    ],
  • "scenarioId": "5eb882228fdef800142e87c2",
  • "templateId": 1,
  • "docs": [
    ],
  • "match": [
    ],
  • "headers": [
    ],
  • "createdAt": "2020-10-20T00:00:00.436Z"
}

Notifications

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).

Send notification

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).

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
One of
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.

Responses

Callbacks

Request samples

Content type
application/json
Example
{
  • "phone": 79000000000,
  • "contactId": "5f3cd834e8aadd00137359aa",
  • "message": {},
  • "channels": [
    ]
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "6062fdc861914f0013e793a2"
}

Callback payload samples

Callback
POST: Notification Status Updated
Content type
application/json
{
  • "type": "notification_message_updated",
  • "data": {
    }
}

Media Storage

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.

Get the server parameters to upload

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.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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

Responses

Request samples

Content type
application/json
{
  • "contentType": "application/pdf",
  • "filename": "contract.pdf"
}

Response samples

Content type
application/json
{}

Messenger

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.

A new dialog with the operator has been initiated Webhook

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.)

Request Body schema: application/json
name
required
string
required
object (Conversation)

Responses

Request samples

Content type
application/json
{
  • "name": "conversation_operator_requested",
  • "data": {
    }
}

A new conversation message received from a user Webhook

Request Body schema: application/json
name
required
string
required
object

Responses

Request samples

Content type
application/json
{
  • "name": "conversation_message_created",
  • "data": {
    }
}

List of dialogs

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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.

Responses

Request samples

Content type
application/json
{
  • "offset": 0,
  • "limit": 10
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ]
}

Dialog Messages

The method can be useful to load the User's communication history with the Bot after the operator is connected to the dialog.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
conversationId
string

Dialog ID

Responses

Request samples

Content type
application/json
{
  • "conversationId": "5f3cd834e8aadd00137359aa"
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ]
}

Send a message to the dialog

The operator can send a message to the dialog only if the dialog's operatorMode has not expired.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
conversationId
string

Dialog ID

object

Responses

Callbacks

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "result": "success",
  • "messageId": 2,
  • "status": "sent",
  • "conversationId": "5f3cd834e8aadd00137359aa"
}

Callback payload samples

Callback
POST: The status of the message sent to the user via Messenger has been updated
Content type
application/json
{
  • "name": "conversation_message_updated",
  • "data": {
    }
}

Contacts and variables

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
Instagram instagramId
Telegram telegramId
Viber - chatbots viberId
Facebook 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)

A new contact has been created Webhook

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.

Request Body schema: application/json
type
string
required
Array of objects (ConversationContact)

Responses

Request samples

Content type
application/json
{
  • "type": "contact_created",
  • "data": [
    ]
}

Contact updated Webhook

The data object contains all the contact fields, not just the updated ones.

Request Body schema: application/json
type
string
required
object (ConversationContact)

Contact

Responses

Request samples

Content type
application/json
{
  • "type": "contact_updated",
  • "data": {
    }
}

Contacts are merged Webhook

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.

Request Body schema: application/json
type
string
required
object

Responses

Request samples

Content type
application/json
{
  • "type": "contact_merged",
  • "data": {
    }
}

Contact list

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
header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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)

Responses

Request samples

Content type
application/json
{
  • "filter": {
    },
  • "offset": 0,
  • "limit": 10,
  • "order": [
    ]
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ],
  • "total": 100
}

Get a contact by ID

Returns known contact IDs in various messengers (phone, vkId, instagramId, etc.), as well as the values of its variables.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
id
required
string

Contact ID

Responses

Request samples

Content type
application/json
{
  • "id": "608044bd4eeb3c0013c2e21e"
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "5f3cd6d49ed4e10013083db0",
  • "phone": "+79997775533",
  • "vkId": 123456,
  • "vk": {
    },
  • "createdAt": "2021-04-09T09:55:09.782Z",
  • "updatedAt": "2021-04-09T09:55:09.782Z",
  • "variables": [
    ]
}

Create a contact

Creates contacts in CRM with the specified phone number and variables

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
Array
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)

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ]
}

Update Contact

Update the ID in one of the channels (only "phone", "vk ID", "viber ID", "fbId", "telegramId", "instagramId" can be changed).

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
contactId
string

Contact ID

field_to_update
string or number

Instead of fields_to_update, use the field designation with the ID from table

Responses

Request samples

Content type
application/json
{
  • "contactId": "6062fdc861914f0013e793a2",
  • "field_to_update": 79990000000
}

Response samples

Content type
application/json
{
  • "result": "success"
}

List of variables

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.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
any

Responses

Request samples

Content type
application/json
null

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ]
}

Create a variable

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
name
required
string

Variable name

validateAs
string
Default: "STRING"
Enum: "STRING" "NUMBER" "DATE"

Responses

Request samples

Content type
application/json
{
  • "name": "City",
  • "validateAs": "STRING"
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "60b7f9b6163fec0007ecdaf0"
}

Delete a variable

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
id
required
string

Variable ID

Responses

Request samples

Content type
application/json
{
  • "id": "60b7f9b6163fec0007ecdaf0"
}

Response samples

Content type
application/json
{
  • "result": "success"
}

Set contact variables

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
One of
contactId
required
string

Contact ID

required
Array of objects

List of variables

Responses

Request samples

Content type
application/json
Example
{
  • "contactId": "608044bd4eeb3c0013c2e21e",
  • "variables": [
    ]
}

Response samples

Content type
application/json
{
  • "result": "success"
}

Callback-server

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.

Set a callback server

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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.

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{
  • "result": "success"
}

Get callback server parameters

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
any

Responses

Request samples

Content type
application/json
null

Response samples

Content type
application/json
{}

Channels and connections

Channels and their designations in Fromni:

Channel Designation
VKontakte vk
Instagram instagram
Telegram telegram
Viber - chatbots viber-bots
Facebook fb
Whatsapp Business whatsapp-business
Whatsapp WEB whatsapp
Viber - business messages viber
SMS sms
Notify notify
Web chat webchat

Get a list of connections to channels

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
any

Responses

Request samples

Content type
application/json
null

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": {
    }
}

Text templates

Text templates are necessary so that the company can write first in channels where arbitrary texts are not allowed.

Get a list of templates

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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)

Responses

Request samples

Content type
application/json
{
  • "offset": 0,
  • "limit": 10,
  • "order": [
    ]
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ]
}

Create a template

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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

Responses

Request samples

Content type
application/json
{
  • "displayName": "Test template",
  • "text": "Hi! This is a sample message",
  • "name": "before_visit_10_min",
  • "channels": []
}

Response samples

Content type
application/json
{
  • "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": [
    ]
}

Update the template text

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
id
required
number

Template ID

text
required
string

Template Text

Responses

Request samples

Content type
application/json
{
  • "id": 1,
  • "text": "New template text"
}

Response samples

Content type
application/json
{
  • "result": "success"
}

Add a channel for a template

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
templateId
required
number

Template ID

required
object

Responses

Request samples

Content type
application/json
{
  • "templateId": 1,
  • "channel": {
    }
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "templateId": 1,
  • "channel": "telegram",
  • "status": "moderate",
  • "updated_at": "2022-07-07T19:52:15.023Z"
}

Remove a channel from a template

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
templateId
required
number

Template ID

channel
required
string

Channel ID

Responses

Request samples

Content type
application/json
{
  • "templateId": 1,
  • "channel": "telegram"
}

Response samples

Content type
application/json
{
  • "result": "success"
}

Create a template group

One template may only belong to one group. Templates that have at least one similar channel cannot be combined into a group.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
name
required
string

Group name

templates
required
Array of numbers

ID of the templates included in the group

Responses

Request samples

Content type
application/json
{
  • "name": "Test group of templates",
  • "templates": [
    ]
}

Response samples

Content type
application/json
{
  • "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"
}

Add a template to a group

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
templateId
required
number

Template ID

templateGroupId
required
number

Template group ID

Responses

Request samples

Content type
application/json
{
  • "templateId": 1,
  • "templateGroupId": 1
}

Response samples

Content type
application/json
{
  • "result": "success"
}

Remove a template from a group

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
templateId
required
number

Template ID

Responses

Request samples

Content type
application/json
{
  • "templateId": 1
}

Response samples

Content type
application/json
{
  • "result": "success"
}

Delete template

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
templateId
required
number

Template ID

Responses

Request samples

Content type
application/json
{
  • "templateId": 1
}

Response samples

Content type
application/json
{
  • "result": "success"
}

Deals

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.

Create a deals attribute

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).

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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.

Responses

Request samples

Content type
application/json
{
  • "name": "City",
  • "type": "STRING",
  • "options": null,
  • "required": true,
  • "entity": "deal",
  • "apiField": "order.city",
  • "active": true
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "627c39f0e18d850013026ec5",
  • "name": "City",
  • "type": "STRING",
  • "options": null,
  • "required": true,
  • "entity": "deal",
  • "apiField": "order.city",
  • "active": true,
  • "isDefault": false
}

List of attributes

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).

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
object

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ]
}

Update Attribute

To update, it is enough to pass only the attribute ID and the fields being updated

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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

Responses

Request samples

Content type
application/json
{
  • "id": "627c39f0e18d850013026ec5",
  • "name": "City",
  • "type": "STRING",
  • "options": null,
  • "required": true,
  • "entity": "deal",
  • "apiField": "order.city",
  • "active": true,
  • "isDefault": false
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "627c39f0e18d850013026ec5",
  • "name": "City",
  • "type": "STRING",
  • "options": null,
  • "required": true,
  • "entity": "deal",
  • "apiField": "order.city",
  • "active": true,
  • "isDefault": false
}

Remove Attribute

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
id
required
string

Attribute ID

Responses

Request samples

Content type
application/json
{
  • "id": "627c39f0e18d850013026ec5"
}

Response samples

Content type
application/json
{
  • "result": "success"
}

Add a deal

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.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
One of
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

Responses

Request samples

Content type
application/json
Example
{
  • "name": "Deal name",
  • "attributes": [
    ],
  • "products": [
    ],
  • "contactId": "6011cd57f1a1932d984f2bcc"
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "627c483de18d850013027b7b",
  • "name": "Deal name",
  • "attributes": [
    ],
  • "products": [
    ],
  • "contactId": "6011cd57f1a1932d984f2bcc",
  • "createdAt": "2022-05-10T00:00:00.000Z"
}

Deals list

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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)

Responses

Request samples

Content type
application/json
{
  • "filter": { },
  • "offset": 0,
  • "limit": 10,
  • "order": [
    ]
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": [
    ],
  • "total": 1
}

Remove a deal

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.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
One of
id
required
string

Deal ID

Responses

Request samples

Content type
application/json
Example
{
  • "id": "627c483de18d850013027b7b"
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "data": true
}

Update deal

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

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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

Responses

Request samples

Content type
application/json
{
  • "name": "Deal name",
  • "attributes": [
    ],
  • "products": [
    ],
  • "contactId": "6011cd57f1a1932d984f2bcc"
}

Response samples

Content type
application/json
{
  • "result": "success",
  • "id": "627c483de18d850013027b7b",
  • "name": "Deal name",
  • "attributes": [
    ],
  • "products": [
    ],
  • "contactId": "6011cd57f1a1932d984f2bcc",
  • "createdAt": "2022-05-10T00:00:00.000Z"
}

Update the value of the deal attribute

Note that using this method, you can only update the attribute value, and not add a new one or delete an old one.

header Parameters
Content-Type
required
string
Example: application/json
Authorization
required
string
Example: Token xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Request Body schema: application/json
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

Responses

Request samples

Content type
application/json
{
  • "dealId": "627c483de18d850013027b7b",
  • "attributeId": "627c39f0e18d850013026ec5",
  • "productId": "627c483de18d850013027b85",
  • "value": "Saint-Petersburg"
}

Response samples

Content type
application/json
{
  • "result": "success"
}

Possible message statuses

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

History of changes

01.12.2022

  • Added attachments and keyboard as optional parameters when creating templates

22.08.2022

  • Added support for batch add and delete of deals

07.07.2022

  • Added a description of all methods for working with templates

12.05.2022

09.03.2022

25.02.2022

  • Now you can set a contact variable not only by its ID, but also by name. Based on this, the variable name must be unique. Affected methods: Set contact variables and Create contact

10.02.2022

07.02.2022

09.11.2021

01.11.2021

  • Updated the Sending notification method. Now the notification can contain an attachment that will be sent if supported by the channel.
  • The type of the "Variable type in the digital profile" field has been changed from a number to a string (0, 1, 2 replaced with STRING, NUMBER, DATE, respectively).

27.10.2021