Piped text for Webservice params in qualtrics - web-services

My requirement is to get the email ID from the user in qualtrics and to invoke a webservice with email as a param at the end of the registration . The webservice will register the user in my site. Actually i am not getting how to get the piped text code for the email field(I created as a question for email). Also i couldn't see the option of GET/POST in the qualtrics webservice. Can anyone please help me how to generate a piped text code for the email question?

Under web service parameters you would have:
email = ${pipedTextField}
Where pipedTextField would be something like q://QID1/ChoiceTextEntryValue if it was a text question. An easy way to get the correct pipedTextField value is to create a temporary embedded data field and use the drop down to pick the piped text. Then copy that to your web service parameter field.
There is no GET/POST option. All web service calls are GET.
P.S. If my answer to your previous question about Qualtrics web service calls was helpful, please accept it.

Related

How to read webhook response in Dialogflow CX

I have created a simple Agent in Dialogflow CX. When the user enters a city name then it should list pin codes that belong to the entered city. In order to get the pin codes, I have performed a webhook POST request. The webhook URL returns the required pin code in JSON format but I don't know how I should display it in the chat.
Can I get some tutorial links? OR What changes I need to add in the Agent inorder to read the JSON response.
Don't know if this will actually solve your problem, but I recently had a similar doubt to yours and this cleared it up for me.
From Google's Documentation for CX Webhooks, the response message for a webhook call is structured with a fulfillment_response field: this contains what the bot will say to the user if the webhook call is successful.
So, to answer your question what should happen is this:
The user enters a city name, e.g. Atlanta
The bot extracts the city name with a parameter and stores it, for example, as the $intent.params.city_name
The bot also has "Enable Webhook for this page" enabled, and thus makes a Webhook request in JSON with a field called IntentInfo which contains a parameters field
You call your API o do your computation or whatever in your script
You build a WebhookResponse compliant with their format which contains a fulfillment_response field with a list of all ZIP codes for Atlanta in a format like such: "Here we are, these are $intent.params.city_name's ZIP codes: [your computed zipcodes]". For reference, there is an API package for most programming languages which can help you with that.
The bot will receive the JSON and directly respond to the user with what is inside the fulfillment_response field
Hope this solved your doubts!

Choosing the right place to write logic in a client/api/server solution

I'm currently designing a solution with this pretty standard pattern:
1 web-app using Django (it hosts the one and only DB)
1 client mobile app using AngularJS
This client app uses a REST API (implemented on the Django Server with Tastypie) to get and set data.
As a beginner in these architectures, I'm just asking myself where the logic should go and I'd like to use a simple example case to answer my concerns:
On the mobile client App, a client is asked to subscribe by entering only an email address in a form.
a) If the address is unused, inscription is done (stuff is written on the DB).
b) If the address is used, an error is raised, and the user is asked to try again.
What is the workflow to perform these simple operations?
I'm asking for example how to compare the entered e-mail address in the mobile app with the existing e-mail adresses in my DB:
Should I GET the list of all email adresses from the server, then perform the logic in my client app to state if the entered address already exists ? This seems really a bad way to do because getting lots of elements isn't performant with web services, and client should not be able to see all email adresses.
Should I send the entered e-mail address to the server and let it make the comparison? But if yes, how am I supposed to send the data? As far as I know, PUT/POST are made to write in the DB, not to just send data to server to analyse it and proceed some logic.
I have the feeling I am clearly missing something here...
Thanks a lot for help.
PUT and POST are designed to be used to create and update resources. The server may or may not have a database behind it. It might use a local filesystem, or it might handle anything in memory. It's none of the client's business. It is certainly common to have business logic on most servers which provide APIs.
Use PUT/POST to send up the email address to the server. The server checks to see if the email address is (a) valid, and (b) allowed. If it fails either check, return a relevant response to the client as documented in the RFC. I would go with 403 Forbidden, which indicates a problem with the data being sent up to the server. Use the entity in the response to detail what the problem was with the request.
I had done similar thing in a angular web app,
I have disabled the submit button, and added a check availability button beside the email field.
I have send the email to server and checked if it already exist and got the result to client,
then asked the user to enter an alternate email if not valid or enable the form's submit button
Alternatively
when the user leaves the email field, You can send the email to a service that validates the email, and get the response, and show a message that this email already exist and disable the submit, or enable the submit button otherwise

How To Log Into Web Service

A company has developed a web service for us. They have sent us the URL to the web service and the method and parameters we will need to call. They said that they would send us the secure API key and they just did. This key is in the format: ABCDE_IBMPC_Z12345 but no other instructions.
My question is, they did not send any instructions on how to log in with this secure API key. Is this something "generic" to all web services? Can someone tell me how to use this key to authenticate and log in so that I can call the method I need to call?
It will most likely need to be supplied as a querystring parameter... they should have told you what the parameter name is though :-)
It'll be something like ?api_key=ABCDE_IBMPC_Z12345

Salesforce: SOAP Login from Salesforce TO Salesforce

I implemented a batch job which makes a webservice call within the same salesforce instance, which then is supposed to send emails with a pdf attachment,
since you cannot send pdf attachments directly from a batch job. My webservice call looks like this:
public static void callOut(List ids){
InvoiceAttachmentConnector.InvoiceAttachmentService ws = new InvoiceAttachmentConnector.InvoiceAttachmentService();
ws.SessionHeader = new InvoiceAttachmentConnector.SessionHeader_element();
ws.SessionHeader.sessionId = UserInfo.getSessionId();
ws.handleInvoicePdfAttachment(ids);
}
However in batch jobs UserInfo.getSessionId() returns null, therefore i get a INVALID_SESSION_ID exception.
How can i log in to get a SessionId? So far I found no solution to login from salesforce to salesforce. If u can help I would appreciate it! Thanks!
You cannot get a session Id like this in batch apex as it runs under the system context and so has no specific user info for retrieval.
UPDATE:
You have the following options:
Try running the web services wsdl from your Salesforce org through the wsdl to apex generator in your org to generate some classes that may allow you to login. You are only allowed one web service request per execute call.
You could create a sites page that you make a HTTP get request to in your batch apex. This needs to retrieve the Ids of the items you want to send the PDFs for and a particular user to run as for you to use the System.runAs(user) method. You could pass these parameters in the HTTPRequest header or in a custom setting.
Note that neither of these solutions are ideal, you may want to reconsider why you are using Batch apex first of all and see whether you could reimplement it in a different way.

Django openid authentication with google

I am looking into authenticating via google.
I dont understand how it works:http://code.google.com/apis/accounts/docs/OpenID.html#Samples
If i do that 2nd request by entering the data as one url with params into browser i get back XML file. Should i not get back sample response nr3?
Can somebody explain this to me?
The problem is, that im trying to sort through some third party app that uses google openid authentication and its not recieving authenticated users e-mail back, like in sample response 3.
Alan
PS i have read through similar questions and their responses and gone through pages like:
How does OpenID authentication work?
http://www.windley.com/archives/2006/04/how_does_openid.shtml
http://tinisles.blogspot.com/2008/02/how-does-openid-work.html
http://openid.net/pres/protocolflow-1.1.png
What sort of XML file?
Remember that a checkid_setup request like that isn't something your application is meant to make with a direct connection, it's a request that's sent from the user's browser. So the response is going to be something for the browser to parse, prompt the user to log in if necessary, maybe ask the user for permission or which values it should send back, and only after all of that send back a redirect like in the sample response.