Skip to main content

KWIGA

KWIGA is a platform for online schools. Its process automations have the Send Webhook action, where you write the body of the request yourself. Pointed at the Flows address, it starts your flows: a payment for an offer succeeded or failed, an order is left unpaid, a student got access to a course — and the student gets the right message in Viber or SMS, with a reminder if nothing happens.

Written from KWIGA documentation

This page is written from the public documentation of KWIGA and has not been checked on a live account yet.

What you need​

  • Access to Courses → Process automation in KWIGA. Which plan includes automations and the webhook action is not stated in KWIGA's documentation.
  • One KWIGA scenario per event: "successful payment" is one scenario, "access opened" is another. All of them use the same address.
  • A KWIGA scenario works only for events that happen after it is published.

Step 1. Create a connection​

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

Step 2. Set up a scenario in KWIGA​

  1. Open Courses → Process automation and press Create scenario. Name it after the event, for example "AlphaFlow — successful payment".
  2. On the Start card press the pencil and choose the event: Sales → Offers → Successful offer payment. You can choose a particular offer.
  3. Add step → Action → the group System → General → Send Webhook.
  4. Request type — POST, the page address — the address from the cabinet.
  5. On the Headers tab add Content-Type with the value application/json. Authorization is not needed: the secret is in the address.
  6. Request body — paste the body below as it is: KWIGA substitutes the variables in braces itself.
  7. Connect the steps, end the branch with the End step, press Save and Publish.

The body for a successful payment:

{
"event": "payment_succeeded",
"message_id": "kwiga:payment:{payment.id}",
"contact": { "phone": "{contact.phone}", "email": "{contact.email}" },
"traits": { "first_name": "{contact.first_name}", "last_name": "{contact.last_name}" },
"dedupe_key": "{order.id}",
"properties": {
"order_id": "{order.id}",
"offer": "{offer.title}",
"amount": "{payment.price}",
"currency": "{payment.currency_code}"
},
"context": { "source": "kwiga", "contact_id": "{contact.id}" }
}

For every other event create a separate scenario with the same address and change event, message_id and properties in the body:

  • Unsuccessful offer payment — "event": "payment_failed", "message_id": "kwiga:payment_failed:{payment.id}", the properties as above.
  • Offer payment refund — "event": "refund_issued", "message_id": "kwiga:refund:{payment.id}", the properties as above.
  • Unpaid order (request) — "event": "order_created", "message_id": "kwiga:order:{order.id}"; properties: order_id — {order.id}, offer — {offer.title}, amount — {order.price}, currency — {order.currency_code}.
  • Free offer accepted, Registered for the webinar — "event": "lead_submitted", "message_id": "kwiga:access:{product.id}:{contact.id}"; properties: product — {product.title}.
  • CTA form request — "event": "form_submitted", "message_id": "kwiga:cta:{cta.id}:{contact.id}:{datetime|format:YYYYMMDDHHmmss}"; properties: form — {cta.title}.

The body for access to a course (Product access opened):

{
"event": "course_enrolled",
"message_id": "kwiga:course_enrolled:{product.id}:{contact.id}",
"contact": { "phone": "{contact.phone}", "email": "{contact.email}" },
"traits": { "first_name": "{contact.first_name}", "last_name": "{contact.last_name}" },
"properties": { "course": "{product.title}" },
"context": { "source": "kwiga", "contact_id": "{contact.id}" }
}
  • Do not use variables the chosen event does not have: {payment.id}, for example, is not available at Product access opened. KWIGA's list of variables says for each group at which events it is available. If {order.id} is not available, remove the dedupe_key line.
  • Course completed → course_completed with course. Whether the {product.*} variables are available at this event is not confirmed by the documentation: check the list of variables, and if they are, use the body for access with course_completed in event and in message_id.

Step 3. Send a test​

Publish the scenario and go through the event yourself — a test payment or a free offer. The event appears in Flows → Connections → Event journal within seconds. The connection shows Recognised: KWIGA.

Events​

Event in KWIGAAlphaFlow eventProperties
Successful offer paymentpayment_succeededorder_id, offer, amount, currency
Unsuccessful offer paymentpayment_failedorder_id, offer, amount, currency
Offer payment refundrefund_issuedorder_id, offer, amount, currency
Unpaid order (request)order_createdorder_id, offer, amount, currency
Product access openedcourse_enrolledcourse
Course completedcourse_completedcourse
Free offer accepted, Registered for the webinarlead_submittedproduct
CTA form requestform_submittedform

Each name goes only into the scenario started by its own KWIGA event from the table: payment_succeeded — only at Successful offer payment, course_completed — only at Course completed. The same body in a scenario on another event would tell the student about a payment or a course that did not happen.

The contact is found by the phone and the email of the KWIGA contact; the first and last names come from it too. The id of the KWIGA contact goes to context.contact_id, not to the customer id, so it cannot clash with the ids of your other systems. The body is already an event in the AlphaFlow format — see Event format.

Good to know​

  • Whether KWIGA repeats a failed request, and how long it waits for the answer, is not described in its documentation. A repeat with the same message_id is not recorded twice.
  • KWIGA puts the values of the variables into the body as text. Whether it escapes quotes and line breaks is not described, so do not put multi-line variables such as {cta_request.form_data} into the body. amount comes as text: "1490.00".
  • The format option of {datetime} in the id of a CTA request is not confirmed by the documentation.
  • Nothing has to be signed: the secret in the address is enough.
  • The event needs a phone or an email, or an id AlphaFlow already knows. Otherwise it is refused with no_contact and shown in the journal.
  • 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 scenario in KWIGA stays published.

KWIGA documentation​