client.imports
Background contact-list imports and their results. These methods are on client.imports, where client is a MoreVoice client (see the Python SDK). On AsyncMoreVoice the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.
retrieve()
Section titled “retrieve()”Retrieve a contact import. Returns a background contact import: its status (pending, processing, then succeeded or failed), how many rows were received, imported and rejected, and why rows were rejected. Poll it until it succeeds or fails; importCsv in the SDK does that for you.
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.ContactImportclient.imports.retrieve() · await async_client.imports.retrieve() · GET /imports/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
str |
yes | A import ID (imp_…). |
Returns
Section titled “Returns”ContactImport:
| Field | Type | Description |
|---|---|---|
id |
string |
A import ID (prefix imp_). |
object |
"import" |
Always import. |
livemode |
boolean |
true in live mode, false in test mode. |
campaign_id |
string |
A campaign ID (prefix cmp_). |
status |
"pending" | "processing" | "succeeded" | "failed" |
pending → processing → succeeded | failed. Poll GET /v1/imports/{id}. |
source |
"csv" | "xlsx" | "url" |
— |
filename |
string | null |
— |
received |
integer |
Non-empty contacts / rows received. |
imported |
integer |
Contacts added to the campaign for dialling. |
rejected |
integer |
Contacts not added for dialling (invalid, duplicate, do-not-call). |
rejected_reasons |
ContactRejectedReasons |
Rejected contacts per reason. |
without_consent |
integer |
Marketing: contacts added without a consent record. The dialer skips them (§30A) unless consent is recorded first. |
consent_recorded |
integer |
Consent records created from the evidence sent. |
errors |
object[] |
Rejected rows (the first 100). |
warnings |
object[] |
Rows added with a problem (the first 100). |
error |
object | null |
Why the import failed (status failed): a stable code and a message to show. |
created_at |
string |
An ISO-8601 timestamp in UTC. |
started_at |
string | null |
— |
completed_at |
string | null |
— |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
contact_import = client.imports.retrieve("imp_7Hk2Lm9Qp")print(contact_import)