Send your contacts to SendinBlue when an entry is created or updated in your Formidable Form.
Formidable Forms is the best WordPress Form Builder plugin. Get it for free!
Step 1: Create your SendinBlue API Key
- If you don’t have an account, create a new SendinBlue account.
- Go to the Profile settings and select SMTP & API from the dropdown options.
- Click the Create a new API Key button to generate your API Key.
- Once you have generated your API key, make sure to save a copy of it right away. For security reasons, Sendinblue will not show you this key again.
Step 2: Create your Formidable form
- If you do not already have a Formidable form to collect your leads, create a form.
- Include an Email field, Phone field, or both.
- If you are sending a phone number to Sendinblue, the number must include the country code. e.g. 91xxxxxxxxxx, +91xxxxxxxxxx, 0091xxxxxxxxxx.
Step 3: Setup your API form action
- In your form Settings → Actions & Notifications, select the Send API data action. If you have not installed the Form Webhooks API add-on yet, you will be prompted to install it.
- To add the notification URL, paste https://api.sendinblue.com/v3/contacts/ in the Notification URL box.
- Leave the basic Auth field empty. We will be using another Formidable hook to add our API Keys to the header.
- Set the Data Format to Raw.
- Set the Method to Post.
- Under Raw Data, add the formatted data below.
{ "updateEnabled": true, //Set this to true if you want to enable update for existing data "email": "[190]", //Replace 190 with the ID of your email field in the form "emailBlacklisted": false, //Set this to true to blacklist the contact for emails (default is false) "smsBlacklisted": false, //Set this to true to blacklist the contact for SMS (default is false) "attributes": { "FIRSTNAME": "[200]", //Replace 200 with the ID of the first name field in your form "LASTNAME": "[210]", //Replace 210 with the ID of the last name field in your form "SMS": "[220]" //Replace 220 with the ID of the Phone number field in your form }, "listIds": [4] //Replace 4 with the ID of your SendinBlue contact list, or add comma separated values i.e. 4,6,8 }
- Add your API Keys to the request header using the code snippet below. Learn more about where to put this code.
add_filter( 'frm_api_request_args', 'my_custom_frm_api_request_header', 10, 2 ); function my_custom_frm_api_request_header( $arg_array, $args ) { if ( $args['url'] == 'https://api.sendinblue.com/v3/contacts/' ) { // the full url where the request is being sent $arg_array['headers']['api-key'] = 'Your-API-Key-Here'; //Replace Your-API-Key-Here with your Sendinblue API key } return $arg_array; }
- You are all set! Go ahead and submit an entry in your form to add a new contact to your Sendinblue list.