For the complete documentation index, see llms.txt. This page is also available as Markdown.

IO Signature

This page describes implementing IO Signature and toggling it on

IO Signature is an optional feature that prevents clients from onboarding phone numbers without authorization from the partner platform.

We recommend partners use IO signatures to enhance their platform security.

Implementing IO signatures requires adding a new server endpoint.

IO Signature Implementation

2

Prepare String to Sign

Prepare the string to sign with the platform secret. The string is the partner's ID and timestamp now in UNIX seconds separated by a pipe character. Example:

{partnerId}|{timestampSeconds}

If the partner's ID is aAbBcCPA, and the timestamp is 1775653748, the string to sign would look like:

aAbBcCPA|1775653748

Avoid caching

Caching this string preparation step, or the signing step below, is not recommended (e.g. generating every N minutes).

Replay protection prevents reusing the same signature across multiple onboarding attempts.

3

Compute Signature

The signature must be computed using HMAC-SHA512. Sign the string prepared in Step 2 using the platform secret acquired in Step 1.

Below are code samples for Python, Node.js, and PHP.

# io_signature.py

import os
import time
import hmac
import hashlib

partner_id = "Your partner ID here"

# Platform secret should be passed as an environment variable as best practice
secret = os.getenv("PLATFORM_SECRET")

def generate_signature(partner_id: str, secret: str) -> dict:
    if secret is None or secret.trim() == "":
        raise Exception("ERROR: No platform secret provided")
        
    timestamp = int(time.time())
    message = f"{partner_id}|{timestamp}"
    
    signature = hmac.new(
        secret.encode("utf-8"),
        message.encode("utf-8"),
        hashlib.sha512
    ).hexdigest()

    return {
        "timestamp": timestamp,
        "signature": signature,
    }
4

Serve Signature and Timestamp

Partner's server must generate the signature and timestamp at each authenticated request, and serve them to users before they start onboarding a phone number.

If the app is rendered client-side, the server must have a REST endpoint for requesting a signature and timestamp.

If the app is rendered server-side, the server can also ship the signature and timestamp in the page's HTML.

Below are REST API endpoint samples for Python, Node.js, and PHP, each serving at GET /api/sign_io.

# server.py

import os
import time
import hmac
import hashlib
from flask import Flask, jsonify
from io_signature import generate_signature # Sample shown in Step 3

app = Flask(__name__)

@app.get("/api/sign_io")
def signature():
    return jsonify(generate_signature())

Enable IO Signature

3

Test IO Signature

Get a signature and timestamp from your server's signature endpoint, exampled under IO Signature Implementation.

Click Test in the UI, then paste the signature and timestamp, and finally click Test.

4

Toggle IO Signature

Enable IO Signature by clicking the toggle next to IO Signature if:

  • The test in Step 3 was successful,

  • The frontend successfully requests a signature from the backend,

  • And frontend correctly passes the IO signature + timestamp to the integrated onboarding link.

Enabling this toggle will enforce a valid IO signature + timestamp on all onboarding attempts.

IO Security Measures

When IO Signature is enabled, 360Dialog protects against integrated onboarding link staleness and reuse.

Signatures older than 24 hours are automatically rejected.

Suggestion

Store in the frontend when the signature was received. When the user attempts to start onboarding, check if the signature was received more than 24 hours ago; if true, get a new signature.

Replay protection is active for 48 hours per used signature.

When a signature is first used to attempt integrated onboarding, any further attempts to use the signature are blocked. As a result, users cannot use the same integrated onboarding link to perform multiple onboarding attempts.

Suggestion

Issue a new signature + timestamp per onboarding attempt.

Examples of Using IO Signatures

Direct URL

Connect button Setup:

Vanillajs/HTML:

After the Embedded signup, if the signature has been manipulated or expired within 24 hours, then the FB callback fails and returns this error:

Last updated

Was this helpful?