On this page
You can authenticate with Campaign Monitor to create your own instance of the Campaign Monitor connector through the UI or through APIs. Once authenticated, you can use the connector instance to access the different functionality offered by the Campaign Monitor platform.
Campaign monitor supports both Basic and OAuth 2.0 authentication.
Basic Authentication
Authenticate Through the UI Using Basic Authentication
Use the UI to authenticate with Campaign Monitor and create a connector instance as described in Authenticate a Connector Instance (UI). In addition to the base authentication parameters, you will need the credentials that you identified in API Provider Setup.
After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a common resource, or use it in a formula template.
Authenticate Through API Using Basic Authentication
Send a request to our /instances
endpoint to authenticate a connector instance. When finished note the token and id.
To authenticate a connector instance:
Construct a JSON body as shown below (see Basic Parameters):
{ "element": { "key": "campaignmonitor" }, "configuration": { "username": "<campaignmonitor API key>", "company.name": "<campaignmonitor
Call the following, including the JSON body you constructed in the previous step:
POST /instances
Note: Make sure that you include the User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.Locate the
token
andid
in the response and save them for all future requests using the connector instance.
Example cURL
curl -X POST \
https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/instances \
-H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
-H 'content-type: application/json' \
-d '{
"element": {
"key": "campaignmonitor"
},
"configuration": {
"username": "xxxxxxxxxxxxxxxxxx",
"company.name": "Acme"
},
"tags": [
"Docs"
],
"name": "API Instance"
}'
Basic Parameters
API parameters not shown in SAP Open Connectors are in code formatting
.
Parameter | Description | Data Type |
---|---|---|
key | The connector key. | string |
Namename | The name of the connector instance created during authentication. | string |
API Keyusername | The API key assigned to the user that you noted in API Provider Setup. | string |
Company Namecompany.name | The Domain Name. The Domain Name appears in the url of your account. For example, in https://company_name.campaignmonitor.com/ the Domain Name is company_name . | string |
tags | Optional. User-defined tags to further identify the instance. | string |
Example Response for an Authenticated Connector Instance
In this example, the instance ID is 12345
and the instance token starts with "ABC/D...". The actual values returned to you will be unique: make sure you save them for future requests to this new instance.
{
"id":12345,
"name":"API Instance",
"createdDate":"2018-05-25T15:56:22Z",
"token":"ABC/Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=",
"element":{
"id":6315,
"name":"Campaign Monitor",
"hookName":"CampaignMonitor",
"key":"campaignmonitor",
"description":"The API can be used to manipulate employee data and to generate reports in several formats.",
"image":"elements/custom-element-default-logo.png",
"active":false,
"deleted":false,
"typeOauth":false,
"trialAccount":false,
"resources":[ ],
"transformationsEnabled":true,
"bulkDownloadEnabled":true,
"bulkUploadEnabled":true,
"cloneable":true,
"extendable":true,
"beta":false,
"authentication":{
"type":"basic"
},
"extended":false,
"useModelsForMetadata":true,
"hub":"humancapital",
"protocolType":"http",
"parameters":[ ],
"private":false
},
"elementId":6315,
"tags":[
"Docs"
],
"provisionInteractions":[
],
"valid":true,
"disabled":false,
"maxCacheSize":0,
"cacheTimeToLive":0,
"configuration":{ },
"eventsEnabled":false,
"traceLoggingEnabled":false,
"cachingEnabled":false,
"externalAuthentication":"none",
"user":{
"id":123456,
"emailAddress":"claude.elements@cloud-elements.com",
"firstName":"Claude",
"lastName":"Elements"
}
}
OAuth 2.0 Authentication
Authenticate Through the UI Using OAuth 2.0
Use the UI to authenticate with Campaign Monitor and create a connector instance. Because you authenticate with Campaign Monitor via OAuth 2.0, all you need to do is add a name for the instance. After you create the instance, you'll log in to Campaign Monitor to authorize SAP Open Connectors access to your account. For more information about authenticating a connector instance, see Authenticate a Connector Instance (UI).
After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a common resource, or use it in a formula template.
Authenticate Through API Using OAuth 2.0
Authenticating with OAuth 2.0 through API is a multi-step process that involves:
- Getting a redirect URL. This URL sends users to the vendor to log in to their account.
- Authenticating users and receiving the authorization grant code. After the user logs in, the vendor makes a callback to the specified url with an authorization grant code.
- Authenticating the connector instance. Using the authorization code from the vendor, authenticate with the vendor to create a connector instance at SAP Open Connectors.
Getting a Redirect URL
Use the following API call to request a redirect URL where the user can authenticate with the API provider. Replace {keyOrId}
with the connector key, campaignmonitor
.
curl -X GET /elements/api-v2/{keyOrId}/oauth/url?apiKey=<api_key>&apiSecret=<api_secret>&callbackUrl=<url>&siteAddress=<url>
Query Parameters
Query Parameter | Description |
---|---|
apiKey | The key obtained from registering your app with the provider. This is the Client ID that you recorded in API Provider Setup. |
apiSecret | The secret obtained from registering your app with the provider. This is the Client Secret that you recorded in API Provider Setup. |
callbackUrl | The URL that will receive the code from the vendor to be used to create a connector instance. |
Example cURL
'https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/elements/campaignmonitor/oauth/url?apiKey=fake_api_key&apiSecret=fake_api_secret&callbackUrl=https://www.mycoolapp.com/auth&state=campaignmonitor' \
Example Response
Use the oauthUrl
in the response to allow users to authenticate with the vendor.
{
"oauthUrl": "https://api.createsend.com/oauth?scope=ViewReports%2CManageLists%2CCreateCampaigns%2CImportSubscribers%2CSendCampaigns%2CViewSubscribersInReports%2CManageTemplates%2CAdministerPersons%2CAdministerAccount%2CViewTransactional%2CSendTransactional&response_type=code&redirect_uri=https%3A%2F%2Fhttpbin.org%2Fget&state=campaignmonitor&client_id=123456",
"element": "campaignmonitor"
}
Authenticating Users and Receiving the Authorization Grant Code
Provide the response from the previous step to the users. After they authenticate, Campaign Monitor provides the following information in the response:
- code
- state
Response Parameter | Description |
---|---|
code | The Authorization Grant Code required by SAP Open Connectors to retrieve the OAuth access and refresh tokens from the endpoint. |
state | A customizable identifier, typically the connector key (campaignmonitor ) . |
error
instead of the code
parameter. In this case, your application can handle the error gracefully.Authenticating the Connector Instance
Use the /instances
endpoint to authenticate with Campaign Monitor and create a connector instance. If you are configuring events, see the Events section.
To create a connector instance:
Construct a JSON body as shown below (see OAuth 2.0 Parameters):
{ "element": { "key": "campaignmonitor" }, "providerData": { "code": "<AUTHORIZATION_GRANT_CODE>" }, "configuration": { "authentication.type": "oauth2", "oauth.callback.url": "<CALLBACK_URL>", "oauth.api.key": "<CONSUMER_KEY>", "oauth.api.secret": "<CONSUMER_SECRET>", "filter.response.nulls": true }, "tags": [ "<Add_Your_Tag>" ], "name": "<INSTANCE_NAME>" }
Call the following, including the JSON body you constructed in the previous step:
POST /instances
Note: Make sure that you include the User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.Locate the
token
andid
in the response and save them for all future requests using the connector instance.
Example cURL
curl -X POST \
https://api.openconnectors.us2.ext.hana.ondemand.com/elements/api-v2/instances \
-H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
-H 'content-type: application/json' \
-d '{
"element": {
"key": "campaignmonitor"
},
"providerData": {
"code": "xoz8AFqScK2ngM04kSSM"
},
"configuration": {
"authentication.type": "oauth2",
"oauth.callback.url": "<CALLBACK_URL>",
"oauth.api.key": "<CONSUMER_KEY>",
"oauth.api.secret": "<CONSUMER_SECRET>"
},
"tags": [
"For Docs"
],
"name": "API Instance"
}'
OAuth 2.0 Parameters
API parameters not shown in the SAP Open Connectors are in code formatting
.
Parameter | Description | Data Type |
---|---|---|
'key' | The connector key. campaignmonitor | string |
Namename | The name for the connector instance created during authentication. | Body |
Authentication Typeauthentication.type | How you want to authenticate with the API provider, either OAuth2 or Basic. | string |
API Keyusername | Basic Authentication only. The Campaign Monitor API Key. | |
oauth.callback.url | OAuth 2.0 Authentication only. The URL where you want to redirect users after they grant access. This is the Callback URL that you noted in in API Provider Setup. | |
OAuth API Keyoauth.api.key | OAuth 2.0 Authentication only. The Client ID from Campaign Monitor. This is the Client ID that you noted in API Provider Setup. | string |
OAuth API Secretoauth.api.secret | OAuth 2.0 Authentication only. The Client Secret from Campaign Monitor. This is the Client Secret that you noted in API Provider Setup. | string |
tags | Optional. User-defined tags to further identify the instance. | string |
Example Response for an Authenticated Connector Instance
{
"id": 123,
"name": "test",
"token": "3sU/S/kZD36BaABPS7EAuSGHF+1wsthT+mvoukiE",
"element": {
"id": 39,
"name": "Campaign Monitor",
"key": "campaignmonitor",
"description": "Campaign Monitor makes it easy for you to create, send, and optimize your email marketing campaigns.",
"image": "https://www.campaignmonitor.com/assets/brand/campaignmonitor.jpg",
"active": true,
"deleted": false,
"typeOauth": false,
"trialAccount": false,
"resources": [ ],
"transformationsEnabled": true,
"bulkDownloadEnabled": true,
"bulkUploadEnabled": true,
"cloneable": true,
"extendable": false,
"beta": true,
"authentication": {
"type": "oauth2"
},
"elementId": 3928,
"provisionInteractions": [],
"valid": true,
"disabled": false,
"maxCacheSize": 0,
"cacheTimeToLive": 0,
"configuration": { },
"eventsEnabled": false,
"eventsNotificationCallbackUrl": "false",
"traceLoggingEnabled": false,
"cachingEnabled": false,
"externalAuthentication": "none",
"user": {
"id": 12345
}
}
}