SMS API

Share text and picture messages using the programming language you prefer.

Enter your phone number and receive an SMS

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

What’s Happening   |    Technical Version

When you click “Send SMS”, a request is sent to FONE API to deliver an SMS to the provided phone number. The server logic determines the weather forecast to San Francisco and sends a related message and graphic to the phone number.

Note that picture messages outside of US and Canada will be delivered as a hyperlink

1
2
3
4
5
6
7
8
9
10
11
12
php
// this line loads the library
require('/path/to/foneapi-php/Services/foneapi.php');
$account_sid = 'AC5ef872f6da5a21de157d80997a64bd33';
$auth_token = '[AuthToken]';
$client = new Services_foneapi($account_sid, $auth_token);
$client->account->messages->create(array(
 'To' => "+16518675309",
 'From' => "+14158141829",
 'Body' => "Tomorrow's forecast in Financial District, San Francisco is Clear.",
 'MediaUrl' => "https://climacons.herokuapp.com/clear.png",
));
1
2
3
4
5
6
7
8
9
10
11
12
13
// foneapi Credentials
var accountSid = 'AC5ef872f6da5a21de157d80997a64bd33';
var authToken = '[AuthToken]';
//require the foneapi module and create a REST client
var client = require('foneapi')(accountSid, authToken);
client.messages.create({
 to: "+16518675309",
 from: "+14158141829",
 body: "Tomorrow's forecast in Financial District, San Francisco is Clear.",
 mediaUrl: "https://climacons.herokuapp.com/clear.png",
}, function(err, message) {
 console.log(message.sid);
});
1
2
3
4
5
6
7
8
9
10
11
from foneapiML.rest import foneapiMLRestClient
# put your own credentials here
ACCOUNT_SID = "AC5ef872f6da5a21de157d80997a64bd33"
AUTH_TOKEN = "[AuthToken]"
client = foneapiMLRestClient(ACCOUNT_SID, AUTH_TOKEN)
client.messages.create(
 to="+16518675309",
 from_="+14158141829",
 body="Tomorrow's forecast in Financial District, San Francisco is Clear.",  media_url="https://climacons.herokuapp.com/clear.png",
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'foneapiML-ruby'
# put your own credentials here
account_sid = 'AC5ef872f6da5a21de157d80997a64bd33'
auth_token = '[AuthToken]'
# set up a client to talk to the foneapi REST API
@client = foneapi::REST::Client.new account_sid, auth_token
@client.account.messages.create({
 :from => '+14158141829',
 :to => '+16518675309',
 :body => 'Tomorrow\'s forecast in Financial District, San Francisco is Clear.',
 :media_url => 'https://climacons.herokuapp.com/clear.png'
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// You may want to be more specific in your imports
import java.util.*;
import com.foneapi.sdk.*;
import com.foneapi.sdk.resource.factory.*;
import com.foneapi.sdk.resource.instance.*;
import com.foneapiML.sdk.resource.list.*;
public class foneapiMLTest {
// Find your Account Sid and Token at foneapi.com/user/account
public static final String ACCOUNT_SID = "AC5ef872f6da5a21de157d80997a64bd33";
public static final String AUTH_TOKEN = "[AuthToken]";
public static void main(String[]args) throws
foneapiMLRestException {  foneapiMLRestClient client = new foneapiMLRestClient(ACCOUNT_SID, AUTH_TOKEN);
  // Build the parameters
  List<namevaluepair> params = </namevaluepair>new ArrayList<namevaluepair>();</namevaluepair>
  params.add(new BasicNameValuePair("To", "+16518675309"));
  params.add(new BasicNameValuePair("From", "+14158141829"));
  params.add(new BasicNameValuePair("Body", "Tomorrow's forecast in Financial District, San Francisco is Clear."));
  params.add(new BasicNameValuePair("MediaUrl", "https://climacons.herokuapp.com/clear.png"));
  MessageFactory messageFactory = client.getAccount().getMessageFactory();
  Message message = messageFactory.create(params);
  System.out.println(message.getSid());
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// You may want to be more specific in your imports
import java.util.*;
import com.foneapiML.sdk.*;
import com.foneapiML.sdk.resource.factory.*;
import com.foneapiML.sdk.resource.instance.*;
import com.foneapiML.sdk.resource.list.*;
public class foneapiMLTest {
// Find your Account Sid and Token at foneapi.com/user/account
public static final String ACCOUNT_SID = "AC5ef872f6da5a21de157d80997a64bd33";
public static final String AUTH_TOKEN = "[AuthToken]";
public static void main(String[]args) throws
foneapiMLRestException {  foneapiMLRestClient client = new foneapiMLRestClient(ACCOUNT_SID, AUTH_TOKEN);
  // Build the parameters
  List<namevaluepair> params = </namevaluepair>new ArrayList<namevaluepair>();</namevaluepair>
  params.add(new BasicNameValuePair("To", "+16518675309"));
  params.add(new BasicNameValuePair("From", "+14158141829"));
  params.add(new BasicNameValuePair("Body", "Tomorrow's forecast in Financial District, San Francisco is Clear."));
  params.add(new BasicNameValuePair("MediaUrl", "https://climacons.herokuapp.com/clear.png"));
  MessageFactory messageFactory = client.getAccount().getMessageFactory();
  Message message = messageFactory.create(params);
  System.out.println(message.getSid());
}
}
DYNAMIC API PRIMITIVES

Via custom app logic

Get your app to define custom logic for each response using webhooks. Develop just about any workflow you can think of!

Share pictures using

Share something interesting by sending and receiving pictures on all phone numbers in the U.S. and Canada.

Actual status webhooks

View each step that your message takes as it travels the international telecom network

See examples of
SMS Use Cases

THE FONE API EDGE

Redundancy

Automated failover ensures that you have 99.95% uptime SLA without the need for a maintenance window.

Scalability

Use existing apps to new markets by configuring features for compliance and localization.

Multi-channel

Use a single platform for voice, SMS, video, authentication, chat and more.

Without hassles

Get free support, have the freedom to scale your business, market faster with pay-as-you-go.

Create your Account to Start Building
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.