My goal is to create a ticket in Zammad using the API and then to update it (for.
the reference for such basic tasks is here
I am using Postman to send requests.
I use the bearer token authentication, the token has been generated for a user who is ticket.agent (and he is admin too).
I manage to succesfully create a ticket by doing a post request to
https://myzammadinstance.com/api/v1/tickets
and with this body:
{
"title": "Ticket generated from API - my test",
"group": "Users",
"article": {
"subject": "My Subject",
"body": "My body",
"type": "note",
"internal": false
},
"customer": "my#email.address",
"user": "my#email.address",
"note": "my notes"
}
This succesfully creates a ticket (with a given ID, let's say 1990).
Now i would like to update this ticket, so "replying from API".
I do a post request to
https://myzammadinstance.com/api/v1/tickets
and with this body:
{
"id": 1990,
"title": "updated title",
"group": "Users",
"state": "open",
"customer_id": 12,
"priority": "3 high",
"article": {
"subject": "some subject of update",
"body": "some message of update"
}
}
This executes but does not append a reply to my ticket 1990 but it generates a new ticket (with id 1991 and title "updated title").
I do not want to create a new ticket but just reply to an existing ticket.
May i misunderstood something but i double checked many times the documentation and the request body.
Anyone could give an hand please?
UPDATE: as stated in the comments is seems i should use
https://myzammadinstance.com/api/v1/tickets/1990
but this does not work: a new ticket is not created but the response has an error:
{
"error": "No route matches [POST] /api/v1/tickets/1990"
}
SOLUTION
The problem was in PUT vs POST, by using PUT and this endpoint
https://myzammadinstance.com/api/v1/tickets/1990
i managed to reply to the ticket.
To update the ticket you would need to use this endpoint:
PUT /api/v1/tickets/{id}
https://docs.zammad.org/en/latest/api/ticket.html#update
Related
I am trying to set-up a scenario in Integromat that reads comments on a facebook posts in a private group I own. Currently integromat can only pull comment level data, and not comment author data. However, from what I've read when integromat has been given a User Access Token from a facebook user that is an admin of the group then they can read comment author data.
Can I simply create a plain app, make it live, install it on the group, and then provide integromat my client access token from that app in order for them to be able to pull comment author data?
It's looking like the "watch comments" module in Integromat doesn't return author data. It appears what you're trying to do is currently not possible with the "watch comments" module. Here's some data a scenario I ran returned:
{
"id": "",
"object": {},
"parent": {},
"message": "",
"attachment": {
"description": "",
"type": "",
"title": "",
"target": {
"id": "",
"url": ""
},
"url": "",
"media": {
"image": {
"height": ,
"src": "",
"width":
}
}
},
"like_count": ,
"created_time": "",
"comment_count":
}
I've checked the other questions about this error and the only solutions offered are "subscribe to the messaging_postbacks at Messenger -> Settings -> Webhooks -> Edit events.
You can see here that I have done this since the original setup of my bot, and I have even re-subscribed to it since:
But I am still getting this error:
I am logging any request that comes into my webhook and there is no activity, even though clicking the button, shows the payload value in blue as if I typed and sent it as a message. Then the popup "Action Unsuccessful" shows, and my bot doesn't receive anything.
Here is the response to FB with the button attachment elements:
{
"recipient": {
"id": "xxxxxxxxxxx"
},
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "list",
"top_element_style": "compact",
"elements": [{
"title": "transfer",
"subtitle": null,
"image_url": "http://xxxxxxx",
"buttons": [{
"type": "postback",
"title": "transfer",
"payload": "transfer"
}]
}, {
"title": "hourly",
"subtitle": null,
"image_url": "http://xxxxxxxx",
"buttons": [{
"type": "postback",
"title": "hourly",
"payload": "hourly"
}]
}]
}
}
}
}
The Page Access Token just needed to be updated in the webhook. Probably to apply the latest permissions that include messaging_postbacks.
Go back to developer app dashboard. Select Messenger >> Settings.
Scroll down to the "Token Generation" section:
Select your page from the dropdown, and copy the new access token for use in your webhook.
Found a lot of similar questions and no clear answers. So I hope this saves someone the days of headache it caused me.
Context
I'm developing a custom service in a .Net MVC Web Application that will connect to an OTRS web service to create/list/update tickets.
We are implementing many process workflows to make things works more efficiently.
Problem
I cannot find a way to "attach" a new ticket to a process, I know how to create a normal ticket, but not a process ticket.
I found a perl script that seems to do what I need to, but I cannot find a way to connect the problem with the solution.
Perl Script
ProcessTicketProcessSet()
Set Ticket's ProcessEntityID
my $Success = $ProcessObject->ProcessTicketProcessSet(
ProcessEntityID => 'P1',
TicketID => 123,
UserID => 123,
);
Returns:
$Success = 1; # undef
1 if setting the Activity was executed
undef if setting failed
Normal Ticket
URL:
http://someDomain.com.br/otrs/nph-genericinterface.pl/Webservice/SomeWebServiceName/Ticket?UserLogin=user&Password=abcd
Method: POST
Body:
{
"UserLogin": "user",
"Password": "abcd",
"Ticket": {
"Title": "REST - To Create Ticket",
"Type": "Unclassified",
"QueueID": "5",
"State": "new",
"Priority": "3 normal",
"CustomerUser": "someuser#someemail.com.br"
},
"DynamicField": [{
"Name": "CustomFieldOne",
"Value": "value1"
},
{
"Name": "CustomFieldTwo",
"Value": "value2"
}
],
"Article": {
"Subject": "Rest - Article Ticket",
"Body": "Test Article Creation",
"ContentType": "text/plain; charset=utf8"
}
}
How can I create a ticket that belongs to a process?
To create a ticket which belongs to a process you need to set two dynamic fields of a ticket.
ProcessManagementProcessID (which is representing the process)
ProcessManagementActivityID (which is representing the activity step of the process)
In case you also can set both dynamic fields later to set the process.
In case you do not know what values you need to set, just launch a process ticket via the UI and check via the ticket histories what values are set for both dynamic fields.
Has anybody ever successfully created a PayPal invoice with a specific chosen template?
I can't seem to get it to work.
Have tried specifying the template_id in the call, and have also tried setting the desired template as the default. In both cases, the API response contains the chosen template ID, but when the invoice is sent, it does not use the chosen template (can tell because there's no logo).
This the the API call:
curl -v -X POST https://api.paypal.com/v1/invoicing/invoices/ \
-H "Content-Type:application/json" \
-H "Authorization: Bearer <Access-Token>" \
-d '{
"template_id": "TEMP-66B140465N059453G",
"items": [
{
"name": "Part E",
"quantity": 2,
"unit_price": {
"currency": "USD",
"value": "10.15"
}
}
],
"shipping_info": {
"first_name": "John",
"last_name": "Doe",
"business_name": "Not applicable",
"phone": {
"country_code": "001",
"national_number": "5039871234"
},
"address": {
"line1": "1234 Broad St.",
"city": "Portland",
"state": "OR",
"postal_code": "97216",
"country_code": "US"
}
},
"shipping_cost": {
"amount": {
"currency": "USD",
"value": "15.01"
}
},
"allow_tip": false
}'
This is the response:
"id":<Invoice ID>,
"number":"0004",
"template_id":"TEMP-66B140465N059453G",
"status":"DRAFT",
"merchant_info":{},
"shipping_info":{"first_name":"John","last_name":"Doe","business_name":"Not applicable","phone":{"country_code":"001","national_number":"5039871234"},"address":{"line1":"1234 Broad St.","city":"Portland","state":"OR","postal_code":"97216","country_code":"US"}},
"items":[{"name":"Part E","quantity":2.0,"unit_price":{"currency":"USD","value":"10.15"}}],
"invoice_date":"2017-05-30 PDT",
"shipping_cost":{"amount":{"currency":"USD","value":"15.01"}},
"tax_calculated_after_discount":false,
"tax_inclusive":false,
"total_amount":{"currency":"USD","value":"35.31"},
"metadata":{"created_date":"2017-05-30 13:35:39 PDT"},
"allow_tip":false
If anybody has any ideas, would be happy to hear them.
Thanks.
We are correcting the instructions for how you use a Template ID. Sorry for the confusion.
When you are doing a basic integration to create and send an invoice, you don't need to use Template at all.
Template is useful if you are creating a full invoicing app where you want the end user (invoicer) to be able to create templates and access them when creating invoices. See the PayPal.com website for how templates are used.
Regards,
Kristen
I ended up getting in touch with someone at PayPal. They said that the merchant_info has to be passed in the request in order for the template to work.
That basically defeated the purpose of using the templates for us, so I never bothered testing that.
In the end, I just decided to not use a template.
if you are just looking to add your logo to your API created invoice, put this line at the end of your JSON before POSTing your draft:
},
"note": "Thank you for your business!",
"terms": "no refunds after 30 days",
"logo_url": "https://link_to_your_log.PNG"
}
Zendesk API documentation states that when creating a ticket through the API, the status field can be set to "new" (https://developer.zendesk.com/rest_api/docs/core/tickets#create-ticket), yet if I call the API with the following command specifying a value for status, it creates a token yet still sets status to be the default value of open:
curl -u <username>/token:<api_token> https://<subdomain>.zendesk.com/api/v2/tickets.json -d '{"ticket": {"subject":"test subject", "comment": { "body": "test body" }, "status": "new" } }' -H "Content-Type: application/json" -v POST
The relevant part of the response body is:
"ticket": {
"url": "https://<subdomain>.zendesk.com/api/v2/tickets/60.json",
"id": 60,
"external_id": null,
"via": {
"channel": "api",
"source": {
"from": {},
"to": {},
"rel": null
}
},
"created_at": "2016-05-05T13:30:01Z",
"updated_at": "2016-05-05T13:30:01Z",
"type": null,
"subject": "test subject",
"raw_subject": "test subject",
"description": "test body",
"priority": null,
"status": "open",
"recipient": null,
"requester_id": 5917202647,
"submitter_id": 5917202647,
"assignee_id": 5917202647,
"organization_id": 3740197137,
"group_id": 28473587,
"collaborator_ids": [],
"forum_topic_id": null,
"problem_id": null,
"has_incidents": false,
"due_at": null,
"tags": [],
"custom_fields": [],
"satisfaction_rating": null,
"sharing_agreement_ids": [],
"fields": [],
"brand_id": 1090897,
"allow_channelback": false
}
Am I doing something wrong?
So it turns out that if you assign a ticket to a group with only one member/agent, the ticket automatically gets assigned to that lone agent. As such, any ticket that's already assigned to a specific agent, is automatically set to open instead of new.
Because I was using a test subdomain, I was the only agent and so it was auto-updating the status from "new" to "open".
Hmm, I made the same API call (with my creds/subdomain) and it worked, setting the "status" to any option I choose (new, pending, solved).
Have you confirmed that all your credentials and subdomain are correctly inputted? Also, check the API settings in your Zendesk account. Try creating a new token and Save the settings.
If the API token still doesn't work, maybe try authenticating with password or making the request by means other than curl.