How to create a call me form with Laravel to send lead to Vicidial

Prerequisites
  • php installed (version 8+)

  • composer installed (version 2.5+)

  • Vicidial installed or vicidial server

  • Create a new Larevel projectTo create a new Laravel project, we will use the Laravel CLIThis will take a while, but the final output should be something like this:Now step into the project folder:
    In the terminal, run the following command:And you should see something like this:We will need a package to connect Laravel and vicidial, and for this, we will use masterfermin02/vicidial-api-wrapper:Now we are ready to start coding.Code the applicationThere are two steps to code the application:
  • Config the Vicidial API connection.

  • Create the web form on our Laravel app.

  • Vicidial configurationWe recommend creating an API user only on the Vicidial server:The user must have access to modify the list:Now we need to update our .env file with the Vicidial config.Replace the information between {} with your Vicidial data.Creating the Vicidial web formFirst, we will need to create a Vicidial controller:Now we need to map our controller on the route open this file:
    routes/web.phpAnd add this code:Go to your controller and add this code:The index method will be called when the user goes to this URL `/` we will need to create this view `pages.vicidial.admin.lead` on the resources folder:
  • Create pages, vicidial, and admin folders.

  • Create a file named lead.blade.php

  • Open this gist to see the HTML you must use in lead.blade.php:GistGo to your browser `/`, and you should be able to see the following:Now fill on the information, click on save, and then you should be able to see the lead on Vicidial on list 999 by default. If you want to store it on another list, you must specify.You can download the full version of this code from the GitHub repository:https://github.com/masterfermin02/callme-example-for-vicidialConclusionIn this post, we learn how to create a Laravel app, create a controller and its route, configure the Vicidial API user only, and use the vicidial-api-wrapper to send leads to a Vicidial server.

    Login

    To leave a reaction, you need to log in.

    Comments

    Michael Gough