Twilio module written using the Go language.
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
.
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",
});
Name | Description |
---|---|
call | Make a Voice call. |
message (SMS) | Sent a SMS message |
message (WhatsApp) | Sent a WhatsApp message |
Syntax: call(params)
params
: (thing) Params to use for the voice call.
// 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
});
Syntax: message(params)
params
: (thing) Params to use for the voice call.
// 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
});
Syntax: message(params)
params
: (thing) Params to use for the voice call.
// 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
});