Russian  English  All projects

Set up integration between two companies via API



Stage 1 Orders are created on the Companys side 1 and transmitted to AmoCRM in the form of transactions.

Precedence rule:

Creating an order in Company 1 in the status "In processing".
Search for a contact in AmoCRM by the custom field detmirUserId (field_id: 932790), which stores the User ID of Company 1.
If no contact is found, a new one is created. Fields are filled in: name, surname, phone, detmirUserId.
Create a deal. Options:
Funnel: Company 2,
Initial status: New lead,
Contact: from item 2,
Tag: "Companies 1. Services" (tag ID 499278),
Company Order ID 1: custom field detmirOrderId (field_id: 932792).
Companys order 1 stores additional information in the addtitionalInfo field
{
"contactId": number,
"externalId": number,
"closedByDetmir": boolean
}
Where is
contactId - contact ID in AmoCRM,
externalId - transaction ID in AmoCRM,
closedByDetmir is a sign of closing the order by Company 1.
After 4 hours, the orders created on the side of Company 1 are transferred to the status "Executed", and the flag closedByDetmir = true is set in addtitionalInfo
Step 2 Create orders on the Companys side 1 and send them to AmoCRM as in step 1.

Company 1 disables the automatic closing of orders. Instead, order editing is carried out by the integration service of Company 2.

Updates must be submitted to Company 1 upon the occurrence of events in transactions.

List of events to handle

Event in AmoCRM

Action in Company 1

Go to "Recorded for trial"

Change order status from on_approval to approved

Switch to "Confirmed VU"

Change order status from approved to in_work

Go to "Lesson Passed"


Go to "Waiting for a solution"


Go to "Waiting for payment"

Transfer order amount (cost field)

Payment received

Mark the order as paid

(paid: true)

Submit Subscription Status

Another lesson has passed

Update subscription status

Success


Refusal

Convert order to rejected status



Step 3 "Company 2" creates a webview with support for seamless authorization, and also implements a full flow of work with orders in Company 1 through the integration API.

In orders, additional information should be transmitted to additionalInfo in the same format as in the first two stages.

Company 1, in turn, disables the ability to create orders for the service from the service of Company 2.


28.05.2022 20:07



 Answers freelancers