Appery.io

The Appery.io Developer Hub

Welcome to the Apperyio developer hub. You'll find comprehensive guides and documentation to help you start working with apperyio as quickly as possible, as well as support if you get stuck. Let's jump right in!

Guides    Latest Updates

Email with SendGrid Sample App

Sending email from an app with SendGrid.

‚ÄčThis example uses SendGrid API to send emails from an app.

Sample app uses and demonstrates:

  • jQuery Mobile.
  • Server Code.
  • Invoking an external REST API.

App (UI)

To get the app UI:

  1. Create a new jQuery Mobile app based on the Blank template.
  2. Inside the App Builder, select Create new > From plugin. Under Appery.io Examples, select Email with SendGrid.
  3. Click the Import selected plugin button.
  4. Select sendgrid as the starter page and click Apply settings.

Backend

To get the app backend:

  1. Go to Server Code page.
  2. Go to Plugins page.
  3. Import SendGridEmail plugin.

SendGrid Account

You also need to create a SendGrid account to get an API key to send emails. After you sign up for an account, to get the API key:

  1. From the main dashboard page, expand Settings (left side).
  2. Click on API Keys.
  3. Click Create new API Key > General API Key.
  4. Give the key a name and then check Full Access in Mail Send row.
  5. Click Save to create the key. You will see the key on the next page. You should save this key.

Configuring the Server Code Script

Now, you need to configure the script.

  1. Open the Server Code script you have just imported.
  2. Find line #21, fine api_key and replace it with the key you created above.

That's all you need to do to configure this script.

Testing the Script

It's a good idea to test the script and the SendGrid API to make sure it works.

  1. Switch to Script parameters tab.
  2. Create the following three parameters and set them to test values:
    • to
    • subject
    • text
  3. Switch to Run tab and click the Save and run button.

Connecting the App with the Backend

The last step is to connect the app with the backend.

  1. Inside the App Builder, open Services > SendGridEmail_service.
  2. In Settings tab, you will see {servercode} in the URL. To replace the value with the script ID, in Server Code script, switch to API information tab. There, you will see the script ID in the URL you need to use.
  3. Save all the changes.

Testing the App

You are now ready to test the app. Click the Test button in the App Builder to launch the app in the browser.

Testing on the Device

You can also easily test the app directly on the device by using the Appery.io Tester App