Creating tickets in Zendesk - zendesk

I am new to Zendesk, but what I want is for my app to be able to create tickets in Zendesk. Basically, when a user does something in my web application, my backend application creates a ticket for a Support to look at the issue and resolve it.
Looking at the Zendesk API for creating tickets, it seems that it asks for agent username and password, but there is no agent, just a machine that is creating those tickets. So my question here is, should I use some different approach to this problem, or should I work around by creating a user for the machine with imaginary email address so that I can authenticate?

In this case, you should use the "request" endpoint, instead of the "ticket".
Here is an example that may help:
fetch('https://SUBDOMAIN.zendesk.com/api/v2/requests.json', {
method: 'post',headers: {
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/json' },
body: JSON.stringify({"request": {"requester": {"name": "Anonymous customer"}, "subject": "Vlad test", "comment": {"body": "Here goes a ticket body"
}}})
}).then(res=>res.json()).then(res => console.log(res));

Related

Given a groupId and authenticated user, how do I check the user's membership and role (owner vs member) in one network call?

As far as I know, Microsoft Graph lets me query for /groups/{groupid}/members or /groups/{groupid}//owners separately, but not both in one call. Is this possible?
In my context, I know the groupId and the authenticated calling userId. How do I check whether this user belongs to the group and if so, their owner/member role in one network call? Is this possible?
One option to assume would be to expand and include members and owners properties via $expand query option but unfortunately the following query is not supported:
https://graph.microsoft.com/v1.0/groups/{group-id}?$select=owners,members&$expand=owners,members
since max only 1 object is allowed to be expanded per Group resource
JSON batching comes to the rescue here, the following example demonstrates how to retrieve Group members and owners within a single request:
POST https://graph.microsoft.com/v1.0/$batch
Accept: application/json
Content-Type: application/json
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/groups/{group-id}/members"
},
{
"id": "2",
"method": "GET",
"url": "/groups/{group-id}/owners"
}
]
}

Jira Api Error when creating issue

On my website I have a contact form which when submitted, creates a new service desk ticket. It makes the following rest api call:
https://jira-housters.atlassian.net/rest/servicedeskapi/request (with appropriate Accept and Authorization request headers)
{
"serviceDeskId": "1",
"requestTypeId": "1",
"requestFieldValues": {
"summary": "Housters Contact from Justin Test (Web)",
"description": "test message"
},
"raiseOnBehalfOf": "myemail#mydomain.com"
}
Before this worked completely fine, however a few days ago it started erroring:
{"errorMessage":"Your request could not be created. Please check the fields have been correctly filled in. Please provide a valid value for field 'Raise this request on behalf of'","i18nErrorMessage":{"i18nKey":"sd.validation.request.creation.failure.required.field","parameters":["Please provide a valid value for field 'Raise this request on behalf of'"]}}
This makes no sense, as it's complaining about the raise request on behalf of field when I clearly have it specified. What gives?
raiseOnBehalfOf should have the customers accountId not email.
You can create a customer using:-
-> https://your-domain.atlassian.net/rest/servicedeskapi/customer
-> Get the accountId from the response.

Using createLink to share with specific users

I am trying to create a link to share a document with createLink from Microsoft Graph for specific users without using an invite but it is creating a link with Anyone with the link can edit this document permission.
I'm calling this endpoint:
POST /me/drive/items/{itemId}/createLink
With this request body:
{
"type": "edit",
"scope": "anonymous"
}
Am I missing something?
You can't use createLink for sharing with a specific person, you need to use the invite endpoint for that.
The call you're making is responding exactly how you've asked it to and generating a link (createLink) that anyone (anonymous) can access.
If you don't want to send a physical invitation, you can tell OneDrive this by setting the sendInvitation property to false:
POST /me/drive/items/{item-id}/invite
Content-type: application/json
{
"requireSignIn": true,
"sendInvitation": false,
"roles": [ "write", "read"],
"recipients": [
{
"email": "someone#contoso.org"
}
]
}
Please refer this link https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_invite
You can share the file with specific user by adding user's in
"recipients":[{"#odata.type":"microsoft.graph.driveRecipient"}]
parameter. You can set sendInvitation parameter like "sendInvitation":false to avoid sending the invitation mail.

Strategies for sending weekly newsletter emails from Rails

So we have about 50,000 users who have signed up for a weekly newsletter. The contents of this email is personalized for each user though, it's not a mass email.
We are using Rails 4 and Mandrill.
Right now we're taking about 12 hours every time we want to fire off this emails.rake task and I'm looking for a way to distribute that time or make it shorter.
What are some techniques I can use to improve this time that is only growing longer the more people sign up?
I was thinking of using mandrill templates, and just sending the json object to mandrill and have them send the email from their end, but I'm not really sure if this is even going to help improve speeds.
At the 50,000+ level: How do I keep email sending times manageable?
Looks like you could use MailyHerald. It is a Rails gem for managing application emails. It sends personalized emails in the background using Sidekiq worker threads which should help you out in terms of performance.
MailyHerald has a nice Web UI and works with email services like Amazon SES or Mandrill.
You need to probably look into Merge Tags on Mandrill. It allows you to define custom content per email. So you can break your newsletter sending into fewer API calls to Mandrill instead of 1 per email. The number of calls will just depend on the size of your data since I am sure there is probably a limit.
You can just create a template and put in merge vars such as *|custom_content_placeholder|** wherever you need user specific content to be placed. You can do this templating in your system and just pass it into the message or you can set it up in Mandrill and make a call to that template.
When you make the Mandrill API call to send an email or email template you just attach the JSON data such as:
"message": {
"global_merge_vars": [
{
"name": "global_placeholder",
"content": "Content to replace for all emails"
}
],
"merge_vars": [
{
"rcpt": "user#domain.com",
"vars": [
{
"name": "custom_content_placeholder",
"content": "User specific content"
},
{
"name": "custom_content_placeholder2",
"content": "More user specific content"
}
]
},
{
"rcpt": "user2#domain.com",
"vars": [
{
"name": "custom_content_placeholder",
"content": "User2 specific content"
},
{
"name": "custom_content_placeholder2",
"content": "More user2 specific content"
}
]
}
],
You can find more info on Merge Tags here:
https://mandrill.zendesk.com/hc/en-us/articles/205582487-How-to-Use-Merge-Tags-to-Add-Dynamic-Content
If you are familiar with handlebars for templating, Mandrill now supports it with the merge tags:
http://blog.mandrill.com/handlebars-for-templates-and-dynamic-content.html

Get Recommendation from LinkedIn API returns empty map [:] as response

I have created a web application from which I am trying to get recommendations of a user from his/her LinkedIn Profile using URL
String url="https://api.linkedin.com/v1/people/~:(recommendations-received:(id,recommendation-type,recommendation-text,recommender))?format=json"
When I am using this URL in the
Api Explorer it works fine. And gives output:-
{ "recommendationsReceived": {
"_total": 2,
"values": [
{
"id": 558598601,
"recommendationText": "xxx is among the best team players I ever worked with. He has handled client effectively with smooth operations. I had always seen him as person with solution mindset and always look for solution rather than thinking about the problem. ",
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXX"
}
},
{
"id": ZZZZ,
"recommendationText": "XXX is one of the most dedicated person at work.I always him with a flexible attitude and ready to adapt himself in all situation.I have seen him work all night to catch up all the deadlines and deliver on time ."
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXXX"
}
}
] } }
The problem comes, when I am using this URL in my Developer app.It doesn't give any error just simple return an empty map [:] as output in response
Irrespective of these recommendation fields, I successfully get the user basic profile data such as email, id, image,firstName,lastName.Means my code is working for other fields well but not for these recommendation fields*
To find the solution, I did some internet surfing and find a link of Linked API docs
Linked API Docs
As per Docs following selection of profile fields are only available
to applications that have applied and been approved for the Apply with
LinkedIn program:
Recommendation Fields
I already created a LinkedIn Developer account to get key & Secret
So how do I apply and get approval for Apply with LinkedIn Recommendation Fields.
I already have seen the LinkedIn support but can't find the way to ask question to the Linked Developer help support
Please suggest me the right way.
After a long internet surfing,I have found something fruitful that, I have to fill up a form to get these fields.Here is the form
along with its procedural details
You can use just recommendations-received keyword. Try the following link. I am getting all recommendations details with this link.
https://api.linkedin.com/v1/people/~:(recommendations-received)?format=json

Resources