Backend method

This approach assumes that you generate an opt-in URL on your server side, and then return it to your user.

Send a single message to specific recipient

POST https://a.loopmessage.com/api/v1/opt-in/geenrate-url/

You can use a contact ID or a phone number/email address (depending on what the user provided you with when subscribing).

Headers

Name
Type
Description

Authorization*

String

API Key. Required*.

Content-Type*

String

application/json

Request Body

Any fields that you pass in the JSON, will be returned in the webhook when user complete the opt-in process.

Request with custom Body example:

{
  "body": "Hey guy, want to test end-to-end analytics a little? [opt-in-code]",
  "click_id": "asdasads1241412fdsf",
  "utm_campaign": "credit on card online",
  "utm_medium": "google"
}

In case of customize opt-in text, you can use the next method:

body with [opt-in-code] is a mandatory parameter. The server replaces [opt-in-code] with a unique user code, which is required by the system to match opt-in with a specific contact.

Response

The API response contains unique links generated for the provided data. Example response:

{
  "id": "3718be9c-17bc-412e-9790-c4768ca5df3e",
  "imessage": "imessage://ahoy%40imsg.tel&body=Hey%20guy%2C%20want%20to%20test%20end-to-end%20analytics%20a%20little%3F%20%22%23FHyh-%21dfaN%22",
  "sms": "sms:ahoy%40imsg.tel&body=Hey%20guy%2C%20want%20to%20test%20end-to-end%20analytics%20a%20little%3F%20%22%23FHyh-%21dfaN%22",
  "url": "https://opt-in.imsg.link/opt-in/0Rig0/?id=3718be9c-17bc-412e-9790-c4768ca5df3e&body=Hey%20guy%2C%20want%20to%20test%20end-to-end%20analytics%20a%20little%3F%20%22%5Bopt-in-code%5D%22"
}

These links must be used to subscribe the user to the mailing list.

Copy

{
    "contact": "+155566678958",
    "event": "message_inbound",
    "language": {
      "code": "de",
      "name": "German"
    },
    "message_id": "2a12f7ed-da37-49fd-bbf9-e2965adfb01d",
    "organization_id": "e2229e7b-29df-486d-924e-7dae925b0796",
    "parameters": {
      "click_id": "asdasads1241412fdsf",
      "utm_medium": "google",
      "utm_campaign": "credit on card online"
    },
    "text": "Hey guy, want to test end-to-end analytics a little?",
    "type": "opt_in",
    "webhook_id": "d37985d1-d648-4d42-ac69-ae72e08da86e"
}

Key Points

  1. The backend script is mandatory to avoid CORS restrictions.

  2. The response contains links for user interaction:

    • iMessage: For iOS 13 and above.

    • SMS: For iOS 12 and below.

  3. When using smart links (URLs returned by the server), the user must grant the browser permission to open the iMessage app.

Last updated