1. Home
  2. Docs
  3. API Documentation
  4. Active APIs
  5. start_txn

start_txn

This API initiates a new transaction for a pre-defined automation flow.

A transaction can be explained as follows:

Consider a customer who selects some items for purchasing and adds them to his cart, but exits your application (terminates his session) without purchasing the selected items. If you have already defined an “Abandoned Transaction” workflow for this case (such as send you a notification, or send out an email to the customer, or send an SMS, etc.), then you just need to initiate a new transaction for this customer with the automation ID of the already defined automation workflow, and Juvlon will proceed to execute all the actions (such as sending an email, etc.) as defined in your workflow.

If another customer abandons his cart, then you need to initiate another transaction with the same automation workflow ID for this other customer.

The explanation above uses the “Abandoned Transaction” workflow as an example. But you can define a workflow in Juvlon for any type of automation that you need, and then simply initiate transactions to execute steps defined in your workflow using this “start_txn” API.

This API will check if the customer already exists in your Juvlon account. If not, then the customer will be added to the list name that you provide. Atleast one of the following parameters must be specified to identify your customer: Email, Mobile or SubID.

URL: https://api2.juvlon.com/v4/start_txn

JSON Parameters
'{"ApiKey":"$ApiKey",
        "AutomationID":"$AutomationID",
        "StepID":"$StepID",
        "Email":"$Email",
        "Mobile":"$Mobile",
        "SubID":"$SubID",
        "FirstName":"$FirstName",
        "LastName":"$LastName",
        "ListName":"$ListName",
        "ReferenceNumber":"$ReferenceNumber",
        "CustomField":"$CustomField"
}';
Arguments
NameTypeDescriptionDefault
apikeyString(Mandatory) The ApiKey is a unique key generated for your account that authenticates you and helps us to identify your Juvlon account. 
AutomationIDInt(Mandatory) The ID of the already defined automation workflow that you want to execute. 
StepIDInt(Mandatory) The ID of the step for starting the transaction in the automation workflow that you want to execute. 
Email *StringThe email address of your customer or subscriber for whom the transaction is being initiated. 
Mobile *IntThe mobile number of your customer or subscriber for whom the transaction is being initiated. 
SubID *IntThe Subscriber ID of your customer or subscriber for whom the transaction is being initiated. 
first_nameStringThe first name of your customer or subscriber for whom the transaction is being initiated. 
lastnameStringThe last name of your customer or subscriber for whom the transaction is being initiated. 
ListNameStringThe name of the list to which the subscriber needs to be added.
• If no list with the name provided exists, then a new list with that name is created.
• If no list name is provided, then the subscriber gets added to the default list.
API_EMAILS
ReferenceNumberIntAny customer-specific number that you want to use in your emails to the customer. For example, a policy number, membership number etc. 
CustomFieldStringCustomized text for your internal tracking. 

Return value

TypeDescription
CodeThe Success or Error code as per the result of executing this API call. Please refer to the section “Possible-Response-Codes” for more details. 
Status“Success” or “Error” text. 
CustomFieldThe Customized text that you sent in the API call for your internal tracking purposes. 
TransactionIDA number generated to uniquely identify the current transaction. 

Usage / Example(s)

PHP Example Code for Integration

$url = 'https://api2.juvlon.com/v4/start_txn'; 
$data = '{"ApiKey":"KEY",
            "AutomationID":"1",
            "StepID":"1",
            "Email":"example@abc.com",
            "Mobile":"8888888888",
            "FirstName":"John",
            "LastName":"Smith",
            "ListName":"ABC",
            "ReferenceNumber":"XYZ",
            "CustomField":"Custom text"
}';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$res1 = curl_exec($ch);
curl_close($ch);

Success-Response

HTTP/1.1
{
    "code":200,
    "status":"Success",
    "CustomField":"Custom text like reference number",
    "TransactionID":"327"    
}

Error-Response

 HTTP/1.1
{
    "code":442,
    "status":"Error",
    "CustomField":"Custom text"
} 

Possible-Response-Codes

200    Success: API Request Accepted
401    Error: Invalid Method
402    Error: Unauthorized/Empty Key
403    Error: Unauthorized/Invalid Key
404    Error: Account Sending Blocked
405    Error: Your Juvlon account has expired
448    Error: Your Juvlon account is Deactivated
601    Error: Invalid / Incorrect Automation ID
606    Error: No Automation ID
605    Error: Invalid / Incorrect Step ID
607    Error: No Step ID provided
602    Error: No subscriber provided
412    Error: Invalid recipient email address
443    Error: INACTIVE Subscriber
455    Error: Invalid recipient mobile number
456    Error: Invalid Subscriber ID
441    Error: Invalid list name
444    Low Subscriber credit
445    Low Email credit
504    Error: Not Available