Providers

How to use Nexmo

Nexmo is one of the providers supported by Delivery API. We are currently only supporting SMS as the type of message that can be delivered via Nexmo.

To add Nexmo as one of your providers in your Delivery API account, two Nexmo identifiers are required:

  1. the Nexmo API key
  2. the Nexmo API secret.

These identifiers can be found in this page once you have logged into your own Nexmo account.

/src/img/providers/Screenshot%20nexmo%20console_details_hidden_600_R1.0.png

The values for the Key and the Secret can be added to your Delivery API account via the console or by using an API call as explained here.

In the next example we will show you how to use the API to add Nexmo as a new provider, considering your key to be ‘examplekey’ and your secret value to be ‘secret’.

$ curl https://api.dapi.io/v1/providers/nexmo \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "API_KEY": "examplekey",
      "API_SECRET": "secret",
    }'

To use your own account, you need to change the values “USER_ID” and “USER_SECRET” into the values of your own account as can be found in the Delivery API console. Also the values for your ‘examplekey’ and ‘secret’ need to be replaced by the values as can be found in your own Nexmo account (as described above).

If everything is successful the API will return a 200 status code. Once Nexmo has been added as one of your providers, you can start sending messages via Delivery API to Nexmo.

The following example is sending a sms message with the text “Congratulations! You send this sms via Delivery API using Nexmo” to the mobile phone ‘+31612345678’.

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "nexmo",
      "type": "sms",
      "arguments": {
        "from": "DeliveryAPI",
        "to": "+31612345678",
        "text": "Congratulations! You send this sms via Delivery API using Nexmo"
      }
    }'

Change the ‘to’ number with your own mobile number, and you will receive your first sms using Nexmo as the provider.

More examples on what you can do via the API and with more programming languages can be found in the API reference

How to use Twilio

Twilio is one of the providers supported by Delivery API. We are currently supporting both Voice and SMS as message types that can be delivered via Twilio.

To add Twilio as one of your providers in your Delivery API account, two Twilio identifiers are required:

  1. the Twilio Account SID
  2. the Twilio Auth Token

These identifiers can be found in the Twilio Console once you have logged in to your own Twilio account.

/src/img/providers/Screenshot%20twilio%20console_details_hidden_600_R1.0.png

The values for the Account SID and the Auth Token can be added to your Delivery API account, via the console or by using an API call as explained here.

In the next example we will show you how to use the API to add Twilio as a new provider, considering your Account SID to be ‘sid’ and your Auth Token to be ‘token’.

$ curl https://api.dapi.io/v1/providers/twilio \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "ACCOUNT_SID": "sid",
      "AUTH_TOKEN": "token",
    }'

To use your own account, you need to change the values “USER_ID” and “USER_SECRET” into the values of your own account as can be found in the Delivery API console. Also the values for your ‘sid’ and ‘token’ need to be replaced by the values as can be found in your own Twilio account (as described above).

If everything is successful the API will return a 200 status code. Once Twilio has been added as one of your providers, you can start sending messages via Delivery API to Twilio.

Twilio SMS

The following example is sending a sms message to the mobile phone ‘+31612345678’.

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "twilio",
      "type": "sms",
      "arguments": {
        "from": "+31612345678",
        "to": "+31612345678",
        "body": "Congratulations! You send this sms via Delivery API using Twilio"
      }
    }'

Change the ‘to’ number with your own mobile number, and the ‘from’ number with one of the numbers that has been registered in your Twilio account, and you will receive your first SMS message using Twilio as the provider.

Twilio Voice

Delivery API also supports Twilio Voice. This allows you to setup phone calls via Twilio.

In the next example, we will show you how to setup a phone call to the mobile number ‘+31612345678’:

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "twilio",
      "type": "voice",
      "arguments": {
        "from": "+31612345678",
        "to": "+31612345678",
        "url": "http://demo.twilio.com/docs/voice.xml"
      }
    }'

