module-go-twilio

command module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 10 Imported by: 0

README

Twilio ThingsDB Module (Go)

Twilio module written using the Go language.

Installation

Install the module by running the following command in the @thingsdb scope:

new_module("twilio", "github.com/thingsdb/module-go-twilio");

Optionally, you can choose a specific version by adding a @ followed with the release tag. For example: @v0.1.1.

Configuration

The Twilio module requires configuration with the following properties:

Property Type Description
TWILIO_ACCOUNT_SID str (required) Find your Account SID at twilio.com/console.
TWILIO_AUTH_TOKEN str (required) Find your Auth Token twilio.com/console.

Example configuration:

set_module_conf("twilio", {
    TWILIO_ACCOUNT_SID: "REPLACE WITH ACCOUNT_SID",
    TWILIO_AUTH_TOKEN: "REPLACE WITH AUTH_TOKEN",
});

Exposed functions

Name Description
call Make a Voice call.
message (SMS) Sent a SMS message
message (WhatsApp) Sent a WhatsApp message
Voice call

Syntax: call(params)

Arguments
  • params: (thing) Params to use for the voice call.
Example:
// Only subject is required
params = {
    body: 'Hello world!',
    to: '+310612345678',
    from: '+310687654321',
};

// Make the call
twilio.call(params).then(|resp| {
    // you might want to do something with the response, for example resp.Sid.
}).else(|err| {
    err;  // some error has occurred
});
SMS Message

Syntax: message(params)

Arguments
  • params: (thing) Params to use for the voice call.
Example:
// Only subject is required
params = {
    body: 'Hello world!',
    to: '+310612345678',
    from: '+310687654321',
};

// Make the call
twilio.message(params).then(|resp| {
    // you might want to do something with the response, for example resp.Sid.
}).else(|err| {
    err;  // some error has occurred
});
WhatsApp Message

Syntax: message(params)

Arguments
  • params: (thing) Params to use for the voice call.
Example:
// Only subject is required
params = {
    sid: "HXXXXXXXXXXX",
    variables: JSON.stringify({
      1: "coupon_code",
      2: "docs",
      3: "images/library-logo-resource2x.width-1000.png",
    }),
    to: 'whatsapp:+310612345678',
    from: 'whatsapp:+310687654321',
};

// Make the call
twilio.message(params).then(|resp| {
    // you might want to do something with the response, for example resp.Sid.
}).else(|err| {
    err;  // some error has occurred
});

Documentation

Overview

ThingsDB module for using Twilio.

For example:

	// Create the module (@thingsdb scope)
	new_module('twilio', 'github.com/thingsdb/module-go-twilio');

	// Configure the module
  	set_module_conf("twilio", {
        TWILIO_ACCOUNT_SID: "REPLACE WITH ACCOUNT_SID",
        TWILIO_AUTH_TOKEN: "REPLACE WITH AUTH_TOKEN",
  	});

	// Use the module
	twilio.message( {
	    to: "+31 612345678",
	    from: "+31 687654321",
	    body: "sample SMS message",
	}).else(|err| {
	    // error handling....
	}));

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL