Custom Server Extension - Twilio SMS (PHP/node)

Introduction

i actually wrote the node version of this at the same time as the my published Onesignal extension two years ago but for some reason never actually published it.

In todays (14th August 2026) Wappler monthly meetup we discussed SMS and 2FA which reminded me i had never actually published this.
So i have added a PHP version and here it is.

Installation

Via Wappler

I strongly recommend installing extensions using the Wappler extension installer or dependencies may be missed.

Via NPM

The npm is here

The Extension

https://www.npmjs.com/package/@hyperbytes/twilio-sms
The Extension can be found in the new "Notification Modules" group

Creating a Twilio account

Firstly you need to create a Twilio account, add some credit and purchase a Twilio number.
Prices vary dependent on the number but generally the cost is around $1/ euro

Adding Credentials

Once you have your account you need to retrieve your account details from your dashboard. YOU will need your Account SID, Auth Token and a Twilio phone number

Once you have then they need to be stored as ENV variables via workflows settings

Using the extension

now create an API action and add the extension and add data to the fields.

The extension returns data as to the message sent.

tsms: {
sid: "SMc0c68f23f2faeaad184a6cb8c91d8003",
status: "queued",
to: "+447780999999",
from: "+447723999999",
body: "Hello World",
numSegments: "1",
direction: "outbound-api",
dateCreated: "2026-08-14T19:28:32+0000",
dateSent: null,
dateUpdated: "2026-08-14T19:28:32+0000",
price: null,
priceUnit: "USD",
errorCode: null,
errorMessage: null,
accountSid: "AC09ed370628f6416a5fb398174d8e8750",
messagingServiceSid: null,
uri: "/2010-04-01/Accounts/AC09ed370628f6416a5fb398174d8e8750/Messages/SMc0c68f23f2faeaad184a6cb8c91d8003.json",
apiVersion: "2010-04-01",
numMedia: "0",
subresourceUris: {
media: "/2010-04-01/Accounts/AC09ed370628f6416a5fb398174d8e8750/Messages/SMc0c68f23f2faeaad184a6cb8c91d8003/Media.json"
}
}
}

PLEASE NOTE
The php version was written about 30 minutes ago and has only had basic testing. Any issues let me know.

2 Likes

Detected an issue with PHP version where the twilio sdk in not being auto installed.
Working on a fix but temporarily you can

  1. open terminal

  2. select your web root (IMPORTANT)

cd www

  1. Manually install the Twilio dependency

composer require twilio/sdk

Great extension Brian, I must've missed the Node one. I'll use the Node version in my next SMS stuff.

Im starting to use SMS a lot more now even for my own site admin stuff, its working out way faster than emails. So, this extension will save time during st up instead of manually creating the API action each time it needs to be used.

@sitestreet Bet Jon loves this one :slight_smile:

1 Like

Do you mean the Composer Fossil? :rofl:

3 Likes

@ben, you any ideas, should this not force install of the appropriate sdk on installation when added to .hjson file?

  usedModules: {
    node: {
      "twilio": "^5.3.5"
    },
    php: {
    "twilio/sdk": "^8.0"
  }
  },

Brian, from what I’ve seen, adding the module to usedModules should normally trigger the dependency install, but it doesn’t always behave consistently with PHP packages or with Docker. Node tends to be more reliable in that regard. So yes, your expectation is correct, but the installer may not be picking it up. A manual composer require is a solid workaround until the extension installer gets updated

Thanks Ben, at least i am not going crazy.
Another side effect is even if a manual install is undertaken, wappler does not seem to install the dependencies on the server if you use publish and the vendor file needs to be manually uploaded.
This may be my last php extension, spent more time working around php related bugs than creating the extension.

On a positive side, adding webhook support for next release

Not p*ssing on anyone's parade (nice job on the Extension Brian) but needing an SDK to send a simple SMS is a bit absurd... We have found ClickSend to be far better for this requirement and far easier to implement than Twilio. Its API is simple and straight forward with zero complexity. We use it for thousands of SMS messages weekly at very little cost. Why does Twilio need a full blown SDK to do something so simple? What are the benefits?

Simple answer, if you recall from the meeting, i said i had it already but never published it (basically abandoned project) , asked people if they wanted it and they said yes.

Just asking why it needs an SDK is all Brian. Not doubting anyone requiring it.

It was originally a spinoff of a twilio voice based application i developed so using the same SDK seemed the way to go.

Just did a quick bit of research and the SDK is not required to send SMS using the Twilio API Brian so may make things easier for you with regards to your Extension.


Twilio SDK is not required to send SMS messages.

Twilio exposes a standard REST API, so you can make an HTTPS POST request directly to the Messages endpoint. Twilio explicitly supports both approaches: raw HTTP requests and its server-side SDKs.


I have just released v1.0.1 which includes an additional module to check delivery status.
Simply pass the message SID to the module and the current status will be returned.
This is to allow users to check delivery has been successful.

Status codes and explanations can be found here.

@Cheese, if you want to produce an alternative which does not use SDK you are very welcome but i have no inclination to rewrite this.

1 Like

Already offer a ClickSend Extension Brian but thank you none the less.

I'm not here to hijack your Extension just was interested in the SDK issue and why it had arisen is all. Nothing more.