Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now
Build the future of communications.
Start building for free
  • By Michael Okoko
    Build an Urban Dictionary Chatbot in PHP with Bref and the Twilio API for WhatsApp Build an Urban Dictionary Chatbot in PHP with Bref

    Internet slang evolves so rapidly that it’s easy to get lost in communication while texting without the help of linguistic services like Urban Dictionary. Wouldn’t it be great if you could easily query new colloquialisms on the go?

    In this tutorial, we will build a handy WhatsApp bot that gives us the Urban Dictionary definition of words. It will leverage the Twilio API for WhatsApp and the Urban Dictionary API to find and provide the definitions we need, on demand.

    Prerequisites

    In order to follow along with this tutorial, you will need the following:

    Get Started

    If you are using a UNIX or Mac OS system, create and enter into the project folder …

    Read More
  • By Michael Okoko
    Handling Cross-Origin Resource Sharing (CORS) Requests in Laravel 7 Handling Cross-Origin Resource Sharing (CORS) Requests in Laravel 7

    By default, browsers implement a same-origin policy that prevents scripts from making HTTP requests across different domains. Cross-Origin Resource Sharing (CORS for short) provides a mechanism through which browsers and server-side applications can agree on requests that are allowed or restricted.

    From version 7, the Laravel framework comes with first-party support for sending CORS headers using Middlewares

    In this tutorial, we'll be building a simple Vue.js app powered by Laravel to learn about CORS. We will take a deep-dive into the various configuration options needed by Laravel to handle CORS OPTIONS requests and see how some of these options affect our application.

    Prerequisites

    In order to complete this tutorial, you will need the following:

    • Familiarity with the Laravel framework
    • An existing project with Laravel framework version >= 7.0.
    • Vue CLI installed.

    Getting Started  

    Create a new folder to hold both the Laravel API and the Vue project, and create …

    Read More
  • By Michael Okoko
    Process Incoming Emails with Laravel and SendGrid Inbound Parse Process Incoming Emails with Laravel and SendGrid Inbound Parse

    Sending emails from your Laravel app is a common requirement, but sometimes, you want to receive and process the replies programmatically as well. SendGrid lets you process inbound emails with Inbound Parse. Inbound Parse allows you to provide a webhook URL to process all incoming emails for a domain or subdomain. Subdomains are recommended as they don’t affect your regular domain emails.

    In this tutorial, we will be building a blog application where users can comment on a post by replying to a transaction email.

    Prerequisites

    To complete this tutorial, you will need:

    Create Migrations and Models

    To get started, create a new Laravel project in your preferred location (I am naming mine sg-inbound), switch to …

    Read More
  • By Michael Okoko
    Verify Phone Numbers with Bref PHP and Twilio Verify Verify Phone Numbers with Bref PHP and Twilio Verify.png

    Bref is a composer package that helps you deploy your PHP applications as AWS Lambda functions. It leverages the Serverless Framework to provision and deploy such applications, and provides support for common frameworks like Laravel, Symfony, and Slim PHP.

    In a previous article, we explored how we can use the Bref PHP framework to forward errors from our Twilio application to a Slack channel. In this article, we will revisit Bref by building a service that verifies users’ phone numbers using the Twilio Verify API.

    Prerequisites

    To complete this tutorial, you will need:

    Create a Twilio Verify Service

    To get started, head over to your Twilio Verify Console and create a new Verify Service. Take …

    Read More
  • By Michael Okoko
    Forward Twilio Application Errors to Slack with Bref PHP Forward Twilio Application Errors to Slack with Bref PHP

    Serverless applications are applications that are built, deployed, and then executed on-demand. The servers on which they run are provided by the cloud platform to which they are deployed, and the developer only needs to focus on writing the code.

    The on-demand aspect ensures that the developer is only charged for execution time, as opposed to being charged for a fixed amount of bandwidth or a specific number of servers.

    Bref is an open-sourced project that lets you create and deploy serverless applications, called functions, to AWS Lambda using PHP. It integrates with the Serverless Framework which abstracts the operations involved in deploying and monitoring such applications.

    In this tutorial, you will be building a webhook for the Twilio Console Debugger that gets triggered when there is an error with (any of) your Twilio application(s) and send the payload to Slack.

    Prerequisites

    To follow along, you will need:

    • PHP 7.2 …
    Read More
  • By Michael Okoko
    Progressive Website App Notifications with Laravel, Vue.js, and Twilio Notify Progressive Website App Notifications with Laravel, Vue.js, and Twilio Notify

    Progressive Web Applications (PWAs) are installable websites that provide an app-like experience for your users. They are made possible through technologies like Service Workers and responsive designs, which enable them to provide nearly the same user experience as native applications.

    The Twilio Notify API enables you to send notifications to your users across different channels - Web, SMS, Android, and iOS - using a single API.

    In this article, we will be building a recipe PWA with Laravel and Vue.js, with the ability to notify our users when a new post is available using the Twilio Notify API.

    Prerequisites

    To get started with this tutorial you will need the following dependencies:

    Read More
  • By Michael Okoko
    Build Your Own API Analytics in Vue.js with PHP, Laravel, and Twilio Sync Build Your Own API Analytics in Vue.js with PHP, Laravel, and Twilio Sync

    Twilio Sync is a service provided by Twilio that helps you keep your application state in sync across different services. Specifically, it provides a “stack-agnostic” API that helps you add real-time capabilities to your application.

    In this article, we will explore how we can build a custom real-time API analytics tool powered by Sync Lists, a Sync primitive type that helps us synchronize individual JSON objects.

    NOTE: You can learn more about Sync Lists and other primitives from the Twilio Sync Object Overview.

    Prerequisites

    To complete this tutorial you will need the following:

    Creating the Sample Application

    We will generate a fresh application with the Laravel installer and enter into the project directory with:

    $ laravel …
    Read More
  • By Michael Okoko
    Send Recurring Emails in PHP with SendGrid and Laravel 7 Task Scheduler Send Recurring Emails with SendGrid and Laravel 7 Task Scheduler

    Occasionally, your application needs to perform some routine tasks in timed intervals such as sending out weekly reports to an administrator or sending monthly updates to your users.

    Traditionally, such routine tasks are carried out via individual cron jobs that trigger a shell script or the part of the code to be executed. As the application grows and the number of tasks we need to run increases, cron jobs quickly become difficult to maintain, especially as they don’t come with error reporting/handling features and they can’t be placed in a Version Control System such as Git.

    The Laravel Task Scheduler allows us to define our tasks as code while leveraging all of the logging and error handling features available in the framework. With the scheduler, we only need to define a single cron entry that executes the schedule at an interval.

    What are we Building?

    In this tutorial, we …

    Read More
  • By Michael Okoko
    Send PDF Invoices via WhatsApp using Laravel, PHP, Stripe, and the Twilio API for WhatsApp Generate and Send PDF Invoices via WhatsApp using Laravel, PHP, Stripe, and the Twilio API for WhatsApp

    Stripe is a payment gateway that provides developer APIs to help you receive payments from your application/website.

    The Twilio API for WhatsApp provides a platform that helps you send any type of business message via WhatsApp through a streamlined API.

    In this tutorial, we will be exploring how to send payment invoices and notifications to our users via WhatsApp when they make payments on our website.

    Pre-requisites

    To follow along with this post, you will need the following:

    Getting Started

    To get started, create a new Laravel application and assign the folder name.

    $ laravel new twilio-commerce && cd twilio-commerce
    

    Next, install our application dependencies using composer. These dependencies include the Twilio SDK and the Stripe PHP library (to …

    Read More
  • By Michael Okoko
    Improving PHP Code Quality with PHP CodeSniffer Improving PHP Code Quality with PHP CodeSniffer

    As a project grows, it becomes necessary to maintain and enforce some defined standards for the code. Such standards help achieve uniformity, readability, and maintainability, irrespective of the engineer that wrote the code. For a PHP project, one of the best ways to enforce such standards is PHP_CodeSniffer (or PHPCS for short).

    PHPCS is a tool that helps detect violations of pre-defined coding standards. It also includes an additional tool that can automatically correct those violations.

    Prerequisites

    To complete this tutorial you will only need Composer globally installed.

    About the project

    PHPCS is framework-agnostic, but for simplicity, we will be using it with a simple Laravel project. The project, called “Twilio Greeter”, displays a list of common greetings depending on the language chosen by the user. You can view the complete source code here.

    The project files that are of interest to us are:

    • PROJECT_ROOT/app/Http/Controllers/WelcomeController.php: Our main controller …
    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.