Partner workflow: Customer engagement

In this recipe, when we say customers, we are referring to your customers, and not the BILL customer entity.

When your customers onboard to the BILL platform for their Accounts Payable (AP) needs, you can engage with them via email and/or in-product messaging.

In this recipe

In this recipe, you build an API workflow that enables you to gather data about your customers. With this workflow, you retrieve all the BILL organizations enrolled by your customers, and then retrieve all the users (including their email addresses) in a selected organization.

When you sign in as a user, you can get a wide range of data, such as the list of bank accounts (to check whether the customer connected a funding bank account or completed bank account verification) and the list of payments (to check whether the customer made any transaction in the last 30/60/90 days).

Why engage with customers?

By engaging customers at key touch points based on their needs, you can encourage broader use of the BILL capabilities embedded in your application. Here are some reasons for engagement.

  • A customer started enrollment, but did not complete enrollment.
  • A customer completed enrollment, but did not add a funding bank account for making payments.
  • A customer completed enrollment, added a funding bank account, but did not complete their bank account verification.
  • A customer has not made a transaction in the last 30/60/90 days.

What you'll build

In this recipe, you create an integration with the BILL v3 API in the sandbox environment.

  • Retrieve the list of all BILL organizations enrolled by your customers.
  • Retrieve the list of users in a selected organization.
  • Sign in as a user of the selected organization.
  • Gather funding bank accounts and payments information about your customer.

What you need before you begin

PrerequisiteDescription
API basicsA basic understanding of working with API endpoints.
CredentialsYour BILL Embed Partner credentials are required for your partner API requests. When you become a BILL embed partner, you get the required credentials (username, password, appKey, and devKey) for testing in the sandbox environment. You will use your devKey only in the final chapters in this recipe.

Chapter 1: Partner API login

In this chapter, you complete partner login with the API.

To begin, enter your API login credentials in the fields below. See the What you need before you begin section in this recipe if you have not set up your credentials.

Sandbox base URLhttps://gateway.stage.bill.com/connect
Production base URLhttps://gateway.prod.bill.com/connect

Complete the partner login with POST /v3/partner/login. Simply click Send to get a 200 OK response.

post/v3/partner/loginAPI partner login
Base URL
Required fields*
Body * required

Required: username, password, appKey

In the response, a new partner login sessionId is available. You use this sessionId and your appKey in the next set of chapters.


Chapter 2: Get list of organizations

In this chapter, you get details about BILL organizations that belong to your customers.

The ?sort=createdTime:desc query parameter enables you to sort BILL organizations in the descending order based on createdTime. Click Send to get a 200 OK response.

get/v3/partner/organizations?sort=createdTime%3AdescGet list of organizations
Base URL
Headers
Query parameters
Complete login first

In the response, you get a list of BILL organizations enrolled by your customers based on the filter and sort query parameters. You can identify each organization by the organization id in the response.

In Chapter 3, we use the id of the first organization in the response.


Chapter 3: Get list of users

In this chapter, you get the list of users in a selected organization. Click Send to get a 200 OK response.

In this example request, we use the id of the first organization returned from the GET /v3/partner/organizations response in Chapter 2.

get/v3/partner/users?sort=createdTime%3AdescGet list of users
Base URL
Headers
Query parameters
Complete login first

In the response, you get a list of users in the given organization. You can identify each user by the user id in the response. In addition, the email field provides the email address of each user in the given organization.

In Chapter 4, we use the id of the first user from this response.


Chapter 4: API sign in as user

In this chapter, you are now ready to sign in as the user of your selected BILL organization. Click Send to get a 200 OK response.

In this example request, we are using the id of the first user returned from the GET /v3/partner/users response in Chapter 3.

post/v3/partner/login-as-userAPI login as user
Base URL
Headers
Body * required

Required: userId, organizationId

Complete login first

Congratulations! You are now signed in as the user of a BILL organization. In the response, a new sessionId is available. You use this sessionId along with your devKey in all subsequent BILL v3 API requests for that organization. For example, get the list of bank accounts with GET /v3/funding-accounts/banks or get the list of payments with GET /v3/payments.


Chapter 5: Get list of bank accounts

In this chapter, you get a list of funding bank accounts connected by your customer for making payments. This is an example of an API request that you can make after you have successfully signed in as the user of the BILL organization. Click Send to get a 200 OK response.

Enter your devKey for Chapters 5 and 6.

get/v3/funding-accounts/banksGet list of bank accounts
Base URL
Headers
Complete login first

In the response, you get the complete list of funding bank accounts connected by your customer.

If this list is empty, you know that the customer did not connect a funding bank account. You can send the customer an email about completing their enrollment.

In addition, if the customer does not have a verified funding bank account ("status": "NOT_VERIFIED"), the customer is not ready to make payments. You can send the customer an email about completing their bank account verification.


Chapter 6: Get list of payments

In this chapter, you get a list of payments made in your selected BILL organization. This is an example of an API request that you can make after you have successfully signed in as the user of the BILL organization. Click Send to get a 200 OK response.

In the request, you add a sort query parameter in the GET operation to sort all payments in the descending order based on createdTime.

get/v3/payments?sort=createdTime:descGet list of payments
Base URL
Headers
Complete login first

In the response, you get a list of payments made by your customer. You can further customize your GET /v3/payments request with filtering and sorting capabilities.

If the createdTime value is over 30 days old, you know that the customer has not made a payment for at least 30 days. You can send the customer an email about making payments.

What you learned in this recipe

You just completed the BILL Embed Partner workflow to retrieve customer-specific information that can help you engage with your customers more effectively.

  • Complete the partner API login and create a session.
  • Retrieve a list of all BILL organizations enrolled by your customers.
  • Retrieve the list of users (and their email addresses) in a selected organization.
  • Sign in as a user of the selected organization.
  • Gather more usage data, such as funding bank accounts and payments.

With this information, you can curate email engagement campaigns for a range of reasons.

  • Prompt customers to complete enrollment.
  • Prompt enrolled customers to make their first payment.
  • Prompt paying customers to deepen their payment volume and/or to explore incremental features.