Create a Chatbot for Facebook Messenger with Laravel and PHP

Visit Tutorial Page ( Report)

At the end of this course, you will be able to create your own keyword based chatbots for Facebook Messenger!

Since Facebook Messenger opened their platform for chatbots, many people believe these conversational bots are among the next big things to change how people interact with technology. But how do you build a chatbot? Welcome to Chatbot Academy.

Together, we will build a chatbot called "Twitter Trending Chatbot" that returns currently trending topics for a location the user wants. We will do this step by step with a PHP framework called Laravel, which makes it very easy to prototype and develop your first bot.

In this hands-on course, you will learn:

  • How to use Laravel for PHP to create a new chatbot project
  • How to create a Facebook app and receive messages
  • How to send messages based on a user's input
  • How to respond to keywords with real-time data
  • How to upload and publish your bot

This course is designed for:

  • Developers and marketers with some experience with PHP
  • People who have heard of MVC frameworks like Laravel before
  • People who are excited about learning something new :)

Topics that are not part of this course (yet):

  • Natural Language Processing (for beginners, keyword based solutions are enough to play with)
  • Artificial Intelligence (we are going to create a rules based chatbot)
  • Other platforms like Kik, Telegram, or Slack

Are you ready to build your first bot?

Then sign up now and join Chatbot Academy. It's a lot of fun, we promise :).

  • Introduction
    • Introduction and Course Landscape

      Let's get started! In this lecture, you will learn more about the course content, and how we're going to build a chatbot for Facebook Messenger step by step.

    • Introduction to Laravel

      We are going to use Laravel, a great framework for PHP, to create our chatbot. In this lecture, you will briefly learn what Laravel is about and how to install it.

    • Introduction to Chatbots

      Chatbots are hyped! But why, and what can they do? In this lecture, you will learn some basics about chatbots and why they're so interesting at the moment.

    • Summary

      Enough with the theory! After this lecture, we're getting our hands dirty. Let's build a bot together.

  • Your first bot: "Hello World"
    • Introduction

      In this section, we're going to build our first chatbot for Facebook Messenger. It will just respond with a simple "Hello World" after a conversation is initiated by a user. But it's something!

    • Create a new Laravel project

      To get started, we first need to create a new Laravel project on your computer. Make sure that you have installed Laravel and Composer to be able to complete this task.

    • Make your local server accessible with ngrok

      ngrok is a very helpful tool to make your local files accessible to the outside. We will use this later to communicate with the Facebook API without having to upload our files to a server all the time.

    • Use the Messenger API Package for PHP

      To communicate with the Facebook Messenger API, we're going to use a PHP package by Pimax. In this lecture, you will learn how to use this package in Laravel.

    • Create a Facebook app

      In order to communicate with the Facebook API, we first need to create a Facebook page and app. Let's do this in this lecture.

    • Verify a webhook with the Facebook API

      In this lecture, you will learn how to verify the webhook with the Facebook Messenger API. We will create a MessengerController in our Laravel project and write the necessary code to pass the verification.

    • Receive messages from Facebook users

      Before we send out our first message to a user, we first need to be able to receive messages via the Facebook Messenger API. This is necessary because the first interaction between a user and a page always needs to be initiated by the user. In this lecture, we're creating a POST webhook and looking at incoming messages.

    • Send your first message: Hello World!

      Finally! In this lecture, we're sending out our first message "Hello World" to a user.

    • Summary

      The groundwork is done, now we can proceed to the fun part. In the next section, we are going to create the core functionality of the bot: Communicating with the Twitter API.

    • Bonus: Create a parrot bot

      A little fun exercise: What if we don't want our bot to respond with "Hello World," but rather just copy the user's messages? Let's try it out!

  • Build your bot with real-time data
    • Introduction

      In this section, you will learn how to respond to keywords, communicate with the Twitter Trends API, and return trends for any location the user wants.

    • Respond to simple keywords

      In this lecture, we're making our bot a lot better. Let's bury the "parrot bot" and start making it able to respond to (extendable) commands. After this lecture, you will have a blueprint for a simple, keyword-based chatbot.

    • Get real-time data from Twitter

      To be able to build the core functionality of the bot, we first need to be able to communicate with the Twitter API. In this lecture, you will learn how to install a Twitter API package for Laravel to do exactly that.

    • Return Twitter trends for Berlin

      Almost there! Let's start with Berlin. In this lecture, you will learn how to return currently trending Twitter topics for Berlin in a simple text message.

    • Return Twitter trends for any location

      Finally! In this lecture you will learn how to return trending topics for any location, not only Berlin. This is a great example for a simple keyword and rules-based chatbot.

    • A simple fix for better readability

      In this lecture, you will learn how to get the name of a location with the right use of capital and small letters.

    • Summary

      Congratulations! You just built your first prototype of a keyword-base chatbot!

  • Publish your bot
    • Introduction

      In this lecture, you will learn more about the necessary steps to publish your chatbot.

    • Upload your project to Heroku

      To make our bot publicly available, we need to move away from our localhost + ngrok and upload our code to a server. We will use this by deploying our project to Heroku.

    • Prepare for the Facebook Messenger review

      Facebook has a review process that Messenger bots need to pass, before they are accessible to any Facebook user. In this lecture, you will learn more about the review steps.

    • Summary

      That was it! Any questions? Please let me know in the forum. Happy to help!

Write Your Review

Reviews

atieh mokhtary
atieh mokhtary

Excellent course! 100% recommendable! Very good comprehensive course on how to get started with Facebook Messenger. I found this much more comprehensive and understandable.

0 0 (Report)