Change the ‘to’ with your own (mobile)phone number, and the ‘from’ with one of the numbers that has been registered into your Twilio account, and you will receive your first phone call using Twilio as the provider.

More examples on what you can do via the API and with more programming languages can be found in the API reference

How to use Plivo

Plivo is one of the providers supported by Delivery API. We are currently supporting both Voice and SMS as message types that can be delivered via Plivo.

To add Plivo as one of your providers in your Delivery API account, two Plivo identifiers are required:

  1. the Plivo Auth ID
  2. the Plivo Auth Token

Both identifiers can be found in the Plivo Dashboard after you have logged in to your own Plivo account.

/src/img/providers/Screenshot_plivo_console_details_hidden_600_R1.0.png

The values for The Auth ID and the Auth Token can be added to your Delivery API account via the console or by using an API call as explained here.

In the next example we will show you how to use the API to add Plivo as a new provider, considering your Auth ID to be ‘id’ and your Auth Token to be ‘token’.

$ curl https://api.dapi.io/v1/providers/plivo \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "AUTH_ID": "id",
      "AUTH_TOKEN": "token",
    }'

To use your own account, you need to change the values “USER_ID” and “USER_SECRET” into the values of your own account as can be found in the Delivery API console. Also the values for your ‘id’ and ‘token’ need to be replaced by the values as can be found in your own Plivo dashboard (as described above).

If everything is successful the API will return a 200 status code. Once Plivo has been added as one of your providers, you can start sending messages via Delivery API to Plivo.

Plivo SMS

The following example is sending a sms message to the mobile phone ‘+31612345678’.

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "plivo",
      "type": "sms",
      "arguments": {
        "src": "Dapi",
        "dst": "+31612345678",
        "text": "This is a test from Plivo"
      }
    }'

Change the ‘dst’ with your own mobile number, and you will receive your first SMS using Plivo as the provider.

Plivo Voice

Delivery API also supports Plivo Voice. This allows you to setup phone calls via Plivo.

In the next example, we will show you how to setup a phone call to the mobile number ‘+31612345678’:

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "plivo",
      "type": "voice",
      "arguments": {
        "from": "+31612345678",
        "to": "+31612345678",
        "answer_url": "https://s3.amazonaws.com/static.plivo.com/answer.xml",
        "answer_method": "GET"
      }
    }'

Change the ‘to’ with your own phone number, and you will receive your first phone call using Plivo as the provider.

More examples on what you can do via the API and with more programming languages can be found in the API reference

How to use Mailgun

Mailgun is one of the providers supported by Delivery API. Mailgun is used by Delivery API to deliver emails around the world.

To add Mailgun as one of your providers of your Delivery API account, two Mailgun identifiers are required:

  1. the Mailgun API Key
  2. the Mailgun Domain Name that is registered in your Mailgun account.

Both identiefiers can be found in the Mailgun domain page after you have logged in into your own Mailgun account.

/src/img/providers/Screenshot_mailgun_console_details_hidden_600_R1.0.png

The values for the API Key and the Domain Name can be added to your Delivery API account, via the console or by using an API call as explained here.

In the next example we will show you how to use the API to add Mailgun as a new provider, considering your API Key to be ‘key’ and your Domain Name to be ‘deliveryapi.com’.

$ curl https://api.dapi.io/v1/providers/mailgun \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "API_KEY": "key",
      "DOMAIN_NAME": "deliveryapi.com"
    }'

To use your own account, you need to change the values “USER_ID” and “USER_SECRET” into the values of your own account as can be found in the Delivery API console. Also the values for your ‘key’ and ‘deliveryapi.com’ need to be replaced by the values as can be found in your own Mailgun account (as described above).

If everything is successful the API will return a 200 status code. Once Mailgun has been added as one of your providers, you can start sending messages via Delivery API to Mailgun.

