Send email to customer after ticket creation through web service

Moderator: crythias

Post Reply
mfo
Znuny newbie
Posts: 3
Joined: 15 Oct 2018, 16:42
Znuny Version: 5.0.13

Send email to customer after ticket creation through web service

Post by mfo »

Hello,

I am trying to find out how to have OTRS send a ticket to the customer after it has been created through a web service.

Ticket creation and assigning to the customer works fine, only sending the mail is an issue.

The reason for this, is if we have an incident multiple customers (up to a 100) can be affected simultaneously and therefor we receive our information from an external program and create all the tickets via a script but we are not able to send them automatically to inform the customer.

The parameters sent to the web service are the following:

Code: Select all

"SessionID": sessionId,
	"Ticket": {
		"Title": "TEST Ticket",
		"QueueID": 5,
		"State": "open",
		"Priority": "3 normal",
		"CustomerUser": customerId,
		"Owner": userName
		},
		"Article": {
			"SenderType": "agent",
			"ArticleType": "email-external",
			"ContentType": "text/html; charset=utf8",
			"Subject": "TEST",
			"Body": "TEST TEST",
			"From": "some mail that used already used by OTRS to send mails"
		}
	}

Has anyone had that type of problem and how did you solve it? Does anyone have an approach to this?

Best regards,
MFO
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Send email to customer after ticket creation through web service

Post by reneeb »

Create a new dynamic field "CreatedViaGI". Set this field to "1" when you create a ticket via the web service. Then create a ticket notification that listens for updates to the dynamic field and send the message to the customer.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Send email to customer after ticket creation through web service

Post by root »

Hi,

As an alternative you can use the open source package Znuny4OTRS-GIArticleSend which adds parameters to TicketCreate and TicketUpdate to send an article.

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
mfo
Znuny newbie
Posts: 3
Joined: 15 Oct 2018, 16:42
Znuny Version: 5.0.13

Re: Send email to customer after ticket creation through web service

Post by mfo »

Hi,

The Znuny4OTRS-GIArticleSend solution works.

I also tried the solution with Ticket Notifications, but that however didn't work.

@root: Now one question remains, is it possible that GIArticleSend automatically uses the email address from the customer or do I have to provide the address separately during ticket creation? For example if the "CustomerUser" parameter is set then the "To" parameter is no longer required as the email address is provided by the customer.
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Send email to customer after ticket creation through web service

Post by root »

Hi,

Did you tried to replace mail@exampld.com by <OTRS_CUSTOMER_DATA_UserEmail>?

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
mfo
Znuny newbie
Posts: 3
Joined: 15 Oct 2018, 16:42
Znuny Version: 5.0.13

Re: Send email to customer after ticket creation through web service

Post by mfo »

Hi,

Tried it now, but got the following error: {'Error': {'ErrorCode': 'TicketCreate.InvalidParameter', 'ErrorMessage': 'TicketCreate: Article->To parameter must be a valid email address when Article->ArticleSend is set!'}}
root
Administrator
Posts: 3934
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Send email to customer after ticket creation through web service

Post by root »

Hi,

Yeah sorry this works only with a special (commercial) addon from Znuny. Please try if <OTRS_TICKET_DynamicField_XX> works. You can fill a dynamic field from customer data with the event handler DynamicFieldFromCustomerUser. AFAIK should ((OTRS)) Community edition be able to replace dynamic fields.

- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
Post Reply