Giter Club home page Giter Club logo

smsbot's Introduction

Overview

smsbot is a simple application that periodically generates a message from one of several configured sources and sends that message to a list of recipients using the Twilio API.

Messages are sent at a random time within regular time windows configured by the user. For example, smsbot can be configured to send a message between 9am and 5pm every day.

For more details on smsbot's features, see the Configuration section below.

Getting Started

  1. Install Go and configure $GOPATH

  2. Insall smsbot:

go get -u github.com/reynoldsbd3/smsbot
  1. Copy config-example.json to the current working directory and rename it to config.json, replacing its contents with valid Twilio API credentials

Currently, there is no option to specify the path of config.json. It must be placed in the current working directory.

  1. Run the smsbot command

Features and configuration

smsbot really only does two things: it generates messages and dispatches those messages. Each message is retrieved from a message source that is randomly selected from a pre-configured list of sources. Once a message is generated, it is sent to each configured recipient using the Twilio SMS API.

This process is repeated indefinitely at random times according to smsbot's timing parameters. For example, the configuration might specify sending messages daily at a random time between noon and 9 P.M.

SMS Messages

In order to use smsbot, you must have Twilio API credentials. Access to the SMS API is free (with strings attached). Click here to learn more and sign up for access.

smsbot needs to know your Twilio Account SID and Auth Token as well as the phone number assigned to you by Twilio. These are configured like so in config.json:

{
    ...
    "twilioSid": "XXXXXXXXXXXXXXXX",
    "twilioToken": "XXXXXXXXXXXXXXXX",
    "twilioNumber": "+15551234567",
    ...
}

Each time a message is generated, it is sent to each number configured in the recipients list. Note that if you want only one recipient, the number must still appear in the JSON list within the [...] brackets.

{
    ...
    "recipients": [
        "+15551112222",
        "+15553334444"
    ],
    ...
}

Message Sources

smsbot allows you to configure several message sources. When it's time to generate a message, a random source is selected and used to generate a message.

Message source configuration looks like this:

{
    ...
    "sources": [
        {
            "type": "SOURCE_TYPE",
            "params": {
                ...
            }
        },
        {
            "type": "SOURCE_TYPE",
            "params": {
                ...
            }
        }
    ]
}

There are several types of message source, and each will have a different set of parameters that may be configured.

Static Message Source

A static message source is a simple, static message. Each time the source is selected, it will generate the same message.

{
    ...
    "sources": [
        ...
        {
            "type": "static",
            "params": {
                
                // Actual text of the static message
                "message": "This is the content of the static message",
                
                // Optional URL providing message context
                "url": "http://example.com/"
            }
        },
        ...
    ]
}

Quote Source

A quote source is a message source that uses the They Said So API to retrieve the quote of the day in the specified category.

{
    ...
    "sources": [
        ...
        {
            "type": "quote",
            "params": {
                "category": "art"
            }
        },
        ...
    ]
}

Debug

To keep from using the various API's involved, there is a debug option that causes smsbot to simply print out what it would actually be doing.

{
    ...
    "debug": true,
    ...
}

smsbot's People

Contributors

reynoldsbd3 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.