Create a Zendesk ticket using a URL - url

How can I create a Zendesk ticket with a subject using a URL?
We have a customer support center using Zendesk. We also have a VoIP phone system that can fire off a URL when a call comes in. I understand that using the Zendesk API I can create tickets, but to do that I need to authenticate using JSON. My VoIP system doesn't have that option so I would have to build a web app that takes in a URL and converts it in to a secure JSON connection. Instead, I'd like to have our agents logged in to Zendesk and then have the phones launch a simple URL with the caller ID upon incoming call.
In Zendesk I see this URL:
https://mydomain.zendesk.com/agent/#/tickets/new/1
But I haven't found any documentation regarding adding a subject and/or description.
What URL can I use to create a new Zendesk ticket and supply arguments (using a GET request) to fill out the subject and/or message?

In general, it isn't possible with a GET request. Their API requires POST http://developer.zendesk.com/documentation/rest_api/tickets.html#creating-tickets
What I would do is host a server/application on a network server that has a simple API - django has simple URL parsing. The phone would create a URL like this yourinternaldomain.org/ticketspawner/create/[number]/name/[caller_id_name]
The app parses [number] and [caller_id_name] from the URL and can create a new ticket based on the phone number and caller_id_name (perhaps you want to create the user first). You can use python or curl or whatever you like.
From their page:
curl https://{subdomain}.zendesk.com/api/v2/tickets.json \
-d '{"ticket":{"requester":{"name":"The Customer", "email":"thecustomer#domain.com"},
"submitter_id":410989, "subject":"My printer is on fire!", "comment": { "body":
"The smoke is very colorful." }}}' \
-H "Content-Type: application/json" -v -u {email_address}:{password} -X POST

Related

Telegram URL to send message to specific bot

Is it possible to craft a t.me URL that prompts the user to send a specific message to a specific bot. The closest I've found so far is t.me/share/url?url=my%20message, but that doesn't specify a username so the user has to choose one. I don't see the t.me URLs documented anywhere.
Note: this is not the same as sending a message via the API.
You can use deep linking to bot, use following format like this link:
https://t.me/username?start=<token>
Your backend will receive /start <token> . The user however will just see normal
/start
on their chat window.

how to send a message to a slack channel?

This must be completely obvious and I am sure I am missing something here but here it goes:
according to slack documentation :
curl -X POST -H 'Content-type: application/json' \
--data '{"text":"This is a line of text.\nAnd this is another one."}' \
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
but where do I find my account specific parameters to go in here :
T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
According to this page https://www.programmableweb.com/news/how-to-integrate-webhooks-slack-api/how-to/2015/10/20
You get that URL by clicking "Add Incoming Webhook Integration"
When you're done doing whatever it needs, it gives you the URL you need to post to. It's a bit different than using an API token.
As has already been pointed out this is an incoming webhook, which is an easy way to post messages to Slack. The full URL is arbitrary and will be automatically generated for your as soon as you have created the webhook for your Slack team
On the official documentation page about incoming webhooks I am guessing you missed the link in the 2nd paragraph ;-)
"Start by setting up an incoming webhook integration...".
Just click the link to set up your webhook.

How to gain user permission and create slack channel in ruby

I want to give the user updates from my app by creating a channel in his team. So I want to do 2 thing:
create a channel (e.g #coolapp) for my user (in his slack team)
send all update from my app to that coolapp channel
Thanks for stoping by.
To create a channel you need (at a minimum) the channels:write scope (https://api.slack.com/docs/oauth-scopes) which I doubt your client will grant. The best and easiest thing to do is to create a custom integration with the incoming-webhook scope which allows you to post messages to a channel selected by the user (not by you). The customer can install your custom integration (app) using a Slack Button and if you set it up correctly with an incoming-webhook; then when they install the app, they will select which channel your messages will post to.
This is all explained in more detail here.
Posting messages to the channel via the webhook is then really simple. From the docs:
curl -X POST \
--data-urlencode 'payload={"text":"This is a line of text.\nAnd this is another one."}' \
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

Spree commerce: User Login through API

I am pretty newbie using Spree and I am just playing around with the 3.0 stable version.
I would like to log a user account into the store through API (or something like that) using the chrome app called "Advanced REST client", then visit the store and see the account logged there.
I couldn't find any reference for this kind of actions which involve users or accounts through API in https://guides.spreecommerce.com/api/. However, I noticed that if you make a POST request to localhost:3000/login sending the account details, you get the html code of the store which says that your were successfully logged.
After that I checked my browser cookies and the store session cookie was also created successfully. Finally, when I redirect the browser to the store (localhost:3000), the account is not logged in but the cookie still remains there.
I think is something related to the guest token generated by Spree, but I don't understand exactly why it doesn't work.
I would appreciate any help to clear this, also if you have any idea about how to get my goal it also would be appreciated.
In order to use a REST client, such as the Chrome app you mentioned, you have to authenticate against Spree's REST API. You need a spree api token to authenticate future request.
Have a look at the Spree Api Auth Gem. It allows you to you receive an api token like this:
\curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d ' {"user":{"email":"camelmasa#gmail.com", "password":"camelmasa"}}' http://localhost:3000/api/users/sign_in
You can also create new user account using this gem. Since Spree is using devise underneath, you can also use devise directly to authenticate your user.

Facebook Graph API and app secret

I have an iOS application that I'm logging to Facebook to ask for an access_token.
Then I pass this access token to my server and I want to get the '/me' information, using my appsecret_proof but I noticed that I can do it without appsecret_proof:
curl "https://graph.facebook.com/me?access_token=THE_ACCESS_TOKEN"
{"id":"658267751","name":"Ricardo Otero",
"first_name":"Ricardo","last_name":"Otero",
"link":"https:\/\/www.facebook.com\/oterosantos",
"hometown":{"id":"107911285910314","name":"Coimbra, Portugal"},
"location":{"id":"110432202311659","name":"Lisbon, Portugal"}...
Although I have set the option "App Secret Proof for Server API calls" to true:
So, shouldn't the requests require the app secret? I don't get it!
Every access_token depends on app and user so for different app and user combination you will have different access token so you don't need to worry. though I am no sure why are you doing it this way
http://m-farhan.com/2014/03/ios-facebook-sdk-tutorial/
is the right way of doing this.
I am also navigating through the Facebook API "appsecret_proof" parameter -- here are the official docs on Facebook Developers Website:
https://developers.facebook.com/docs/graph-api/securing-requests#appsecret_proof -- it looks like this example PHP call can help you out:
$appsecret_proof= hash_hmac('sha256', $access_token, $app_secret);
Here's the Example Command-Line call they display:
curl \
-F 'access_token=<access_token>' \
-F 'appsecret_proof=<app secret proof>' \
-F 'batch=[{"method":"GET", "relative_url":"me"},{"method":"GET", "relative_url":"me/friends?limit=50"}]' \
https://graph.facebook.com
Here's someone who made a similar call with a Node.JS Server(dosen't look there is speciifc FACebook/API/SDK referecne though... :
Get signed_request in Node.js (Express) Facebook canvas app

Resources