Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Zendesk and Corona
Started by agramonte May 31 2018 06:16 AM

No replies to this topic
zendesk api
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Contributor

  • 971 posts
  • Corona SDK

I use Zendesk for customer feedback. I have the cheapest plan $5.00 a month. Just sharing my implementation in case anybody wants to use it:

local json = require "json";
local requestBody = {}
	requestBody.request = {}
	requestBody.request.requester = {}
	requestBody.request.subject = "feedback" -- My form doesn't have a subject line. I default to this.
	requestBody.request.comment = {}
        requestBody.request.comment.body = message -- String of the message.
if not (email:match("^[%w.]+@%w+%.%w+$")) then -- Didn't provide an e-mail. So send anon feedback.
	requestBody.request.requester.name = "Anonymous customer"
else -- Email provided.
	requestBody.request.requester.name = email -- My form does not have a name line. I use the e-mail again.
	requestBody.request.requester.email = email	

local url = "https://<youraccount>.zendesk.com/api/v2/requests.json" -- Use your zendesk url.

local headers = {}
headers["Content-Type"] = "application/json"

local params = {}
params.body = json.encode (requestBody)
params.headers = headers
network.request( url, "POST", networkListener, params ) -- networklistener replies back the response.