Axway API Builder Twilio Connector – Getting Started

Twilio is a developer platform for communications. Software teams use Twilio API to add capabilities like voice, video, and messaging to their applications. For example, if you’d like to add SMS-based two-factor authentication to your application, you may use Twilio to send SMS.

In a prior blog post, Adam Armstrong described a Titanium library for incorporating Twilio SMS into a Titanium cross-device mobile app.

In this blog post, we describe how to use the API Builder Twilio Connector in an API Builder project.

How to Setup

  • Setup an account at Twilio
  • Install the Axway API Builder Twilio connector in your project

    appc install connector/appc.twilio
  • Configure connector by editing /conf/appc.twilio.default.js. Here is mine:

    module.exports = {
      connectors: {
        'appc.twilio': {
          sid: '',
          auth_token: '',
          twilio_number: '',
          generateModels: ['message'],
          modelAutogen: true,
          generateModelsFromSchema: true,
          skipModelNamespace: false,
          twilioWelcomeVoiceURL: ''

    Since I only want to use Twilio for SMS, I selected the message object in the property generateModels. If I don’t include this connector configuration parameter, then I will expose all the Twilio services such as: account, address, application, call, message, …

    Also, I set modelAutogen to true to autogenerate an API for the message model.

Test Twilio by Sending an SMS

  • Run your project:
    app run
  • Click on the API tab on the API Builder admin console at https://localhost:8080/console
  • Click on the API appc.twilio/message and click on POST and enter a number to send an SMS to in the to field and enter a message in the body field. There are the only required fields.
  • You should receive an SMS at the number provided

At this point everything, is working. You can now create reduced, extended, composite models based on the appc.twilio/message model as well as access it programmatically in your API Builder blocks and custom APIs.

For example, a reduced model based on the appc.twilio/message model is shown below:

var Arrow = require('arrow');
var Model = Arrow.createModel('sms', {
    "fields": {
        "to": {
            "type": "string",
            "required": true,
            "description": "The phone number that received the message in E.164 format.",
            "model": "appc.twilio/message",
            "name": "to"
        "body": {
            "type": "string",
            "required": true,
            "description": "The text body of the message. Up to 1600 characters long.",
            "model": "appc.twilio/message",
            "name": "body"
    "connector": "appc.composite",
    "actions": [
    "singular": "sm",
    "description": "Send SMS"
module.exports = Model;

I can access this model programmatically in a block or custom API as follows:

var model = Arrow.getModel("sms");
model.create({to: '+16176428274', body: 'test sms' }, function(err, data){
  if(err) {

Useful Links