This is a migrated thread and some comments may be shown as answers.

headers: { "Authorization" : "Accountkey {{Accountkey}}" },

4 Answers 102 Views
JavaScript SDK
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vasco
Top achievements
Rank 1
Vasco asked on 26 Jan 2014, 06:02 PM
hello

acording to this page: http://docs.telerik.com/platform/backend-services/development/rest-api/email-templates/send-email

" The request must use AccountKey authentication. In the body of the request you must provide recipients list and context object. "

what's the accountkey authentication ?

on my backend-services- > Api Keys I only get:
Application Name
API Key
API Master Key

where's the accountkey ??

thk u
Vasco Barbosa

4 Answers, 1 is accepted

Sort by
0
Vasco
Top achievements
Rank 1
answered on 27 Jan 2014, 09:01 AM
no one?
0
Anton Dobrev
Telerik team
answered on 27 Jan 2014, 04:54 PM
Hello Vasco,

We are sorry for the ambiguity in some parts of our documentation. This is something we are going to fix asap.

Please find below a more comprehensive code snippet:

$.ajax({
    type: "POST",
    contentType: "application/json",
    headers: { "Authorization": "MasterKey your-api-master-key-here" },
    data: JSON.stringify(recipients),
    success: function (data) {
        alert("Email successfully sent.");
    },
    error: function (error) {
        alert(JSON.stringify(error));
    }
})


In order to execute the code snippet add:

  • the API key of the application at the place of application-id-here
  • the name of the template you want to send (e.g. WelcomeEmail) at the place of
    template-name-here
  • the API master key instead of your-api-master-key-here

Please, do not hesitate to contact us if you have any other questions.

Regards,
Anton Dobrev
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Vasco
Top achievements
Rank 1
answered on 27 Jan 2014, 11:27 PM
I'll try this, 

but as instructed, the masterkey should be on deployment right?
0
Accepted
Anton Dobrev
Telerik team
answered on 28 Jan 2014, 12:30 PM
Hello,

The master key for your application should be used only by yourself (or by any collaborators you might have to this project) and not deployed with your app. We have provided an example using the MasterKey authentication only to showcase in a fast way the Emails feature of Telerik Backend Services.

Let us explain more on the integrated and additional email functionality offered by Telerik Backend Services.

1.  Integrated

In Backend Services you have an "out-of-the-box" email sending strategy for:
  • welcoming newly registered users
  • sending verification emails
  • sending confirmation emails when a user password is reset
This feature can be enabled/disabled from the left pane in your Backend project - Settings - Email notifications.

2. Additional

Note that sending emails is based on templates. The templates are to be found in the Emails tab of the portal's left navigation pane. You can add additional email templates (subject to a subscription plan) customized for a certain scenario.

The sending of automated emails feature is best managed through the Cloud Code (intended to be the business logic layer for your app). An example how to send emails from the Cloud code can be found here. Thus, when certain event occurs you can send an automated email to the interested parties.

Please, let us know if  this answers your question.

Regards,
Anton Dobrev
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
JavaScript SDK
Asked by
Vasco
Top achievements
Rank 1
Answers by
Vasco
Top achievements
Rank 1
Anton Dobrev
Telerik team
Share this question
or