Turn-Io-Adapter

Transform api

Objective

To provide users facility to transform the data received from the pgr to the user WhatsApp chatbot. It can be performed in two ways.

  • Search by complaint Id

  • Search by Application

Overview

Turn-io-adapter is a system that is used for taking the data from the rainmaker-pgr and it will creates the complaint and after creating the complaint it will return to the citizen whatsapp chatbot.

Pre-requisites

Before you proceed with the configuration, make sure the following pre-requisites are met -

  • Java 8

  • Kafka server is up and running

  • Rainmaker-PGR service is running

Key Functionalities

  • Employee of turn-io-adapter with Anonymous role can create, update or search the complaint

  • Turn-io-adapter service internally call rainmaker-pgr to generate a complaint

Deployment Details

  1. Deploy the latest version of turn-io-adapter

Configuration Details

MDMS Configuration

Turn-io-adapter MDMS Configuration is sufficient

Business Service / Workflow Configuration

NA

Actions & Role Action Mapping


Actions

{ "id": 2116, "name": "Create Turn Io Adapter", "url": "/turn-io-adapter/_transform", "displayName": "Turn Io Adapter", "orderNumber": 1, "enabled": true, "serviceCode": "turn-io-adapter", "code": "null", "path": "" }


Role Action Mapping



{ "code": "ANONYMUS", "name": "Any User", "description": "Can Transform the Data" }

Data Setup

Sample Curl

curl --location --request POST 'http://localhost:8084/turn-io-adapter/_transform' \ --header 'Content-Type: application/json' \ --data-raw '{ "RequestInfo": { "apiId": "Rainmaker", "ver": ".01", "action": "_create", "did": "1", "key": "", "msgId": "20170310130900|en_IN", "requesterId": "" }, "contacts": [ { "profile": { "name": "Gauthamraj Elango" }, "wa_id": "9487231521" } ], "messages": [ { "_vnd": { "v1": { "author": { "id": "919487231521", "name": "Gauthamraj Elango", "type": "OWNER" }, "chat": { "assigned_to": 4354, "owner": "+919487231521", "permalink": "https://app.turn.io/c/96424fbf-2ec6-427b-9bd4-b3bfcbae20ff", "state": "OPEN", "state_reason": "Re-opened by inbound message.", "unread_count": 8, "uuid": "96424fbf-2ec6-427b-9bd4-b3bfcbae20ff" }, "direction": "inbound", "faq_uuid": 456464, "in_reply_to": 34543645, "inserted_at": "2021-01-05T09:17:15.449857Z", "labels": [ { "confidence": 0.3727492629, "metadata": { "nlu": { "confidence": 0.3727492629, "intent": "await_reply", "model_name": "nlu-general-spacy-ngrams-20191014" } }, "uuid": "94a3dc3b-e633-4ed4-b4ec-c0979bf4f2bc", "value": "Unclassified" } ] } }, "from": "919487231521", "id": "ABEGkZSHIxUhAgo69TyLCAyZy6dM", "text": { "body": "Report" }, "timestamp": "1609838235", "type": "text" }, ], "thread": { "contact": { "birthday": 34335435, "campaign_name": 465767, "event_name": "CHSsolversfest", "language": 32434, "location": 32435456, "name": "Erase", "opted_in": true, "opted_in_at": "2020-10-29T05:44:51.309526Z", "partner_demo": 78987, "persona_type": 7686, "project_name": 4354, "report_category": 232, "report_pincode": "638057", "report_subcategory": "Sanitation", "issueCategory": "BurningOfGarbage", "ward": "SC7", "city": "pb.amritsar", "school_code": 123, "surname": 123, "ward_number": "4", "whatsapp_id": "919487231521", "whatsapp_profile_name": "Gauthamraj Elango" } } }'

 

Integration

Integration Scope

Turn-io-adapter will be integrated with Rainmaker-pgr Application. Turn-io-adapter Application internally invoke the rainmaker-pgr service to generate the complaint.

Steps to Integration

  1. Turn-Io-adapter application to call turn-io-adapter/_transform to generate the complaint and takes the data from the pgr.