In the next example we will show you how to send an email to the email address ‘support@deliveryapi.com’.

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "mailgun",
      "type": "email",
      "arguments": {
        "from": "Dapi support <support@deliveryapi.com>",
        "to": "support@deliveryapi.com",
        "subject": "Welcome to dapi",
        "text": "This is the first welcome email from DeliveryAPI."
      }
    }'

Change the ‘from’ and ‘to’ with your own registered email address, and you will receive your first email using Mailgun as the provider.

More examples on what you can do via the API and with more programming languages can be found in the API reference

How to use Slack

Slack is one of the providers supported by Delivery API. Delivery API can be used to send messages to any channel in your Slack account.

There is no need to add Slack as a provider to Delivery API to be able to use the Slack messages option. By default it can be used. What is needed is to create a new (Slack) Inbound WebHook, and use that in your message.

TODO: Add a screenshot here on how to create a Slack WebHook Inbound in your slack account.

Once you have the Slack WebHook you can directly create a new Delivery API message to send a new Slack message to the WebHook. The following is an example using cURL with an example URL.

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "slack",
      "type": "message",
      "arguments": {
        "url": "https://hooks.slack.com/services/AAAAAAAAA/BBBBBBBBB/xxxxxxxxxxxxxxxxxxxxxxxx",
        "channel": "#general",
        "text": "This is a message from Delivery API."
      }
    }'

To use your own Delivery API account, you need to change the values “USER_ID” and “USER_SECRET” into the values of your own account as can be found in the Delivery API console. After that you can call the url with your newly created WebHook. It will send a (Slack) message directly to your #general Slack channel in your Slack account.

How to use Amazon SES

Amazon SES is one of the providers supported by Delivery API. Amazon SES is used by Delivery API to deliver emails around the world.

To add Amazon SES as one of your provider to your Delivery API account, three Amazon SES identifiers are required:

  1. the Amazon SES Access Key
  2. the Amazon Secret Key
  3. the Amazon Region Name.

All these three identifiers can be found in AWS IAM after you have logged into your own Amazon account.

TODO: Add a screenshot here of the AWS site to show where to find the informations.

The identifiers for your Access Key, Secret Key and Region Name can be added to your Delivery API account, via the console or by using an API call as explained in the API Reference.

In the next example we will show you how to use the API to add Amazon SES as a new provider, considering your Access Key to be ‘key’, your Secret Key to be ‘secret’ and your region name to be ‘us-east-1’.

$ curl https://api.dapi.io/v1/providers/amazon-ses \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "ACCESS_KEY": "key",
      "SECRET_KEY": "secret",
      "REGION_NAME": "us-east-1"
    }'

To use your own account, you need to change the values “USER_ID” and “USER_SECRET” into the values of your own account as can be found in the Delivery API console. Also the identifiers for your ‘key’, ‘secret’ and ‘us-east-1’ need to be replaced by the values as can be found in your own AWS account (as described above).

If everything is successful the API will return a 200 status code. Once Amazon SES has been added as one of your providers, you can start sending messages via Delivery API to Amazon SES.

In the next example we show you how to send an email to the email address ‘support@deliveryapi.com’.

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "amazon-ses",
      "type": "email",
      "arguments": {
        "source": "Dapi support <support@deliveryapi.com>",
        "destination": "support@deliveryapi.com",
        "subject": "Hello",
        "body": "This is the first welcome email from DeliveryAPI."
      }
    }'

Change the ‘source’ and ‘destination’ with your own registered email address, and you will receive your first email using Amazon SES as the provider.

More examples on what you can do via the API and with more programming languages can be found in the API reference

How to use Amazon SNS

Amazon SNS is one of the providers supported by Delivery API. Amazon SNS is used by Delivery API to deliver push notifications to any mobile device.

To add Amazon SNS as one of your provider to your Delivery API account, three Amazon SNS identifiers are required:

  1. the Amazon SES Access Key
  2. the Amazon Secret Key
  3. the Amazon Region Name.

