Sign inSign up

vorteil/twilio

By vorteil

Updated about 5 years ago

An app that takes twilio tokens to send sms's and emails

Image
0

1.9K

vorteil/twilio repository overview

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: vorteil/twilio:v2
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: "[email protected]"
  to: "[email protected]"   
  • 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"
}

Tag summary

Content type

Image

Digest

Size

2.3 MB

Last updated

about 5 years ago

docker pull vorteil/twilio