Skip to main content

KeyCRM

KeyCRM is a CRM for online shops and services. Its triggers react to a change of the order status, the payment status or the stage of a pipeline card, and one of their actions sends an HTTP request. Pointed at the Flows address, that request starts your flows: an order is paid, shipped or cancelled, a lead moved to the next stage — and the customer gets the right message in Viber or SMS, with a reminder if nothing happens.

KeyCRM already has the platform as a built-in SMS and Viber channel, so a single notice on a status change can be sent by KeyCRM itself. Flows are for what a single notice cannot do: chains, waiting for payment, a cascade of channels, a reminder in three days.

Written from KeyCRM documentation

This page is written from the public documentation of KeyCRM and has not been checked on a live account yet. KeyCRM can be switched to English, but its help on triggers exists only in Ukrainian and Russian, so the labels are given as the Ukrainian interface shows them.

What you need​

  • Access to «Налаштування» → «Додатково» → «Автоматизація» in KeyCRM. Triggers and the HTTP request action are not limited to a separate plan; an account can have up to 200 triggers.
  • One trigger per event: "paid" is one trigger, "shipped" is another. All of them use the same address.

Step 1. Create a connection​

  1. Open Flows → Connections, press Connect a system and choose KeyCRM.
  2. Press Copy address. It looks like https://events.alphasms.net/hooks/<TOKEN> — keep it secret.

Step 2. Set up a trigger in KeyCRM​

  1. Open «Налаштування» → «Додатково» → «Автоматизація» and press «Додати тригер».
  2. «Назва» — what the trigger sends, for example "AlphaFlow — paid".
  3. «Подія» — what starts it:
    • «Зміна статусу замовлення» with the statuses in «Значення» — an order placed (the status «Новий»), shipped, completed, cancelled;
    • «Зміна статусу оплати» with «Оплачено» — an order is paid;
    • «Зміна статусу воронки» — a pipeline card moved to a stage.
  4. «Час виконання» — «Відразу». «Через» delays the trigger by up to 30 days.
  5. «Умови для виконання» if you need them — for example «трекінг код: Має» for a shipping trigger, so that the event goes only when the tracking number is filled in.
  6. In «Дії» choose «Відправити HTTP запит»: HTTP метод — POST, «Посилання» — the address from the cabinet.
  7. Switch on «Вказати власні параметри», open Body (JSON) and paste the body below. Change order_shipped in event and in message_id to the event of this trigger (see Events). Press «Перевірити JSON». Leave the headers as they are: KeyCRM sets Content-Type: application/json by itself.

A final event — order_paid, order_shipped, order_delivered, order_cancelled — goes only from a trigger whose «Значення» holds exactly that status: order_paid only with «Оплачено», never with a partial payment or with any payment status. A trigger on several order statuses, or on any order status, sends order_status_changed. A payment trigger sends nothing but order_paid with «Оплачено»: otherwise a "partly paid" order would reach the customer as "paid".

The body for orders:

{
"event": "order_shipped",
"message_id": "keycrm:order_shipped:{{ model.id }}",
"dedupe_key": "{{ model.id }}",
"contact": {
{% if model.client_email %}"email": "{{ model.client_email }}",{% endif %}
{% if model.client_id %}"external_id": "{{ model.client_id }}",{% endif %}
"phone": "{{ model.client_phone|default('') }}"
},
"traits": {
"first_name": "{{ model.client_name|default('')|split(' ')|last|replace({'"': ''}) }}"
},
"properties": {
"order_id": {{ model.id }},
"source_order_id": "{{ model.source_uuid|default('') }}",
"total": {{ model.grand_total|default(0) }},
"payment_status": "{{ model.payment_status|default('') }}",
"ttn": "{{ model.tracking_code|default('') }}",
"carrier": "{{ model.shipping_type|default('')|replace({'"': ''}) }}"
},
"occurred_at": "{{ 'now'|date('c') }}",
"context": { "source": "keycrm" }
}

