Skip to main content
https://travis-ci.org/Overseas-Student-Living/nameko-salesforce.svg?branch=extract-from-internal-salesforce-lib

Nameko Salesforce

A Nameko extension with entrypoints for handling Salesforce Streaming API events and a dependency provider for easy communication with Salesforce REST API.

The Streaming API extension is based on Nameko Cometd Bayeux Client and the REST API dependency id based on Simple Salesforce.

Quick Start

Install from PyPI:

pip install nameko-salesforce

Create a service which handles Salesforce Contact objects changes and also has an RPC endpoint for creating new Contact objects in Salesforce:

# service.py

from nameko.rpc import rpc
from nameko_salesforce.streaming import handle_sobject_notification
from nameko_salesforce.api import SalesforceAPI

class Service:

    name = 'some-service'

    salesforce = SalesforceAPI()

    @handle_sobject_notification('Contact', exclude_current_user=False)
    def handle_contact_updates(
        self, sobject_type, record_type, notification
    ):
    """ Handle Salesforce contacts updates
    """
    print(notification)

    @rpc
    def create_contact(self, last_name, email_address):
    """ Create a contact in Salesforce
    """
    self.salesforce.Contact.create(
        {'LastName': last_name,'Email': email_address})

Create a config file with essential settings:

# config.yaml

AMQP_URI: 'pyamqp://guest:guest@localhost'
SALESFORCE:
    USERNAME: ${SALESFORCE_USERNAME}
    PASSWORD: ${SALESFORCE_PASSWORD}
    SECURITY_TOKEN: ${SALESFORCE_SECURITY_TOKEN}
    SANDBOX: False

Run the service providing your Salesforce credentials:

$ SALESFORCE_USERNAME=rocky \
  SALESFORCE_PASSWORD=*** \
  SALESFORCE_SECURITY_TOKEN=*** \
  nameko run --config config.yaml service

Finally, open another shell and call the RPC endpoint to create a new user:

$ nameko shell --config config.yaml
In [1]: n.rpc['some-service'].create_contact('Yo', 'yo@yo.yo')

You should see a new contact created in Salesforce and your service should get a notification. In the first shell you’ll find the notification printed:

{'event': {'replayId': 1, 'type': 'created' ...

For more checkout the documentation.

Metadata

Release files for nameko-salesforce 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nameko-salesforce 1.2.0
File Size Uploaded Provenance
nameko-salesforce-1.2.0.tar.gz 19.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nameko-salesforce 1.2.0
File Interpreter ABI Platform
nameko_salesforce-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.7 kB

Release files / nameko-salesforce-1.2.0.tar.gz

Download URL nameko-salesforce-1.2.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
48d13a4a54bc32858720ad3d5604c2256fe08b0e2021decaaf120f79f87f1252
BLAKE2b-256 checksum
How to use checksums
f60178c7823d174ac4a323a13cb159a114c4e2abd92adaf3ee2f90a303a9ed46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.6

Release files / nameko_salesforce-1.2.0-py3-none-any.whl

Download URL nameko_salesforce-1.2.0-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfb1cc3a518a5c7ac8d36f2b9444cff4327585b1eb0d0122d5dc64ea03af6d15
BLAKE2b-256 checksum
How to use checksums
c82a99403e3bfa7cb296e1abaace699beea3cc14d3b6598d6b802e4c676c3523
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.6

Security for nameko-salesforce 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page