User Guide

Sending Airtime Automatically

Last Updated: Jul 16, 2015 01:58PM PDT
Telerivet makes it easy to send airtime automatically in response to an incoming message as part of a poll/survey or other automated service, or via an API.

Sending Airtime from Polls and Rules Engine

The “Send airtime” action can be added within a poll or a Rules Engine service to send airtime in response to an incoming message.

To send airtime as a reward for completing a poll or survey, click "Add action for all responses" in your last question, then click "More actions...", then "Send airtime".

Because each mobile network offers different airtime products, you must specify which airtime value to send for each mobile network you want to support:



Each “Send airtime” rule also acts like an if/then condition which is “true” if the contact is on one of your supported mobile networks, and “false” if the contact is on a different mobile network. This way, you can perform other actions such as sending a SMS message telling the contact that they should (or shouldn't) expect to receive airtime:



Be careful -- when adding a “Send airtime” action, you are essentially letting anyone take money from you, simply by sending an SMS! There is no way to “undo” an airtime transfer or get a refund from Telerivet for airtime transfers, even if someone abuses an automated “Send airtime” action.

We highly recommend that you prevent contacts from triggering a “Send airtime” action multiple times.When creating an SMS poll with a “Send airtime” action, make sure that your poll settings only allow one response from each contact:


When using a “Send airtime” action in the Rules Engine, you can also add the contact to a group, and only trigger the “Send airtime” action if the contact is not yet in the group.

If you want to avoid the risk of sending airtime automatically, you can use the Approval Rules to set your daily limit to $0. Then, one of your project administrators could simply approve all airtime transfers before they get sent out.

Sending Airtime via Cloud Script API

Telerivet’s Cloud Script API doesn't have an API method specifically for sending airtime. However, you can use the generic service.invoke method to trigger a “Send airtime” action created via the Rules Engine.

On the Services page, add a Rules Engine service, and click “When manually triggered for a contact”. Then, add a “Send airtime” action with each of the mobile networks you want to support, and the amount of airtime you want to send.

After saving the service, get the ID of the service from the address bar (it starts with “SV”).

Then, in a separate Cloud Script API service, you can trigger the send airtime action like so:

var SERVICE_ID = "<ID of Rules Engine service with Send airtime rule>";
var airtimeService = project.getServiceById(SERVICE_ID);
airtimeService.invoke({
    context: 'contact',
    contact_id: contact.id
});

Sending Airtime via the REST API

Like the Cloud Script API, Telerivet’s REST API doesn't have an API method specifically for sending airtime, so instead you can invoke a service created via the Rules Engine containing a “Send airtime” action:

curl -s -u YOUR_API_KEY: \
 "https://api.telerivet.com/v1/projects/PROJECT_ID/services/SERVICE_ID/invoke" \
 -H "Content-Type: application/json" \
 -d '{
    "context": "contact",
    "contact_id": "CONTACT_ID"
  }'


Contact Us

http://assets0.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete