Tip: HTTP targets are being deprecated in February 2022. If you need assistance converting your existing HTTP targets, contact Zendesk Customer Support.
Slack is a popular team collaboration product. Zendesk doesn’t have a built-in Slack Target, and in the past this would make it difficult for a business to send messages into Slack. In this example we will show how to use an HTTP Target to send comments from newly rated tickets directly into Slack by integrating directly into a Slack channel using Slack's incoming webhooks.
Setting up the HTTP Target
Let’s assume you have already created an incoming webhook in Slack.
To create your target in Zendesk Support
- In Admin Center, click the Apps and integrations icon (
) in the sidebar, then select Targets > Targets.
- Click add target, then click HTTP Target.
- Configure the target to integrate with Slack’s incoming webhook functionality.
When a webhook is configured in Slack, it will generate a webhook URL that receives new POST requests from your Target, as shown below. - Configure your webhook to use this URL. Since Slack does not require basic authentication, leave the username and password fields empty.
- Save the target.
You’re now ready to configure a trigger notification using this Target.
Configuring the HTTP target as a trigger action
Now you need to configure your HTTP target as a trigger action.
To set up your trigger in Zendesk Support
- In Admin Center, click the Objects and rules icon (
) in the sidebar, then select Business rules > Triggers.
In this example, we’ll configure a trigger to send information about a customer satisfaction rating into Slack whenever a ticket is solved. - Configure your trigger conditions to notify your new Slack target whenever a ticket is solved and Satisfaction is rated with a comment.
The Trigger action should contain JSON formatted content according to Slack's documentation.
{ "text": "You received some feedback from {{ticket.requester.name}} on :\n{{satisfaction.current_comment}}" } - Save your trigger.
Now, newly rated tickets will send notifications into your Slack channel directly from Zendesk.
7 Comments
I spent all day working on getting this to work, I style it to look quite similar to the native Zendesk/Slack integration and if anybody needs it I'm adding the code below, all you need to do is paste it into Trigger - JSON Body in Zendesk trigger:
And here is how it will look like:
What I want to do is to change the color of the attachment line (which is currently grey) as per ticket status to match the Zendesk colors for New, Open, Hold, Pending. But I have no idea how to do that.
Can someone help me with how to change the above grey line from Gray to Yellow for New ticket and Red for Open. I guess I need to create separate triggers for every Staus and add code that will display the color as I need it, and that's ok.
But can anyone help me with what code I would need to add to the one I already have above to assign the color to that attachment line to be for example Yellow?
Hey @...
You can do that in two ways, you can either have a trigger for each status and have a different message setup for each trigger, or you can do it in one trigger using Liquid Markup that tests for the status and then if it meets a condition, send a different message. The latter is more complex to setup but reduces the total number of triggers required.
In either case, the attribute you need to set on the Slack message is the attribute for `color` and then set a hex code color. Some Zendesk colours and the hex codes for them are found here. Some words also work in place of hex codes, like 'good' (for green), 'warning' (yellow), and 'danger' (red), but a hex code offers most control.
You can also break up the layout a bit without needing to format a /n linebreak if you use the Attachments message structure. Sample of the Attachments layout can be found in Slack's docs here
Here's an example below!
Hi @... team,
Right now, we have one brand (A) in our Zendesk account and there is a Slack/Zendesk integration, which provides details about tickets, see here
We are about to set up a new additional brand in our Zendesk (B) and we would like to differentiate in Slack between tickets coming from those brands:
Is it possible to set this up? If yes, can you please provide more information?
Thanks
Mirek
Hi @...
That should be doable. You would need an HTTP target for each of your Slack channels, and a trigger for each of your brands - specifying the conditions under which you want to push a message, e.g. if Ticket is created + Brand is A, then notify target A (your HTTP target for the Brand A channel).
Let me know if you need more details than that - hope this helps!
Hey @... That worked perfectly!
I created separate triggers for every status change, assigned "zendesk colors" to every status, and adjusted it a bit to give us the info we needed. And it's really good, I cant tell the difference from the native integration. Thank you so much!
One difference is that i cant make it show "Read more" for placeholder:
It keeps showing the entire response (which including the signature is a bit overwhelming at times), do you have any idea how to make it short and add read more for expanding to the entire comment?
Hey team,
Is there a way to make this target work for a private channel?
I have this json. When it points to csewiki it breaks (private channel). But if I add in the text for a public channel, it works. Note my code is cut off. Curious if there is another parameter I should be passing.
I've looked into this a bit and it all may depend! If you had recently created the private channel or recently converted a public channel to a private one, that sadly isn't compatible with our Slack integration currently. I apologize for this limitation. If the channel you're working on does not meet those criteria, please let us know so we can take a deeper dive into what may be happening in your account.
Thanks!
Please sign in to leave a comment.