Get a Free WhatsApp Business Account – Includes Onboarding, API Access & Sandbox. Apply Now!

Email API

Send Email using Authkey APIs and be assured to reach the inbox of your recepient everytime.

Sample Code For Sending Email

Email Templates:

You can create email templates in the authkey portal and use the template id in the API request. Templates can hold dynamic values in the email body and email subject. For example, to send an OTP message, you can create a template as below:

Dear {#name#} , your otp is {#otp#} Authkey automatically adds your template dynamic values as API parameters and you can use them to change the content delivered to each recepient.

Example usage for above template, assuming template id generated is 1001

https://api.authkey.io/request?authkey=AUTHKEY&email=RecepientEmail&mid=1001&name=Twinkle&otp=1234

Here, 'name' and 'otp' parameters are auto-added to the API and their values shall be replaced in the template body {...}

You can also create SMS and Voice templates and use them in the above API for parallel or fallback usages.

Events:

Events are combinations of templates which you can create on the Authkey portal. Event definitions will include parallel sendings, fallback channels and setting up of requiredness of dynamic parameters in the chosen templates. Once created, you will have an event-id, which can be used to trigger the event using below API:

https://api.authkey.io/request?authkey=AUTHKEY&email=RecepientEmail&msisdn=RecepientMobile&country_code=CountryCode&eid=EventId

Event APIs are generally shorter than all other APIs and can include parallel as well as fallback mechanisms on all the three channels.

All the dynamic content of the templates in an event shall be added automatically as API parameters and can be used to replace the dynamic values.

*Multiple templates with same dynamic values will be considered a single value.

While creating an event, you will get an option to choose which dynamic values are mandatory in the API request.

For example if you have 3 templates, one each for sms, voice and email as below:

SMS: Dear {#name#} , your otp is {#otp#}

Voice: Thank you for showing interest, your otp is {#otp#}

Email:

  • Subject: OTP from {#company#}
  • Body: Dear {#name#}, Thanks for choosing us. Your OTP is {#otp#}.

If we create an event using above three templates, the dynamic values shall be: name, otp & company Corresponding API request shall be:

https://api.authkey.io/request?authkey=AUTHKEY&mobile=RecepientMobile&email=RecepientEmail&country_code=CountryCode&eid=EventId&name=Ashish&otp=1234&company=Datagen