> ## Documentation Index
> Fetch the complete documentation index at: https://developer.meetergo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Signatures from Salesforce

> Send a signature template for a Salesforce record and get its status and signed PDF back on the record

A Salesforce Flow sends a meetergo signature template for one record. meetergo
fills the document from the record's fields, the customer signs, and the record
gets its status and the signed PDF as a File.

```mermaid theme={null}
sequenceDiagram
    participant Flow as Salesforce Flow
    participant API as meetergo API
    participant Signer
    Flow->>API: POST /v4/signatures/from-template (record ID)
    API->>Flow: reads the template's fields from the record
    API-->>Flow: 201 with the signing link
    API->>Flow: Status__c = "sent"
    API->>Signer: invitation (email, SMS or link)
    Signer->>API: signs
    API->>Flow: signed PDF as a File on the record
    API->>Flow: Status__c = "signed"
```

## Before you start

* Salesforce is connected under **Integrations → Salesforce**. meetergo reads and
  writes with that connection's user, so that user needs read access to every
  field the template uses and edit access to the status field.
* An API key (**Settings → API keys**). API keys need the API Platform.
* A signature template whose fields read Salesforce (next step).

## 1. Bind template fields to the record

In the template editor, pick a text, number or checkbox field and set
**Data from → Salesforce field**. Enter the field's API name:

| API name | Reads |
| - | - |
| `Amount__c` | a field on the record |
| `Application__r.Name` | a field on the record a lookup points to (one level) |
| `Owner.Name` | standard lookups work the same way |

Turn on **Signer cannot change it** to print the value into the PDF. A locked
field whose value is empty stops the send with `LOCKED_FIELDS_EMPTY`, so a
document never goes out with a gap.

Values are written the way the signing language writes them: dates as
`01.12.2026` in German, numbers with the field's decimals (`1.234,50`),
picklists by their label, checkboxes as Yes/No. A checkbox field bound to a
Salesforce checkbox is ticked when it is true. Currency and percent fields
carry no symbol, so the PDF can print its own `€` or `%`.

## 2. Find the template and its roles

```bash theme={null}
curl https://api.meetergo.com/v4/signatures/templates \
  -H "Authorization: Bearer ak_live:..."
```

Each template lists its `roles` (who signs or gets a copy) and its `fields`
with their `binding`.

## 3. Send for a record

```bash theme={null}
curl https://api.meetergo.com/v4/signatures/from-template \
  -H "Authorization: Bearer ak_live:..." \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "6f1c...",
    "language": "de",
    "signers": [
      { "role": "Customer", "name": "Jane Doe", "phone": "+4915112345678",
        "deliveryChannel": "sms" }
    ],
    "requireOtp": true,
    "otpChannel": "sms",
    "salesforce": {
      "object": "Agreement__c",
      "recordId": "a0X5g00000AbCdEEAV",
      "statusField": "Status__c",
      "statusValues": { "sent": "sent", "completed": "signed", "cancelled": "cancelled" }
    }
  }'
```

* `signers` takes one person per template role, by role key or label. A
  template with a single role needs no `role`.
* `values` fills fields set to **Fill in when sending**. A locked field cannot
  be given a value: it always prints its source.
* `statusValues` are optional per state. For a restricted picklist they must be
  values of that picklist.
* `attachSignedDocument` (default `true`) attaches the signed PDF to the record.

The response is the signature request with its `signingUrl` and a
`salesforce` reference. Keep its `id` on the record if you want to cancel it
later.

### One open request per record

While a request for a record is open, another send for the same record answers
`409` with `SALESFORCE_RECORD_HAS_OPEN_REQUEST` and the open request's
`openSignatureRequestId`. A Flow that runs twice therefore never texts the
customer two links. Cancel the open one to send again:

```bash theme={null}
curl -X DELETE https://api.meetergo.com/v4/signatures/{id} \
  -H "Authorization: Bearer ak_live:..."
```

### What is checked before anything is sent

| Code | Meaning |
| - | - |
| `SALESFORCE_NOT_CONNECTED` | The company has no Salesforce connection |
| `SALESFORCE_RECORD_ID_INVALID` | Not a 15 or 18 character record ID |
| `SALESFORCE_OBJECT_UNKNOWN` | No such object, or the connected user cannot see it |
| `SALESFORCE_FIELD_UNKNOWN` | A template field reads an API name the object lacks (`unknownFields`) |
| `SALESFORCE_STATUS_FIELD_INVALID` | Status field missing, read-only, not text or picklist, or a value the picklist lacks |
| `SALESFORCE_RECORD_NOT_FOUND` (404) | No such record for the connected user |
| `LOCKED_FIELDS_EMPTY` | Locked fields without a value (`emptyLockedFields`) |
| `SALESFORCE_UNAVAILABLE` (502) | Salesforce did not answer; try again |

## 4. What comes back to the record

| When | Written |
| - | - |
| Sent | `statusValues.sent` |
| Everyone signed | the signed PDF as a File, then `statusValues.completed` |
| Cancelled | `statusValues.cancelled` |

Write-backs run in the background and are retried after 1 minute, 5 minutes,
30 minutes, 2 hours and 12 hours when Salesforce is unreachable, rate-limited or
the connection has expired. A record that was deleted, a field the user cannot
edit or a value a validation rule refuses is not retried. Each write sets the
state the request is in at that moment, so a delayed retry never turns
"signed" back into "sent". A retried upload is not attached twice.

The [`signature_completed`](https://developer.meetergo.com/developer-docs/webhooks/events#signature_completed)
webhook carries the same `salesforce` reference.

## Calling meetergo from a Flow

1. In Setup, create an **External Credential** with a custom header
   `Authorization: Bearer ak_live:...` and a **Named Credential** for
   `https://api.meetergo.com` that uses it.
2. Give the Flow's running user access to the External Credential's principal
   through a permission set.
3. In Flow Builder, add an **Action → Create HTTP Callout** for
   `POST /v4/signatures/from-template` on that Named Credential, with the
   request body above. Map the record's ID and the signer's name and mobile
   number from the record.
4. Store the response `id` on the record, and handle `409` (already open) and
   `400` (fix the data) in a fault path.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.