This is a package that integrate the web application Letexto API in a laravel application.
You can install the package via composer:
$ composer require juvpengele/laravel-letexto
You must add your API Key in the .env file
.env
LETEXTO_TOKEN=my-api-token
All resources fetched are an instance of Letexto\Http\Response.
-
To fetch all campaigns
use Letexto\Resources\Campaign; $campaigns = Campaign::fetchAll();
-
Filter campaigns to fetch
use Letexto\Resources\Campaign; $campaigns = Campaign::filterBy(['status' => 'sent'])->fetchAll();
-
Create a campaign
To create a campaign, we have to add some attributes that are required by the application using a fluent interface. Here is an example of how a campaign can be sent.
use Letexto\Resources\Campaign; $campaign = Campaign::create(['name' => 'My campaign']) ->withAttributes([ 'sender' => 'John Doe', // Add one of your application senders 'recipientSource' => 'custom', 'campaignType' => 'SIMPLE', 'responseUrl' => 'https://mywebsite.com/campaign-feedback', // Add your response url callback ]) ->to([ ['phone' => '22501010101'] ]) ->withMessage('Hello world') ->send();
-
Messages of a campaign
To get the messages of a campaign, we must first fetch the campaign as an instance of the Campaign class. In this way, we can fetch messages of this campaign.
use Letexto\Resources\Campaign; $campaign = Campaign::find("f9r4gegetg49getg98e49t"); $messages = $campaign->getMessages();
-
To fetch all messages
use Letexto\Resources\Message; $messages = Message::fetchAll();
-
Filter messages to fetch
use Letexto\Resources\Message; $messages = Message::filterBy(['sender' => 'John Doe'])->fetchAll();
-
To fetch statistics of messages
use Letexto\Resources\Message $statistics = Message::getStatistics();
-
We can retrieve the volume of a user.
use Letexto\Resources\Volume; $volume = Volume::retrieve();
The MIT License (MIT). Please see License File for more information.