Notify API
Send notifications via SMS, push, messaging apps, and more.
  • Create a binding

    A binding ties a notification address to a user. For example, Bob’s Android phone push registration or Sue’s mobile phone number.

    Request access
    • Curl
    • Ruby
    • Python
    • Java
    curl -XPOST https://notifications.twilio.com/v1/Services/ISxxx/Bindings \
    		-d "Endpoint=xxx" \
    		-d "Identity=bob" \
    		-d "BindingType=gcm" \
    		-d "Address=xxx" \
    		-d "Tag=premium" \
    		-d "Tag=new user" \
    		-u '{twilio account sid}:{twilio auth token}'
    require 'twilio-ruby'
    
    	# Twilio credentials and service SID
    	account_sid = 'AC421124bfab3052ad108f3e8c7a119cfb'
    	auth_token = 'AUTH_TOKEN'
    	notify_service_sid = 'IS13c4cce46710eb656ffffdef2c82c589'
    
    	# Initialize the client
    	client = Twilio::REST::Client.new(account_sid, auth_token)
    	service = client.notifications.v1.services(notify_service_sid)
    
    	# Create a binding
    	binding = service.bindings.create(
    		endpoint: 'AliceDevice', identity: 'Alice', binding_type: 'apn',
    		address: 'FE66489F304DC75B8D6E9200DFF8A456E8DAEACEC428B427E9518741C92C6660')
    from twilio.rest import Client
    
    	# Twilio credentials and service SID
    	account_sid = 'AC421124bfab3052ad108f3e8c7a119cfb'
    	auth_token = 'AUTH_TOKEN'
    	notify_service_sid = 'IS13c4cce46710eb656ffffdef2c82c589'
    
    	# Initialize the client
    	client = Client(account_sid, auth_token)
    	service = client.notifications.v1.services(notify_service_sid)
    
    	# Create the binding
    	binding = service.bindings.create(
    	  endpoint='AliceDevice', identity='Alice', binding_type='apn',
    	  address='FE66489F304DC75B8D6E9200DFF8A456E8DAEACEC428B427E9518741C92C6660')
    	
    import com.twilio.sdk.Twilio;
    	import com.twilio.sdk.creator.notifications.v1.service.BindingCreator;
    
    	public class CreateBinding {
    
    		// Twilio credentials and service SID
    		public static final String ACCOUNT_SID = "AC421124bfab3052ad108f3e8c7a119cfb";
    		public static final String AUTH_TOKEN = "AUTH_TOKEN";
    		public static final String NOTIFY_SERVICE_SID = "IS13c4cce46710eb656ffffdef2c82c589";
    
    		public static void main(String[] args) {
    			Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
    
    			// Create the binding
    			BindingCreator notification = new BindingCreator(
    			NOTIFY_SERVICE_SID, "Alice",
    			"AliceDevice", Binding.BindingType.APN,
    			"FE66489F304DC75B8D6E9200DFF8A456E8DAEACEC428B427E9518741C92C6660");
    			System.out.println(notification.execute());
    		}
    	}
  • Upload push credentials

    Credentials allow Twilio to send push notifications on your behalf. They can be uploaded through the portal or programmatically via REST.

    Request access
    • Curl
    Create GCM Credentials
    	curl -XPOST https://notifications.twilio.com/v1/Credentials \
    	  -d "FriendlyName=MyGCMCredential" \
    	  -d "Type=gcm" \
    	  -d "ApiKey=xxx" \
    	  -u '{twilio account sid}:{twilio auth token}'
    
    	Create APN Credentials
    	curl -XPOST https://notifications.twilio.com/v1/Credentials \
    		-d "FriendlyName=MyAPNCredential" \
    		-d "Type=apn" \
    		--data-urlencode Certificate@cert.pem \
    		--data-urlencode PrivateKey@key.pem \
    		-d "Sandbox=true" \
    		-u '{twilio account sid}:{twilio auth token}'
  • Send a notification

    Specify a user identity, and Twilio will send to their active bindings. Custom content can be specified for different transports.

    Request access
    • Curl
    • Ruby
    • Python
    • Java
    Send Notification
    	curl -X POST https://notifications.twilio.com/v1/Services/ISxxx/Notifications \
    	  -d 'Identity=Bob' \
    	  -d 'Title=Generic loooooooong title for all Bindings' \
    	  -d 'Body=This is the body for all Bindings' \
    	  -d 'Gcm={"notification":{"tag":"MyTag"}}'
    	  -d 'Apn={"aps":{"title":"Short title for iWatch."}}'
    	  -u '{twilio account sid}:{twilio auth token}'
    require 'twilio-ruby'
    
    	# Twilio credentials and service SID
    	account_sid = 'AC421124bfab3052ad108f3e8c7a119cfb'
    	auth_token = 'AUTH_TOKEN'
    	notify_service_sid = 'IS13c4cce46710eb656ffffdef2c82c589'
    
    	# Initialize the client
    	client = Twilio::REST::Client.new(account_sid, auth_token)
    	service = client.notifications.v1.services(notify_service_sid)
    
    	# Send a notification
    	notification = service.notifications.create(
    	  identity: 'Alice', body: 'Hello there!')
    from twilio.rest import Client
    
    	# Twilio credentials and service SID
    	account_sid = 'AC421124bfab3052ad108f3e8c7a119cfb'
    	auth_token = 'AUTH_TOKEN'
    	notify_service_sid = 'IS13c4cce46710eb656ffffdef2c82c589'
    
    	# Initialize the client
    	client = Client(account_sid, auth_token)
    	service = client.notifications.v1.services(notify_service_sid)
    
    	# Send the notification
    	notification = service.notifications.create(
    		identity='Alice', body='Hello there!')
    import com.twilio.sdk.creator.notifications.v1.service.NotificationCreator;
    	import com.twilio.sdk.Twilio;
    
    	public class SendNotification  {
    
    		// Twilio credentials and service SID
    	  public static final String ACCOUNT_SID = "AC421124bfab3052ad108f3e8c7a119cfb";
    	  public static final String AUTH_TOKEN = "AUTH_TOKEN";
    	  public static final String NOTIFY_SERVICE_SID = "IS13c4cce46710eb656ffffdef2c82c589";
    
    	  public static void main(String[] args) {
    	    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
    
    	    // Send the notification
    		NotificationCreator notification = new NotificationCreator(NOTIFY_SERVICE_SID);
    	    notification.setIdentity("Alice");
    	    notification.setBody("Hello there!");
    	    System.out.println(notification.execute());
    	  }
    	}
