Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Source: Append surveyResponse as message #2323

Closed
steffh opened this issue Aug 23, 2021 · 0 comments · Fixed by #2471
Closed

Google Source: Append surveyResponse as message #2323

steffh opened this issue Aug 23, 2021 · 0 comments · Fixed by #2471

Comments

@steffh
Copy link
Collaborator

steffh commented Aug 23, 2021

Is your feature request related to a problem? Please describe.

As an Airy API user having enabled channels of type google,
I want to be able to receive a surveyResponse that end users give in the form of ratings,
as messages appended to the relevant conversation

Describe the solution you'd like

Event Payload received by Google:

{
  "agent": "brands/BRAND_ID/agents/AGENT_ID",
  "sendTime": "SEND_TIME",
  "conversationId": "CONVERSATION_ID",
  "requestId": "REQUEST_ID",
  "surveyResponse": {
    "survey": "conversations/CONVERSATION_ID/surveys/SURVEY_ID",
    "rating": "SURVEY_RATING",
    "createTime": "CREATE_TIME",
    "surveyQuestionId": "QUESTION_ID",
    "questionResponseText": "RESPONSE_TEXT",
    "questionResponsePostbackData": "RESPONSE_POSTBACK_DATA",
    "questionType": "QUESTION_TYPE",
    "questionIndex": QUESTION_INDEX,
    "totalQuestionCount": TOTAL_QUESTION_COUNT,
    "surveyTriggerSource": "TRIGGER_SOURCE"
  }
}

Source: https://developers.google.com/business-communications/business-messages/guides/build/surveys?method=console#receive

Should be appended as an additional message to the conversation as such:

{
  "type": "message",
  "payload": {
    "conversation_id": "{UUID}",
    "channel_id": "{UUID}",
    "message": {
      "id": "{UUID}",
      "content": {
         "agent": "brands/BRAND_ID/agents/AGENT_ID",
         "sendTime": "SEND_TIME",
         "conversationId": "CONVERSATION_ID",
         "requestId": "REQUEST_ID",
         "surveyResponse": { OBJECT_FROM_EVENT }
      },
      "delivery_state": "pending|failed|delivered",
      // delivery state of message, one of pending, failed, delivered
      "from_contact": true,
      "sent_at": "{string}",
      "source": "google"
    }
  }
}

Describe alternatives you've considered

Additional context

@chrismatix chrismatix self-assigned this Oct 8, 2021
@chrismatix chrismatix added this to To do in Engineering WIP via automation Oct 8, 2021
@chrismatix chrismatix moved this from To do to In progress in Engineering WIP Oct 8, 2021
Engineering WIP automation moved this from In progress to Done Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

2 participants