Help docs

Select a topic from the list.

API: how to trigger a send


Triggering a send remotely via the Serious Email API requires coding experience so it's recommend that your web developer is responsible for this.

The Serious Email API offers a means to trigger email sends remotely. It allows you to pass Serious Email user information such as email addresses, names and anything else you can think of. This information will be stored in a subscriber list of your choosing and sent to the newly added subscriber(s) via a template of your creation as well.

This is very poweful as it allows you to create highly customized templates that are extremely easy to edit and maintain. You could send transactional or marketing information.

We allow for up to 1000 triggered sends at a time.

Currently we offer a PHP helper class as a bridge to the API. The API is typical in that it uses JSON to communicate between Serious.Email and your server. You don't need the helper to utilize the API, however if you are coming at this from a middleware other than PHP, it would probably be useful to look at our helper class to understand what's needed. Translating the helper class to suit your needs would probably be pretty easy. If you need help with this or anything else - please just let us know contact us.

  1. Visit Github

    Get the PHP helper class and incorporate it into your site. GitHub. There are more detailed instructions at Github outlining how to incorporate the helper class into your site.
  2. Generate KEYS

    Keys are neccessary to ensure security. If your account has access, you can generate keys here: Generate Keys. If you are part of a team, you may not have access to aspects of the site. Your group admin will either have to grant you access or create some of the following. Please do not share your API Secret with anyone.
  3. Create Subscriber List

    Visit: https://serious.email/subscribers-manager. Subscribers that you add via this API will be saved to this list. This enables comprehensive analytics, future sends and data back-up.
  4. Create a campaign and note it's ID

    This is not neccessary if you already have a Campaign created that you'd like to use. However, you will still need it's ID. The Campaign "Settings" dialog will allow you to set a default subcriber list, default test subscriber list, sender name and sender email.
  5. Create an email template and note it's ID

    https://serious.email/templates-manager. This is the template that will be sent to your remotely added subscribers. Coding a template to use custom data is relatively simple, but will be addressed in a separate tutorial.
  6. Add code to your site

    Use the example provided as a basis for your own needs. Now that you have set-up everything at Serious.email and you've installed this package - you can start sending emails. Below is an example script for accessing the API and sending an email:
                                
    <?php
                    
    //require 'vendor/autoload.php'; //use this if installed via Composer.
    require_once('lib/SeriousEmail/SeriousEmail.php'); //manual installation
    
    $api_secret = 'YOUR_API_SECRET';
    $se = new SeriousEmail($api_secret);
    
    //an example of adding and sending to 2 subscribers...
    $data = array(
        'public_api_id' => 'YOUR_PUBLIC_API_KEY', 
        'campaign_id' => 89,
        'template_id' => 442,
        'recipient_info' => array(      
                        array (                             
                            'first_name' => 'Sam',
                            'last_name' => 'Lamb',
                            'email' => '[email protected]',
                            'custom' => array(
                                    'Points' => 92,
                                    'Balance' => 500,
                                    )   
                            ),                              
                        array (                             
                            'first_name' => 'Bob',
                            'last_name' => 'Smith',
                            'email' => '[email protected]',
                            'custom' => array(
                                    'Points' => 500,
                                    'Balance' => 20,
                                    )
                        ),                          
                    ),
        );
    
    $send = $se->send($data);
    
    if(isset($send)){
    	echo $send->feedback;
    }
                    
                    
  7. Debug

    Turn on debugging for feedback as to what is happening with your call to the Serious.Email API. The example below will yield basic information. More extensive information is available. The example on Github shows how you can access it. PHP Example.
     
    //include debugging information by adding '1'.                           
    $send = $se->send($data, 1);
    
    if(isset($send)){
        echo $send->feedback;
    }