Notify SDK
Add Notify to your mobile and web apps for enhanced capabilities like notifying the last active device and receiving confirmations for message delivery.
  • Register for push notifications

    Simplify push registration and token management with Twilio Notify SDKs.

    Request access
    • Objective-C
    - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
    	    [self.notifyClient registerWithToken:deviceToken];
    	}
  • Delivery receipt

    Capture events when push notifications are delivered. Programmatically adjust logic based on delivery success.

    Request access
    • Objective-C
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
    
    	    [self.notifyClient delivered:userInfo]
    
    	    if (completionHandler) {
    	        completionHandler();
    	    }
    	}
  • Acknowledgement

    Capture events when a user acknowledges a push notification. Programmatically adjust logic based on their response.

    Request access
    • Objective-C
    - (void)application:(UIApplication *)application
    	handleActionWithIdentifier:(NSString *)identifier
    	forRemoteNotification:(NSDictionary *)userInfo
    	  completionHandler:(void (^)(void))completionHandler {
    
    	    if ([identifier isEqualToString: @"acknowledge"]){
    	        [self.notifyClient acknowledged:userInfo]
    	    }
    
    	    if (completionHandler) {
    	        completionHandler();
    	    }
    	}
The Twilio advantage
  • Communicate reliably

    Experience a 99.95% uptime SLA made possible with automated failover and zero-maintenance windows.

  • Operate at scale

    Extend the same app you write once to new markets with configurable features for localization and compliance.

  • Many channels

    Use the same platform you know for voice, SMS, video, chat, two-factor authentication, and more.

  • No shenanigans

    Get to market faster with pay-as-you-go pricing, free support, and the freedom to scale up or down without contracts.