OpsGenie - Email integration - Creating and Editing tickets
Asked by Kris Dewachter:

Hi,

We are using an external system that executes batch jobs. The execution of a job is reported by email. Whenever a job is executed, failed, succeeded, .... a status email is sent to a specific email address. The emails are now handled manually.

We now want to turn these tickets into JSM tickets automatically. I was thinking of setting up an OpsGenie email integration. Can somebody tell me if the following is possible in OpsGenie ?

I know it is possible to have Opsgenie create a new JSM ticket when an email is received.

But is it also possible to update an existing JSM ticket when an update email is received ? I presume this email alert would need to contain the JSM ticket number somewhere.

We don't want to use the alerting functionality of OpsGenie yet. For now, we just want to use OpsGenie to create and update the tickets.

The reason why I want to use OpsGenie because of multiple specific issue types we want to use for different email messages. With the JSM default email channel you can only use 1 Request Type.

Any feedback or best practices is highly appreciated.

Best regards,

Kris


Answers:
author: Skyler Ataide
body: Hi Kris!

You can create and update Jira requests with Opsgenie alerts that are created by other integrations, in this case the email integration, [following the instruction here](https://support.atlassian.com/opsgenie/docs/integrate-opsgenie-with-jira-service-management-cloud/#:~:text=enable%20them%20again.-,Create%20and%20update%20Jira%20requests%20with%20Opsgenie%20alerts%20that%20are%20created%20by%20other%20integrations,-Select%20this%20option). You will need to define the update actions for requests, in other words which actions will have to take place before an update is made to the Jira request. These update actions would only occur for requests that correspond to the alerts that matched the filtering conditions of the issue creation rule. Let me know if this makes sense or if you have any followup questions on this!

comments: author: Kris Dewachter
body: Hi [@Skyler Ataide](/t5/user/viewprofilepage/user-id/4456296) ,

Thank you for your feedback.

I was able to successfully create an OpsGenie alert, and JSM ticket from an incoming email.

I understand that it is possible to update the JSM ticket, whenever the alert in OpsGenie is changed (status, comment added, ...).

However, I would like to know if the following situation would be possible :

1. I received an email from an external system in OpsGenie, created an alert and JSM ticket. The JSM ticket is linked to the alert (this is my current setup)
2. I receive a second email from the external system, somehow linked to the email in step 1. Can I link this email to the alert and/or JSM ticket in step 1 and perform an update of the alert and/or JSM ticket?

Practical example:

We have a batch job that triggers email alerts:

1. Email when the job starts
2. Email when the job encounters an error
3. Email wen the job finishes.

I would like to track these 3 actions in 1 JSM ticket.

Do you know if this is possible and how ?

Best regards,

Kris


author: Skyler Ataide
body: Hi [@Kris Dewachter](/t5/user/viewprofilepage/user-id/4588367) ,

This use case is possible. One way to configure this is to [create an "Add note" action](https://support.atlassian.com/opsgenie/docs/action-filters-in-opsgenie-integrations/) in your Email integration settings. The "Add note" action will need to filter for the second email that come from your external system, and these filters will need to be different from the filters in the "Create alert" action as actions are processed in a top-down order. You will also need to set up the "Add note" action to have the same alias as the first email alert, that way the integration knows which alert to add a note to when the second email comes in.

Once this is set up, you can edit your Jira integration to add a comment to the Jira issue that is linked to your first email alert in Opsgenie whenever a note is added to that original alert. Here is what that configuration would look like in the Jira integration:

![Screenshot 2024-03-28 at 10.52.14?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/315215i642745B4128B07AF/image-size/large?v=v2&px=999 "Screenshot 2024-03-28 at 10.52.14?AM.png")

Hopefully this helps!


author: Kris Dewachter
body: Hi [@Skyler Ataide](/t5/user/viewprofilepage/user-id/4456296) ,

Thank you.

I still don't understand how the second email is matched with the first email / ticket. You speak of "Alias", but does is that exactly ?

Best regards,

Kris


author: Skyler Ataide
body: [@Kris Dewachter](/t5/user/viewprofilepage/user-id/4588367) the [Alias field](https://support.atlassian.com/opsgenie/docs/alert-fields/#:~:text=to%20be%20notified.-,Alias,-%3A%20The%20user%2Ddefined) serves as a unique alert identifier and is used for managing actions on existing alerts as well as deduplicating alerts. [This community article](https://community.atlassian.com/t5/Opsgenie-articles/Configuring-the-Opsgenie-Alias-Field/ba-p/2520231) goes into detail on best practices for configuring the Alias field for alerts.

So, if your Create Alert action in your email integration is creating alerts with an Alias that uses the {from_address}} and a static string, then you would also need your Add Note action to target open/existing alerts with that same alias:

![Screenshot 2024-04-08 at 9.27.02?AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/317015iE5C4B7289CD24DD6/image-size/large?v=v2&px=999 "Screenshot 2024-04-08 at 9.27.02?AM.png")


author: Kris Dewachter
body: Thank you for your help [@Skyler Ataide](/t5/user/viewprofilepage/user-id/4456296) .

We will give this a try in the next weeks.


Tags: cloud

jira-service-management-cloud