NAV

Introduction

Turn is a chat platform for personal, realtime support supercharged by AI

We provide an easy to use integration for MoyaApp detailed below. If you run into any issues, or have questions or feedback, please let us know by sending a message to api-support@moya.app.

Setup steps

Get a MoyaApp token and endpoint

Please contact us at api-support@moya.app with your details to get the account set up. We will provide you with a token, and optionally a number if you don't have an existing number to use.

Turn configuration

Our integration with turn is based on channel accounts documented here. Make sure you have a channel account set up before proceeding.

First make sure your Moya token is base64 url encoded. This can be done using the following command:

echo -n "your_moya_token" | base64 | tr '+/' '-_' | tr -d '='

Or using any other tool that can achieve the same result

In your Turn account, go to settings > API & Webhooks. Add a webhook endpoint as the follows

https://messaging-bridge.moya.app/v1/webhook/turn/<your base64 encoded moya token>

Create an authentication token by going to Settings > API & Webhooks. Click on "Create a Token" to create an authentication token.

Required Parameters

Once the steps above have been completed you will have all the required parameters to complete the integration.

Applying turn configuration

Once all the parameters above are ready, email them to api-support@moya.app

Testing the integration

Once the integration is complete you can send a test message using the following curl request:

Example Request

curl -X 'POST' \
  'https://messaging-bridge.moya.app/webhook/<bot phone number>' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "message":
    {
      "type":"text",
      "from":"number to receive response",
      "text":
        {
          "body":"chatbot wake word/phrase"
        }
     }
}'

Example Response

{
  "message": "success"
}

If the integration was successful you should see a message in your turn inbox