For a trigger that fires on every status change (order_status_changed), make the id unique for each change — end message_id with :{{ 'now'|date('U') }}. Otherwise the second change of the same order is taken for a repeat.

The body for pipeline cards — the variables of pipelines are different, the order body does not work there:

{
"event": "deal_stage_changed",
"message_id": "keycrm:card:{{ model.id }}:{{ 'now'|date('U') }}",
"dedupe_key": "{{ model.id }}",
"contact": {
{% if model.contact_email %}"email": "{{ model.contact_email }}",{% endif %}
"phone": "{{ model.contact_phone|default('') }}"
},
"traits": {
"first_name": "{{ model.contact_name|default('')|split(' ')|last|replace({'"': ''}) }}"
},
"properties": {
"card_id": {{ model.id }},
"stage": "{{ model.status|default('')|replace({'"': ''}) }}",
"pipeline": "{{ model.pipeline|default('')|replace({'"': ''}) }}",
"title": "{{ model.title|default('')|replace({'"': ''}) }}"
},
"occurred_at": "{{ 'now'|date('c') }}",
"context": { "source": "keycrm" }
}
  • split(' ')|last takes the last word of the customer's full name as the first name, the way KeyCRM's own examples do ("Петренко Іван"). If your shop writes the first name first, change last to first.
  • The phone may come with +, spaces or brackets — AlphaFlow reads any of them.

Step 3. Send a test​

Move a test order to the status of the trigger. The run is listed in the history of the order, and the event appears in Flows → Connections → Event journal within seconds. The connection shows Recognised: KeyCRM.

Events​

Trigger in KeyCRMAlphaFlow eventProperties
«Зміна статусу замовлення» → «Новий»order_createdorder_id, total
«Зміна статусу оплати» → «Оплачено»order_paidorder_id, total, payment_status
«Зміна статусу замовлення» → your "shipped" statusorder_shippedorder_id, ttn, carrier
«Зміна статусу замовлення» → your "completed" statusorder_deliveredorder_id
«Зміна статусу замовлення» → your "cancelled" statusorder_cancelledorder_id
«Зміна статусу замовлення» → any statusorder_status_changedorder_id, status
«Зміна статусу воронки»deal_stage_changedcard_id, stage, pipeline

The contact is found by the phone of the buyer (model.client_phone), the email and the KeyCRM id of the buyer. The names of the events are the ones the ready-made templates expect — see Recommended events.

Without your own body​

If «Вказати власні параметри» stays off, KeyCRM sends its standard body: event and context with the ids of the order. AlphaFlow recognises it too, but the standard body has no phone and no name — only the id of the buyer (context.client_id), and for pipeline cards not even that. Such an event reaches only a contact AlphaFlow already knows by this id, and a pipeline event is refused with no_contact. Use your own body.

The standard body names the events by itself: a change of the order status comes as order_status_changed, a pipeline card as deal_stage_changed. A payment change becomes order_paid only when the payment status is paid; any other payment status (for example part_paid) gives no event: the order status in that request has not changed, and an "order status changed" would be false.

Before the receiver: events with a key​

The same trigger can send the same body to the events address with an event key instead of the connection address: «Посилання» — https://events.alphasms.net/v1/events, and in Headers one header Authorization with the value Bearer <KEY>. The key is issued in the cabinet — see Event key. This works without a connection, but every trigger keeps a key that you will have to replace by hand when you rotate it.

Good to know​

  • KeyCRM waits 10 seconds for the answer. On 5xx or a timeout it repeats three times — after 1, 5 and 15 minutes — with the data of the first attempt, so a repeat has the same message_id and is not recorded twice. On failure it notifies the manager and the administrators.
  • Only fixed parameters are allowed in «Посилання»; variables go into the body.
  • «Зміна статусу оплати» does not fire when an order is created already with that payment status.
  • The tracking number is passed as the ttn property, like any other property: AlphaFlow does not track the parcel itself.
  • The address always answers 200. Above the daily event limit the event is refused in AlphaFlow with quota_exceeded and shown in the journal; the trigger in KeyCRM stays on.

KeyCRM documentation​