Monetization company-developer invitation notifications

rajanish
Participant III

How to configure notification conditions for company-developer feature in monetization ?

0 2 416
2 REPLIES 2

rajanish
Participant III

Note : how to setup notifications using api is documented here http://docs.apigee.com/monetization/content/set-up-notification-templates#notiftempapi

Below is more specific to company developer inviations feature

In order to setup email notifications for invitations, follow below steps

1. create email template with subject and email body as required.
2. create condition, use email template id created in step 1

Example :

Step 1 :

POST https://api.enterprise.apigee.com/v1/mint/organizations/{ORG}/notification-email-templates/
{
    "name": "COMPANY_INVITES_DEVELOPER",
    "subject": "Invitation to join {companyId}",
  "htmlImage": "<p>${developer.legalName} , You have been invited by {companyId} to join! Please login <a href=\"${url}\">here</a> and accept the invite" ,
    "source": "Mail Man Test"
}

Expected Response :

{
    "name": "COMPANY_INVITES_DEVELOPER",    
    "subject": "Invitation to join {companyId}",
    "htmlImage": "<p>${developer.legalName} , You have been invited by {companyId} to join! Please login <a href=\"${url}\">here</a> and accept the invite" ,
    "source": "Mail Man Test"
    "id": "8297f90b-9c01-48a5-9452-954253ab7050",
    "orgId": "{ORG}"
}

Step 2 :
Capture template id from response and use it in request below in this case : 8297f90b-9c01-48a5-9452-954253ab7050

POST https://api.enterprise.apigee.com/v1/mint/organizations/att/notification-conditions


{
    "notificationCondition": [
      {
        "attribute": "COMPANY_INVITES_DEVELOPER"
      },
      {
        "attribute": "PUBLISHED",
        "value": "TRUE"
      }
    ],
   "actions": [{
          "actionAttribute": "DEV_ID",
          "value": "ANY",
          "templateId": "8297f90b-9c01-48a5-9452-954253ab7050"
        }]
  }


Done. It will take upto 5 mins for all servers to be updated with notifications.

========================================================================

Additional details :
To send copy to company admins, add actions COMPANY_ADMINS (note, this is not org admin). Below example will send a email to developer and all company admins a notification. example :

{
    "notificationCondition": [
      {
        "attribute": "COMPANY_INVITES_DEVELOPER"
      },
      {
        "attribute": "PUBLISHED",
        "value": "TRUE"
      }
    ],
    "actions": [{
          "actionAttribute": "DEV_ID",
          "value": "ANY",
          "templateId": "8297f90b-9c01-48a5-9452-954253ab7050"
        },{
          "actionAttribute": "COMPANY_ADMINS",
          "value": "ANY",
          "templateId": "8297f90b-9c01-48a5-9452-954253ab7050"
        }
    ]
  }

Apart from COMPANY_INVITES_DEVELOPER,

The other supported actions are as below DEVELOPER_INVITES_COMAPNY, COMPANY_ACCEPTS_INVITATION,
DEVELOPER_ACCEPTS_INVITATION,
COMPANY_CANCELS_INVITATION,
DEVELOPER_CANCELS_INVITATION,
COMPANY_DECLINES_INVITATION,
DEVELOPER_DECLINES_INVITATION

if you require notifications for any of these actions follow the same steps mentioned above and use respective notificationCondition.attribute

FYI, the Apigee documentation has been updated to include this use case.
http://docs.apigee.com/monetization/content/set-up-notification-templates#self-service

Thanks, Rajanish!