Trigger email to external customer in jira cloud

Hi,

I need Jira cloud to call my web service via web hook and trigger a mail to exteranl email address when an issue got created/updated.

I checked around and feels like I have to

  1. Add a custom listener to Jira Issue updated event.

  2. In that listener, I have it to call my web service.

So, I have written a listener in my local server instance to send mail when an issue is created/updated which was imported in atlassian-plugin.xml. That is working fine.

Here is my question.

  1. I could not do this in jira cloud even via webhook. Is there any sample code that I can have a look for jira cloud.

  2. I need Jira cloud to call my web service via web hook and trigger a mail to exteranl email address when an issue got created/updated.

Please help me with the steps invloved to achieve this.

thanks,
Swathi

Calling your service when events happen is handled by webhooks: https://developer.atlassian.com/server/jira/platform/webhooks/

As for email, you can’t get JIRA to send emails for you in Atlassian cloud. Instead, you should use another cloud email provider. I’ve used Mailgun successfully before. There are a number of others and you can choose one that works best for you.

Thank you for your reply.

Actually, I am trying to call my sample REST api through webhook in atlassian-connect json. But it is returning 404 error. Can you please help me in this regard.

“webhooks”: [
{
“event”: “jira:issue_created”,
“url”: “https://8187215b.ngrok.io/RestApiSample/rest/UserService/users”,
“excludeBody”: false,
“filter”: “project = CS”,
“propertyKeys”: [
“propertyKey”,
“otherPropertyKey”
]
}
]

Thanks
Swathi

Hi @swathireddy.msr,

For the RestApiSample/rest/UserService/users, are you able to POST for that endpoint alone? That is, outside of the webhook or via Postman? When are you getting the 404?

Cheers,
Anne Calantog

Hi,
Thanks for your reply.

I am able to post the endpoint alone from my localhost in postman as below.

http://localhost:9090/RestApiSample/rest/UserService/users

So, I have tunneled to call it via webhook using ngrok. (Not sure whether I am going in a right direction)
So, Please help me with the steps involved in calling my local host web service via webhhok.

Did you try calling the ngrok url using postman or your browser? Ngrok is using https instead of the http on your localhost. That might be causing some problems.