Hi,
In today's world it's important to make your applications talk to each other and exchange data. But in today's cloud-based world, some of the applications you use don't even belong to you! Fortunately, there is an industry-standard way of gluing the pieces together. REST is a simple but powerful protocol that modern applications expose to allow you to fetch, add, update and delete information over the web, without the need for direct programmatic access.
Today I'm going to show you how to leverage this protocol to be able to link together two applications:
- Your SharePoint (on-premises or in Office 365)
- Mailgun - an incredibly powerful, but simple mass mailing service
Basically, what we are going to do is create a mailing list in Mailgun for our partners and add the partner email to the list automatically whenever a partner is added to a Partners list in SharePoint. So next time you want to send your newsletter to partners, this new partner will already be on the list.
We are going to be using Ultimate Forms app (yes, this example is based on Office 365), but you can also use the on-premises version. We are going to be using just the Actions component, so you can also get it separately if you prefer.
- First, create a list of partners in your SharePoint site. It can be any type of list, as long as it contains text columns for the partner name and email.
- Set up your free Mailgun account here. They even allow you to send up to 10,000 emails per month for free! Mailgun with provide you with an API key that will need for the following steps. You can find the API key under Domains -> <your production domain>
- In Mailgun set up a mailing list called Partners, with an email such as partners@yourdomain.com.
- From your Partners list in SharePoint click on Design button in the ribbon to enter Ultimate Forms, and then under Configure Business Logic click on Actions
- Select Call web service as your action type and choose New as your event.
- Switch to Action Settings tab
- Switch to REST mode under Service type.
- Enter the URL for the REST endpoint. It will be https://api.mailgun.net/v3/lists/<your mailling list URL>/members
- Under Authentication choose Credentials.
- Under User name enter api.
- Under Password enter your API key.
- Set Method to POST.
- Map paramers name and address to the columns containing your partner name and email address respectively.
- Save the action.
This is it, when you add your next partner to the SharePoint list, their details will be automatically added to the mailing list in Mailgun!