All these three identifiers can be found in your AWS IAM after you have logged into your own Amazon account.

TODO: Add a screenshot here of the AWS site to show where to find the informations.

The identifiers for your Access Key, Secret Key and Region Name can be added to your Delivery API account, via the console or by using an API call as explained in the API Reference.

In the next example we will show you how to use the API to add Amazon SNS as a new provider, considering your Access Key to be ‘key’, your Secret Key to be ‘secret’ and your region name to be ‘us-east-1’.

$ curl https://api.dapi.io/v1/providers/amazon-sns \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "ACCESS_KEY": "key",
      "SECRET_KEY": "secret",
      "REGION_NAME": "us-east-1"
    }'

To use your own account, you need to change the values “USER_ID” and “USER_SECRET” into the values of your own account as can be found in the Delivery API console console. Also the identifiers for your ‘key’, ‘secret’ and ‘us-east-1’ need to be replaced by the values as can be found in your own AWS account (as described above).

If everything is successful the API will return a 200 status code. Once Amazon SNS has been added as one of your providers, you can start sending messages via Delivery API to Amazon SNS.

In the next example we will show you how to send a push message to an Android endpoint.

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "amazon-sns",
      "type": "push",
      "arguments": {
        "arn": "arn:aws:sns:us-east-1:123456789012:endpoint/GCM/demoapp/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
        "message": {"GCM": "{\"notification\": {\"text\": \"Hello from DeliveryAPI\", \"title\": \"DeliveryAPI\"}}"}
      }
    }'

Change your Userid and User_Secret into your own Delivery API settings. Change the ‘arn’ into your registered arn for the device, and you will receive your first push notification using Amazon SNS as the provider.

More examples on what you can do via the API and with more programming languages can be found in the API reference

How to use Bluemix Push Notifications

Bluemix Push Notifications is one of the providers supported by Delivery API. Bluemix Push Notifications is used by Delivery API to deliver push notifications to any mobile device.

To add Bluemix Push Notifications as one of your providers to your Delivery API account, three identiefiers are required:

  1. the App GUID,
  2. the App Secret
  3. the Region Name.

All three identiefiers can be found in your Bluemix Console after you have logged into your own Bluemix account.

TODO: Add a screenshot here of the Bluemix Console site to show where to find the informations.

The identiefiers for your App GUID, App Secret and Region Name can be added to your Delivery API account via the console or by using an API call as explained in the API Reference.

In the next example we will show you how to use the API to add Bluemix Push Notifications as a new provider, considering your App GUID to be ‘guid’, your App Secret to be ‘secret’ and your region name to be ‘eu-gb’.

$ curl https://api.dapi.io/v1/providers/bluemix-push-notifications \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "APP_GUID": "guid",
      "APP_SECRET": "secret",
      "REGION_NAME": "eu-gb"
    }'

To use your own account, you need to change USER_ID and USER_SECRET with the ones of your account that you can find in the console. Also the identifiers for your ‘guid’,‘secret’ and ‘eu-gb’ need to be replaced by the values as can be found in your own Bluemix account (as described above).

If everything is successful the API will return a 200 status code. Once Bluemix Push Notifications has been added as one of your providers, you can start sending push messages via Delivery API to Bluemix Push Notifications.

In the next example we will show how to send a push notification to an Android endpoint.

$ curl https://api.dapi.io/v1/messages \
    -u 'USER_ID:USER_SECRET' \
    -H 'Content-Type: application/json' \
    -X PUT \
    -d '{
      "provider": "bluemix-push-notifications",
      "type": "push",
      "arguments": {
        "device-id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
        "body": {"message": {"alert": "Message from DeliveryAPI"}}
      }
    }'

Change your USER_ID and USER_SECRET into your own Delivery API settings. Change the device-id to your registered arn for the device, and you will receive your first push notification using Bluemix Push Notifications as the provider.

More examples on what you can do via the API and with more programming languages can be found in the API reference