How to get text response in survey monkey via API - surveymonkey

I'm currently getting responses from SurveyMonkey using the v3 APIs...
I'm using the /collectors/{id}/responses/{id}/details call and I successfully getting the resp. BUT the resp has got the IDs and not the text values e.g.
{
"id": "111788228",
"answers": [
{
"choice_id": "828117913"
}
]
}
1) Can I get SM to send me the text answer?
2) If I can't how can I get the text value using the choice_id.
Thanks in advance.

There isn't a way currently to get the Survey text directly with the responses. You'll have to fetch the survey details or the details for a specific question and match the choice ID with the text for that choice on your own.
GET /v3/surveys/<survey_id>
or
GET /v3/surveys/<survey_id>/pages/<page_id>/questions/<question_id>
You'll get a body back with the choices like this:
{
...
"answers": {
"choices": [{
"id": "12345",
"visible": true,
"is_na": false,
"text": "Apples",
"position": 1
}, ...]
},
...
}
Then you can just match the id field with the choice_id field from the response.

Now there is 'bulk' API.
Look at the 'simple' option:
GET /surveys/{id}/responses/bulk?simple=true

Related

Using an API with Zapier but getting "The app returned ""rest_data" param is incorrect. JSON data expected"."

So i grab data from an Airtable and then have a custom PUT as the second action using Samba Lives API, specifically Sessions -> PUT Session https://documenter.getpostman.com/view/2014682/samba-live-rest-api/6YzutHM#c87c1db7-2b5c-9b2b-7d63-6b531793cfe2
This is the data in the custom PUT:
Method: PUT
URL: https://samba.live/api/2/ourusername/session
Data Pass-Through? No
Data:
input_type=json&rest_data={
"topic": "Crazy Topic",
"duration": 30,
"start_time": "2025-09-10 12:00:00",
"invited_participants":[
{
"email":"flast#company.com",
"first_name":"First",
"last_name":"Last",
"role":2,
"send_email_invitation":true
},
{
"email": "first.last#gmail.com",
"first_name": "First",
"last_name": "Last",
"role": 1,
"send_email_invitation": true
}
],
}
Unflatten- yes
Basic Auth- ourusername|ourpassword
Headers- none
But the test fails and says "App returned "rest_data" param is incorrect. JSON is expected."
I'm not really sure what to try and Zapier just said we don't help with that. Only thing i could think to try was to delete the input_type section, and that returned with an error saying "Topic is required." Same thing when i left most of it and just deleted the rest_data part.
Any ideas?
Fixed - apparently the comma after the ] threw everything off.

Microsoft Graph API: Different email address returned when using $select

