Search code examples
pythonapisalesforcechatbot

How to create a case in a Salesforce using python


please help, I am trying to create a case in Salesforce account using external live agent chat. Like email to case or whats app to case works how external the chat-bot works in Salesforce?


Solution

  • Use the standard REST API Endpoint URI

    First done authentication

    from simple_salesforce import Salesforce
    sf = Salesforce(
    username='user name of salesforce account', 
    password='password', 
    security_token='token')

    URI : /services/data/v41.0/sobjects/Case

    Operation : POST Body : JSON

    Sample post parameter list

    data ={
        "Subject" : "Radio is repaired",
        "Priority" : "high",
        "Description":"Radio has damaged because of handling."
    }
    
    x = sf.Case.create(data)

    It create a case in Salesforce case object using REST API