twilio

command module
v0.0.0-...-8835833 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README


{ "image": "direktiv/twilio", "desc": "Sends an email or SMS message using Twilio." }

Twilio

Sends an email or SMS message using Twilio.

Direktiv

An example workflow of using the container in a workflow on Direktiv.

id: send-approval
functions:
- id: send
  image: direktiv/twilio:v1
description: "Sends a sms to provided number" 
states:
- id: fire
  type: action
  action:
    secrets: ["TWILIO_TOKEN", "TWILIO_SID", "TWILIO_PROVIDED_NUMBER"]
    function: send
    input:
      typeof: "sms"
      sid: jq(.secrets.TWILIO_SID)
      token: jq(.secrets.TWILIO_TOKEN)
      message: "A fun SMS message!"
      from: jq(.secrets.TWILIO_PROVIDED_NUMBER)
      to: jq("+" + (.number|tostring))

Input

Email

  • Generate a token here.
  • Use the following input object, substituting the values of the token, to, and from fields appropriately.
  • Adding debug to the json struct will output more of the application.
input:
  typeof: "email"
  token: "TOKEN_STRING"
  subject: "Subject Header of Email"
  message: "Normal string message"
  htmlMessage: "<html><body><h5>HI</h5></body></html"
  from: "FROM@EXAMPLE.COM"
  to: "TO@EXAMPLE.COM"   
  • To send a basic (plaintext) message, populate the message field and ensure that htmlMessage is unused. In the event that both message and htmlMessage are populated, the htmlMessage takes precedence.

SMS

  • Acquire your Twilio SID, token, and 'from' number.
input:
  typeof: "sms"
  sid: "TWILIO_SID"
  token: "TWILIO_TOKEN"
  message: "RECIPIENT_NAME"
  from: "TWILIO_FROM_NUM"
  to: "RECIPIENT_NUM"

Output

No output is returned upon success. In the case that an error is encountered, it will present in the following format:

{
    "errorCode" : "com.request.error",
    "errorMsg"  : "Something went wrong"
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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