Why am I getting different results in the "sender" address field when using $select?
In Microsoft Explorer when I run this query:
https://graph.microsoft.com/v1.0/me/messages?$filter=(contains(subject,'test'))
I get back this result in the "sender" field:
"sender": {
"emailAddress": {
"name": "John Doe",
"address": "jdoe#reshydradev.onmicrosoft.com"
}
},
But when I execute this query:
https://graph.microsoft.com/v1.0/me/messages?$filter=(contains(subject,'test'))&$select=sender
I get back the internal email for the "sender" field:
"sender": {
"emailAddress": {
"name": "John Doe",
"address": "/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=E0CC9D18EE294E43890D4830339D5-JDOE"
}
}
I want to limit data coming back from the endpoint with $select, but I do not want the internal email. Can I force it to return the non-internal email address?
I just had this problem and looks like selecting replyTo fixed it for me. (I'm selecting these: subject,receivedDateTime,sender,bodyPreview,from,replyTo)

AWS Lex Python Codehook references

I am still pretty new to Python (and coding) but I am trying to build my own Lex bot with a Lambda function. I have been following the tutorials and I can understand how it all works. Problem is when I am trying to write my own Lambda functions for Lex, I cannot find any references to help me write my code for example looking at the code below.
def get_slots(intent_request):
return intent_request['currentIntent']['slots']
What is "(intent_request)" and where would I find reference to this? Same for "['currentIntent'], how can I find out what it is and why it is there??
Sorry if this seems stupid to most people on here but I can't start writing code and continue to learn if I can't find any documentation to suggest what these are and why they are needed in order to write code for my own Lex bots.
Thanks in advance!!!
The intent_request is the incoming "request" or "event" from Lex to your Lambda Function. It holds all the necessary information about the user's input and your Lex bot's processing of that input (trigger certain intent, fill certain slots, confirmations, etc.)
This should be the documentation you are looking for.
Lambda Function Input Event and Response Format:
This section describes the structure of the event data that Amazon Lex provides to a Lambda function. Use this information to parse the input in your Lambda code. It also explains the format of the response that Amazon Lex expects your Lambda function to return.
And here is the Event/Request format:
{
"currentIntent": {
"name": "intent-name",
"slots": {
"slot name": "value",
"slot name": "value"
},
"slotDetails": {
"slot name": {
"resolutions" : [
{ "value": "resolved value" },
{ "value": "resolved value" }
],
"originalValue": "original text"
},
"slot name": {
"resolutions" : [
{ "value": "resolved value" },
{ "value": "resolved value" }
],
"originalValue": "original text"
}
},
"confirmationStatus": "None, Confirmed, or Denied (intent confirmation, if configured)"
},
"bot": {
"name": "bot name",
"alias": "bot alias",
"version": "bot version"
},
"userId": "User ID specified in the POST request to Amazon Lex.",
"inputTranscript": "Text used to process the request",
"invocationSource": "FulfillmentCodeHook or DialogCodeHook",
"outputDialogMode": "Text or Voice, based on ContentType request header in runtime API request",
"messageVersion": "1.0",
"sessionAttributes": {
"key": "value",
"key": "value"
},
"requestAttributes": {
"key": "value",
"key": "value"
}
}
The slots data is found inside currentIntent and that is inside of this whole intent_request object. That is why you are seeing the code: intent_request['currentIntent']['slots']
So to get session attributes you can find them here: intent_request['sessionAttributes']
Also extremely useful is the exact user input text:
intent_request['inputTranscript']

Getting respondent names and email addresses in SurveyMonkey's API v3

I'm upgrading my application from SurveyMonkey's API v2 to v3 and using the liogi/surveymonkey-api-v3 library to wrap around my API calls and am not sure if I'm understanding how respondent info is being handled now.
The v2 endpoint POST /surveys/get_respondent_list would return data.respondents[_].email, .first_name, and .last_name, but its v3 equivalent doesn't.
Is it the case that with the API v3, this data can only be pulled from pages[_].questions[_].answers[_].text?
I hope not, because that makes pulling respondent names and email addresses way more complicated and seemingly necessitates knowing the question IDs that correspond to the correct fields for every survey. Am I misinterpreting the API, or has that "get respondent's email address" feature been gutted?
The email, first_name, and last_name are now all in the contact data in the metadata field provided in the response body when fetching a response.
So a request like:
GET /v3/surveys/<survey_id>/responses/<response_id>
will return something like this in the body:
{
...
"metadata": {
"contact": {
"first_name": {
"type": "string",
"value": "Test"
},
"last_name": {
"type": "string",
"value": "Example"
},
"email": {
"type": "string",
"value": "test#example.com"
}
}
}
...
}
Those 3 fields will also show up in the same place for the bulk responses endpoint.

Google Contacts API not showing emails, nor max results

I'm using the Google Contacts API to get back formatted JSON, hopefully containing ALL of a user's contacts' email addresses. I use this information to search my database for the user's friends.
Neither of these results occur.
Here's the URI that's called (broken up by paramater for slightly better readability:
http://www-opensocial.googleusercontent.com/api/people/#me/#all/?
filterby=emails&max_results=1000
&oauth_consumer_key=XXXXXXX
&oauth_nonce=h7ZEI
&oauth_signature=6U2ywoPRFu8iJdQhjMRk%2FZlf%2FBg%3D
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1283979209
&oauth_token=1%2Fwv9OYV4LuffVLv6OqlFJLOtTlBo5sYYQkHbZznlLrNk
&oauth_version=1.0
&orderby=starttime
Here's some truncated and anonymized JSON I have returned.
{
"startIndex": 0,
"totalResults": 615,
"entry": [
{
"id": "XXXXXXXXXXXXXXXXXXX",
"name": {
"formatted": "XXXXX XXXXXX",
"familyName": "XXXXXXX",
"givenName": "XXXXXX"
},
"displayName": "XXXXX XXXXXX"
},
],
"itemsPerPage": 20
}
Any thoughts on what's going wrong here would be great.
Hate to answer my own question so soon, but I was using the wrong initial scope. I was using Google's Open Social feed rather than the Google Contacts feed.

Resources