+55 (21) 960104492
Log In Free trial
Select region

Mailing to AMOcrm contacts via Bot Constructor

Create external integration on the AmoMarket page

  1. Go to the "AmoMarket" section.
  2. In the upper right corner, click "...".
  3. Select "Create Integration".
  4. Click on "External Integration".
  5. Select "Give access to: everyone."
  6. Fill in the "Title" and "Description" fields.
  7. Click "Save".

Generate a "Long-term key" for integration

  1. On the "AmoMarket" page, open the "Installed" tab.
  2. Find your integration and click on it.
  3. Go to the "Keys and Access" section.
  4. Click on the "Generate" button to create a long-term key.
  5. Save this key - you will need it when setting up the bot builder.

Get the source code from the bot builder

Go to the bot builder and follow these steps:

  1. Incoming webhook - a block for receiving data via a webhook.
  2. API - create a GET request to your AMOcrm: 
    https://{{your domain AMOcrm}}/api/v4/contacts. 
    In the page header parameters, the field is “Authorization” and the value is “Medium {{long-term key}}”.
  3. Changing a Variable 1 - Set variable i to 0.
  4. Changing a Variable 2 - assign a value to the contact_type variable from the API request: {{...data._embedded.contacts[i].custom_fields_values[1].values[0].value}}.
    If true, connect to the Pause block.
    If false, connect to the Sending message 1 block.
  5. Sending message 1 - send a message via ChatID using the result of the API request: {{...data._embedded.contacts[i].custom_fields_values[2].values[0].value}}.
  6. Pause - add a pause of 1 second.
  7. Condition 2 - check if i >= 200.
  8. If true, connect to the Sending message 2 block.
  9. If false, connect the Programmer to the block.
  10. Programmer - create a function: {{i}} + 1.
  11. Connect it to the Changing a Variable 2 block.


    Make sure the script is configured correctly. An example script is available here:
    Scenario.

Network up and deal financial in AMO

  1. Go to the "Transactions" section in AMO.
  2. In the top right corner, click “Customize Funnel.”
  3. Remove all unnecessary stages.
  4. Rename the remaining stages to “Start mailing” and “Carry out mailing”.
  5. At the "Start mailing" stage, add a "Webhook" trigger.
  6. In the "Specify URL" field, paste the link from the "Incoming webhook" block of the bot constructor.
  7. Add a "Status Change" trigger.
  8. Specify completion in 2 minutes and change to the “Distribution completed” stage.
  9. Save the funnel.

    Now all that remains is to add a deal at the “Submission Completed” stage and wait for a message from the bot.
Leave a request for integrator services